5 ms·
The code must somehow compute bouyancy in a way that reflects the object's arbitrarily complex shape. It's likely carving the object up into some number of smal
by sgtnoodle 6y ago
The code must somehow compute bouyancy in a way that reflects the object's arbitrarily complex shape. It's likely carving the object up into some number of smaller primitive objects whose equations for bouyancy are known. In order to make the whole object move as one rigid body, though, it's probably computing force vectors for each primitive, and then summing them together based on the overall object's center of mass and moment of inertia.
My guess is that the object's mass and inertia is calculated in a way that is sensitive to the handedness of the drawing. The code probably takes the absolute value of the result so that right-handed and left-handed drawings both end up with positive mass. When you draw lobes though, the signedness alternates and cancels out, leading to less mass. With even numbers of lobes of near equal size, you end up with near zero mass.
The forces being computed on each primitive are probably representative of that primitive's true mass. Subsequently applying those same forces to a rigid body with significantly less mass therefore results in extreme acceleration. f=ma, f/m=a. f/0=explode.
- sillysaurusx 6y agoIf anyone wants to do this, you're looking for "approximate convex decomposition": http://codesuppository.blogspot.com/2006/04/approximate-convex-decomposition.html http://codesuppository.blogspot.com/2006/04/approximate-conv... It was one of the grand challenges in the 00's, quietly solved by John Ratcliff. Then a few people solved it after him. It's a fun algorithm. You basically slice and dice, like chopping a potato, then recombine small parts together based on a heuristic.
- arithma 6y agoI knew this was happening, but reading it, hey, maybe that's one way to get anti-gravity. Just loop the topology on itself. Obviously commenting in jest, but now I'm intrigued to see if someone has seriously considered this.
- 5600k 6y agoOne of the theoretical reverse time travel machines I read about in the past involved stabilizing a wormhole first and then dragging it somewhere else, like to the future relative to current time by traveling near light speed with it, so you could get back to the earlier time. Kip Thorne wrote of something that involved an extreme amount of mass in a spinning cylinder. That kind of mass was imagined to be at a huge scale like harnessing a number of stars and compressing them, iirc. A device theorized or implemented by Salvatore Pais involves use of superconductors and microwaves to create an effective vacuum, like dragging part of spacetime. It could allow FTL relocation without actual speed. This could also create an area of effectively high masses that could allow time travel, even eventually reverse time travel, under theoretical conditions.
- yarcob 6y agoIf you look at the source, you'll see that it doesn't really try to split the path into smaller primitives at all. It uses a simple algorithm (https://stackoverflow.com/a/33852627 https://stackoverflow.com/a/33852627) to calculate the center of mass, and another algorithm to calculate the area (https://stackoverflow.com/a/33670691 https://stackoverflow.com/a/33670691). Both of these algorithms basically sum up the "signed area" of the polygons. This means that if you circle something twice, it'll count twice, and the sign depends on the direction of the winding. The confusing part is that when the polygon is drawn, it uses the "non-zero winding rule" to determine which part to fill. So the filled parts of the polygons are all parts that contribute non-zero parts to the area (eg. positive, negative, two time positive etc.). So the weird behaviour is that the physics simulation doesn't use the same rules as the visualisation! So the nice thing about these algorithms is that it works for arbitrary complex shapes as long as the path has no self-intersections. If you want to add support for self-intersecting paths, you need to decide how to deal with intersections. Presumably you'd want the physics to match the visualisation, ie. use the non-zero winding rule also for centroid and area calculations. To do that, you would first need to split the polygon into non-intersecting parts, and then calculate the area separately for each part, and then sum up the absolute values of the individual parts.
- yarcob 6y agoI annotated a screenshot with winding numbers. You'll see that the filled areas correspond to the parts with non-zero winding numbers, but the physics simulation considers the sign and magnitude. https://i.imgur.com/3OLflHc.png https://i.imgur.com/3OLflHc.png
- sgtnoodle 6y agoThanks for tracking down the actual algorithms! It appears that they work by summing the "signed" areas of half-trapezoids formed between each neighboring pair of vectors and an arbitrary axis line, so I'm going to stand by my claim that the code breaks the polygon up into smaller primitives. :-) Good catch with the discrepancy between the physics and the visualization. I wonder if there's a way to engineer a cool structure with a lot of invisible mass. Do you have a notion of how the code actually computes bouyancy? Does it somehow slice the polygon into two at the water line and then compute center and area of both? Once again, it would be interesting to engineer an object that leverages any non-linear behaviors at the water line, perhaps like an object whose mass changes depending on its position and orientation.