[HN Gopher] Draw an iceberg and see how it would float in water
       ___________________________________________________________________
        
       Draw an iceberg and see how it would float in water
        
       Author : raldi
       Score  : 1435 points
       Date   : 2021-02-20 03:16 UTC (19 hours ago)
        
 (HTM) web link (joshdata.me)
 (TXT) w3m dump (joshdata.me)
        
       | SethMurphy wrote:
       | This is so calming for me. I could draw myself to sleep.
        
       | djrogers wrote:
       | Whoa - cool. After 3 tries I got one that didn't move at all!
        
         | frabjoused wrote:
         | You can occasionally produce JS errors, and then all future
         | icebergs won't move.
        
           | djrogers wrote:
           | That makes me feel less smart
        
       | daemoon wrote:
       | Draw a thin line of ice and it bounces of the water.
        
       | simias wrote:
       | I had never considered that "ice cone shaped" icebergs wouldn't
       | be stable. It's obvious in hindsight, if you gave me an ice cube
       | shaped like that I'd never expect it to float upright.
       | 
       | Now every time I'll encounter one of those I'll feel mildly
       | irritated. Sometimes ignorance is bliss.
        
       | plorg wrote:
       | There seems to be a bug where in Firefox for Android the page
       | scrolls even when you're drawing in the canvas. This makes it
       | annoying to try and draw relined figures, which often result in
       | horizontal lines.
       | 
       | I don't have that problem in mobile Chrome.
        
       | MauranKilom wrote:
       | So without any further knowledge about how icebergs should orient
       | and how scientists draw them:
       | 
       | Icebergs in 3D will generally have different mass distributions
       | than the corresponding 2D projections that we are drawing here.
       | For example, there will generally be higher "2D mass density" in
       | the center.
       | 
       | Consequently, it is _possible_ that the scientists  "drawing
       | icebergs wrong" are actually right and it just looks/"behaves"
       | wrong in 2D. And even if they're doing it wrong, it's also
       | possible to learn the wrong lessons regarding floating stability
       | from this 2D playground.
        
         | lowercase1 wrote:
         | It's just potential energy minimization. A tall thin iceberg
         | will float on its size in 2D or 3D.
        
           | Retric wrote:
           | That's assuming the 2D representation is representative of
           | near uniform density. In 2D an I-beam and and a solid beam
           | look identical, but they don't represent the same amount of
           | mass for potential energy minimization.
           | 
           | Play with 3D shapes and you could get identical 2D cross
           | sections to float in arbitrary orientations.
        
         | capableweb wrote:
         | I concur! In addition to that, icebergs also probably don't
         | have a unified mass just based on the proportions. Some parts
         | of the iceberg will be snow, others will be very tightly packed
         | snow while others will be just ice, also with different
         | densities.
         | 
         | So the iceberg could very likely float like that when taking
         | into considering 3d space + the random distribution of mass
         | that is different in different parts of the iceberg.
        
         | azernik wrote:
         | One way to avoid this might be to create an internal 3D model
         | by rotating the drawing about the y-axis.
        
       | __s wrote:
       | Feature request: multiple icebergs, even better if they can
       | collide
        
       | sys_64738 wrote:
       | I got one to float upwards into the air? Can that really happen?
        
         | MattGaiser wrote:
         | What shape?
        
           | jhardy54 wrote:
           | I got very strange behavior like that with figure 8s.
        
         | s0rce wrote:
         | Depends how much helium is inside.
        
       | soheil wrote:
       | If you drawn an iceberg the size of the world then there won't be
       | anything to float.
        
       | yesenadam wrote:
       | Draw a horizontal line under the water, then return back to its
       | start with a wavy line crossing over the first line repeatedly.
       | Very strange things happen. The first time i tried, it leapt out
       | of the water then flapped around..
        
         | mormegil wrote:
         | To trigger the behavior, it seems the waves need to be
         | "asymmetric" in that if the leftest one is up, the rightest one
         | needs to be down. Otherwise, it seems to behave normally.
        
           | yesenadam wrote:
           | Yeah, I noticed that, so it turns around rapidly. Maybe the
           | "righting arm" torque overflows when it's much bigger than it
           | ever would be in reality.
        
         | marcosdumay wrote:
         | The site's algorithm generates negative masses when you cross
         | the lines. There's a discussion about it in another thread.
         | 
         | This is a very obvious in retrospect flaw for anybody that has
         | experience in graphic computing, but it's a common gotcha even
         | there.
        
       | l0rn wrote:
       | i broke it: https://imgur.com/8e6AKMK
        
       | xwdv wrote:
       | Can't wait to see a 3D version!
        
       | _kst_ wrote:
       | I get interesting results if I draw a figure 8 (or a figure [?]).
       | I wonder if it's treating one of the lobes as having negative
       | density.
        
         | madprops wrote:
         | I tried with a timeglass-like shape. It flew around the map,
         | going in and out of view and eventually setting on/in the water
         | https://i.imgur.com/kcT9elV.jpg
        
         | jzer0cool wrote:
         | I draw an ice cream cone. First draw the ice cream like you
         | would a cloud. Once connected then continue to draw the cone ,
         | such that you draw a V to connect to the ice cream.
         | 
         | It flys!
        
         | t0astbread wrote:
         | I think this was patched just now. On my last visit a few
         | minutes ago the bug still worked, now it removes any larger
         | bits where the lines intersect.
         | 
         | Also, the code has been amended right where this comment is:
         | // People like to draw shapes with kinks, which results
         | // in part of the polygon being treated as negative area.
         | // turf.unkinkPolygon can be used to find the kinks and
         | // separate the polygon into multiple polygons at the       //
         | kinks, but it's a little fragile and hard to combine       //
         | into a single unkinked polygon. [...]
        
           | jinseokim wrote:
           | You may want to revert the (tedious) patch about
           | intersections. Here is a simple workaround:
           | 
           | > turf.unkinkPolygon=(x)=>x;
           | 
           | Press F12, click 'Console', copy-paste the above one and
           | press Enter.
        
           | crazyKoala2 wrote:
           | It still works, you just have to mess around with the lines a
           | bit more: https://gliggy.github.io/broken.png
        
           | dheera wrote:
           | Damnit it was so much more fun before the "fix".
        
         | dheera wrote:
         | I think I broke it https://i.imgur.com/WQiLpKb.png
        
         | yibg wrote:
         | sailboat apparently also floats like a sailboat would:
         | https://imgur.com/a/2DwYh0j
        
         | lbblack wrote:
         | Symmetric and asymmetric behavior baffles me. Any progressive
         | papers on the independent relationships between infinite
         | limits, finite quantities, and asymmetric phenomenon would be
         | much appreciated from the homestead.
         | 
         | Also, what is the dependent relationship between stable states
         | and non-stable state systems? Is it more simple than thought
         | before?
        
         | jojobas wrote:
         | Funnily, it seems to glitch at the screen edges.
        
         | taeric wrote:
         | If you do the same shape without "crossing" over the lines, it
         | does as you might expect. So, yeah, amusing bug. :D
        
         | NiceWayToDoIT wrote:
         | Antigravity device :)
        
           | [deleted]
        
         | wruza wrote:
         | If you draw death, it often flies intimidatingly across the
         | screen. https://imgur.com/a/bVh5iAt Start drawing at trapeze
         | vertex left to the head.
        
         | fingerlocks wrote:
         | If you draw a bucket or any convex shape it fills with water
         | (via osmosis?) and sinks.
        
         | croes wrote:
         | Fo be fair, this shape is hardly possible for a real iceberg.
        
           | Sharlin wrote:
           | You mean there are no zero-volume nonorientable-manifold
           | Klein bottle icebergs in real life? :(
        
         | mkl wrote:
         | If you extend the infinity sideways (easy with touch, hard with
         | mouse) it seems to depend on how many lobes there are. 3, 5, or
         | 7 is stable, 4, 6, or 8 is very unstable.
        
         | MarkMc wrote:
         | This 'bug' actually makes it more interesting and engaging
        
         | ajuc wrote:
         | It's a shame we can't recreate this material in real life :)
        
         | sgtnoodle wrote:
         | 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 wrote:
           | If anyone wants to do this, you're looking for "approximate
           | convex decomposition":
           | 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 wrote:
           | I 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 wrote:
             | One 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 wrote:
           | If 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) to
           | calculate the center of mass, and another algorithm to
           | calculate the area (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.
        
             | sgtnoodle wrote:
             | Thanks 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.
        
               | yarcob wrote:
               | > Do you have a notion of how the code actually computes
               | bouyancy?
               | 
               | Weight force (downward) is determined by the full
               | polygon.
               | 
               | Buyancy force (upward) is determined by the part below
               | the water line.
               | 
               | Lateral/angular motion results from the fact that the
               | forces act on the centroids of the full polygon vs the
               | centroid of the submerged polygon.
               | 
               | The script seems to use a JS library named "turf" to clip
               | the polygon at the water line. Here's the line in the
               | source:
               | 
               | var pp = turf.bboxClip(p, [-Infinity, yZero, Infinity,
               | Infinity]).geometry.coordinates[0];
               | 
               | As far as I can tell, yZero is the water line, and pp is
               | the part of the polygon that is submerged.
        
               | sgtnoodle wrote:
               | Lol, thanks for the info. I was able to engineer an
               | iceberg-boat. The boat is low mass but high bouyancy. If
               | it were to be fully submerged, it would remain partially
               | sunk.
               | 
               | https://ibb.co/T1KG5DM
        
               | yarcob wrote:
               | That's brilliant!
        
             | yarcob wrote:
             | I 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
        
         | ghusbands wrote:
         | Given how much the behaviour varies at different angles and in
         | different positions, we can be fairly sure the algorithm used
         | is incorrect even without these odd cases. You can also see odd
         | orientation-dependent behaviours with non-weird shapes.
        
           | 5600k wrote:
           | It's very good though.
           | 
           | To really throw it off and make it stay underwater or hop
           | around, you must be quick to reduce the points and create
           | negative areas via crossover.
           | 
           | But it's impressive how it lets you draw beyond the
           | boundaries and reacts reasonably.
           | 
           | Best iceberg simulator I've ever used. I had fun playing with
           | it for at least ten minutes. I'd go so far as to recommend it
           | for education.
        
         | [deleted]
        
         | maxrmk wrote:
         | I spent... longer than I should have trying to take advantage
         | of this bug to recreate a stable version of the stereotypical
         | tall iceberg that the original tweet was complaining about.
         | 
         | https://imgur.com/a/WG6D0RJ
        
           | rbobby wrote:
           | From left to right draw a sawtooth shape. Make the last one
           | very wide. Then retrace your steps completing the other half
           | of the sawtooth.
           | 
           | https://imgur.com/a/Kb8Y8zv
           | 
           | (there are about 4 completed saw tooths above the screen)
        
           | [deleted]
        
           | [deleted]
        
           | rampant_ai wrote:
           | I was able to make sailboats that float if I cross the line
           | over itself so the sail is in "negative space", which keeps
           | it upright. Kinda neat!
           | 
           | https://i.imgur.com/2LZn50v.png
        
             | sgtnoodle wrote:
             | It's prettier than my boat. :-)
             | 
             | I believe it works because the sail consists of negative
             | mass. The overall mass of the boat is therefore lower, but
             | the part of the hull that's under water produces the same
             | amount of bouyancy based on the area of displaced water.
             | Because of the width of the hull, it's a stable
             | equallibrium.
             | 
             | Interestingly, if the sail were to become submerged, it
             | would create negative bouyancy and the boat would sink!
        
           | WJW wrote:
           | I don't think there is a stable "vertical" configuration
           | without the negative mass trick from crossing lines:
           | https://en.wikipedia.org/wiki/Metacentric_height
           | 
           | Any convex shape will tend to minimize the forces due to
           | buoyancy and "horizontal" should always go less deep (or
           | equal for a sphere) than "vertical"
        
             | mawise wrote:
             | https://imgur.com/a/OjuWEKK
             | 
             | It can be in a local minima of buoyancy without being a
             | global minima. Similar to an un-sharpened pencil balanced
             | on it's end.
        
               | WJW wrote:
               | Cool, I stand corrected. I tried with a few triangles of
               | my own but they never stayed upright, but maybe I just
               | suck at drawing and they all started too far off-center
               | to remain in the little "valley" of the stability
               | diagram.
        
           | sgtnoodle wrote:
           | You can create pontoons by circling over the same spot
           | repeatedly. It's like you're concentrating more mass into the
           | same area but reducing the density!
           | 
           | https://ibb.co/VmXShfY
        
         | anoncow wrote:
         | Figure of 8 icebergs fly off, then sink completely and finally
         | float. Fun stuff. Is the source available?
         | 
         | And some of them completely disappear!
        
           | elc0c0 wrote:
           | yeah!!
        
           | thaumasiotes wrote:
           | Yes, you can see the source just by doing "view source" in
           | the browser. It's nicely commented and everything.
        
       | amelius wrote:
       | Should have a button: "add polar bear"
        
       | therealdrag0 wrote:
       | Try drawing an infinity symbol. It flips out.
        
         | thaumasiotes wrote:
         | I think it makes mistakes whenever your line crosses itself.
        
       | iambateman wrote:
       | This is so fun.
       | 
       | Thanks for putting it together.
        
       | winrid wrote:
       | The algorithm for determining the outline seems pretty efficient.
       | I just drew circles for a while, and it instantly figured out the
       | bounds.
        
       | mojuba wrote:
       | The algorithm doesn't seem to be complete, it can't handle
       | concave shapes with trapped water or trapped air. But that's
       | probably too much to ask.
       | 
       | Edit: to illustrate the point, this iceberg had trapped air
       | before it stabilized and removed all air, which is physically
       | impossible: https://imgur.com/a/uiaW1qN
        
       | rimiform wrote:
       | You can create icebergs with 'holes' in them, which have very
       | interesting floating behaviour [0]. It doesn't work every time,
       | though. Not sure why.
       | 
       | [0] https://imgur.com/a/0lcW8xT
        
         | Enginerrrd wrote:
         | This works for the classic ice-cream cone shape to induce
         | stable dynamics too.
         | 
         | [0]https://imgur.com/a/F5TshLR
        
       | foobarbecue wrote:
       | Now make them melt & capsize, add some units, and you have a
       | genuinely useful research tool
        
       | covfiefy wrote:
       | The twitter thread that spawned this
       | 
       | https://twitter.com/GlacialMeg/status/1362557149147058178
        
       | peterburkimsher wrote:
       | Draw a heart, and it's stable!
        
         | jay-anderson wrote:
         | One of the first things I did. I expected it to turn on its
         | side. In general if you draw a triangle it will end up with one
         | of the edges up.
        
       | JBiserkov wrote:
       | Great page! Was this inspired by
       | https://twitter.com/GlacialMeg/status/1362557149147058178 ?
       | 
       | Try drawing the infinity symbol under water - mine jumped out of
       | the water! It even jumped off screen, and ended up like an 8,
       | half submerged, half above water.
       | 
       | My other attempt hit the water/air boundary from below, and
       | bounced back towards the bottom, off screen again, and reappeared
       | in a bit.
        
         | _tom_ wrote:
         | There seems to be a bug with figures with boundaries that cross
         | each other. Perhaps there is an issue with determining inside
         | vs outside for the figure.
         | 
         | An infinity symbol drawn so the line crosses itself has issues.
         | If you trace the outside of the symbol, without crossing, it
         | works as expected.
        
         | jsnell wrote:
         | Clearly yes. The page links to that exact tweet, and says it
         | was the inspiration.
        
           | JBiserkov wrote:
           | My bad, I didn't notice the scroll bar.
           | 
           | The only text I saw "above the fold" was the one above the
           | drawing surface.
        
       | zupa-hu wrote:
       | I thought it would be fun to share icebergs. ^^
       | 
       | https://iceberger.boomla.net/?id=0162f6a3c3e7e1e1bde4fade9c1...
        
         | standardUser wrote:
         | And here I was just drawing penises!
        
       | activatedgeek wrote:
       | Pretty cool!
       | 
       | Can someone summarize how this works?
       | 
       | Is this simply a numerical integration of volume and then some
       | assumptions to compute the buoyant force?
        
       | theflyinghorse wrote:
       | Somehow I am wiling to bet that penis will be found to be the
       | most commonly drawn shape.
        
         | dhsysusbsjsi wrote:
         | Looks like the top shaft is above the waterline
        
         | eimrine wrote:
         | https://donotdrawapenis.com/
        
         | gred wrote:
         | Be right back.
        
       | tolbish wrote:
       | Very cool! I love when HN feels like a hands-on museum.
        
       | amelius wrote:
       | I tried drawing a "boat", i.e. U-shape in the air region. But
       | somehow water went in.
        
       | samplenoise wrote:
       | Is it possible to draw one that turns more than 90 deg before
       | reaching equilibrium?
        
         | samplenoise wrote:
         | Difficult but yes
         | https://iceberger.boomla.net/?id=0112fe237a9686a4fdb49c1f1c6...
        
       | zupa-hu wrote:
       | LOL - the ice melts!!!
       | 
       | Here is a video at 12800x speed :P
       | 
       | https://twitter.com/tiborhalter/status/1363195782917144578
        
       | aksss wrote:
       | Hourglass shape behaves pretty cool - that is, two triangles
       | joined at their points
        
         | rkagerer wrote:
         | And drawing them at the bottom yields very different results
         | than partially or fully above the surface!
        
           | aksss wrote:
           | I think they fixed this - today I can't make the same shape,
           | it just drops one of the triangles.
        
       | korginator wrote:
       | I drew a four leaf clover and it shot out of the page
        
       | dave_sid wrote:
       | I did the Loch Ness Monster.
        
       | pengwing wrote:
       | Sidenote: Good demonstration that even in 2021 jQuery has its
       | place as the right tool for the job: quickly hacking together a
       | small project.
        
         | Waterluvian wrote:
         | What parts of jquery in particular?
        
           | XCSme wrote:
           | I think the Node querySelector $('selector'), attaching event
           | listeners, getting and setting element width/height
        
         | bjarneh wrote:
         | jquery is still a superb library, such a clever design.
        
         | whatshisface wrote:
         | jQuery would not be necessary for a project like this, browser
         | APIs are far enough along that many of its features are no
         | longer needed.
        
           | ckuhl wrote:
           | And yet, what is harder to attain and yet more necessary than
           | the knowledge and impetus to implement such a project?
           | 
           | It may not be necessary, but the specific tools are't the
           | part that are necessary.
        
             | tomstoms wrote:
             | It's interesting that proponents of a simpler web argue in
             | favor of Jquery for a use case where jquery is in fact very
             | easy to live without. One would almost think dogmatic
             | thinking is involved.
        
               | [deleted]
        
               | gaius_baltar wrote:
               | > It's interesting that proponents of a simpler web argue
               | in favor of Jquery for a use case where jquery is in fact
               | very easy to live without. One would almost think
               | dogmatic thinking is involved.
               | 
               | But to do without it, you will end up rewriting the
               | shortcuts and utility functions that JQuery provides,
               | effectively recreating a project-specific, less-tested
               | and less-supported JQuery.
        
               | tomstoms wrote:
               | Yes agree completely and the same counter argument can be
               | made for more advanced frontend frameworks.
        
               | capableweb wrote:
               | Are still talking about the jQuery usage in
               | https://joshdata.me/iceberger.html or in general? If the
               | former, then I agree that jQuery was unnecessary here,
               | all API functions used by the author now has appropriate
               | functions shipped natively in the browser runtimes, so
               | using jQuery was actually more work than not (unless the
               | author never used the vanilla API but have used the
               | jQuery API).
               | 
               | Otherwise I agree with you in general.
        
         | azinman2 wrote:
         | It doesn't tell you what you're doing or how to do it. It's
         | just a basic, flexible layer on top of the DOM and doesn't try
         | to be anything else. There should be more jQueries out there,
         | for all fields.
        
         | vmception wrote:
         | junior devs say dumb things about jQuery because they need to
         | build experience and clout in complicated bloatware
         | 
         | fortunately the crypto space is paying well enough these days
         | and all you need is a wallet connect button, without a backend,
         | so devs don't have to deal with this particular elitist
         | bullshit to get hired by someone else anymore
         | 
         | its actually questionable whether you need a frontend to make
         | money right now. I've seen plenty of "dutch auctions" with just
         | the liquidity pools: just gotta deploy a smart contract and
         | give instructions on how to form transactions to it.
        
           | XCSme wrote:
           | Was this written by GPT-3?
        
             | vmception wrote:
             | Yes, it was a deep fake trained by solidity and JS
             | developers making 8-figures of revenue launching purely
             | frontend products.
        
       | peter_retief wrote:
       | My terrible iceberg. https://imgur.com/HD2TRdO
        
       | yesenadam wrote:
       | The twitter thread links to this article about stable equilibria
       | explaining some of the physics
       | 
       | https://physicstoday.scitation.org/doi/10.1063/PT.3.4373
       | 
       | which in turn links to this paper, E. N. Gilbert's _How Things
       | Float_ , which gives much more detailed mathematical explanation
       | 
       | PDF:
       | http://111.90.145.71/scimag/get.php?doi=10.2307/2325023&key=...
        
         | erostrate wrote:
         | Another version of the pdf:
         | https://pdfhost.io/v/im99v6oam_howthingsfloat1991pdf.pdf
        
       | akamhy wrote:
       | Draw a sine wave for a dancing iceberg! It's not a joke.
        
         | akamhy wrote:
         | not exactly a sine wave but https://streamable.com/99ujca is an
         | example.
        
       | Tepix wrote:
       | Can you draw something where only a triangle sticks out of the
       | watery?
        
       | mrtweetyhack wrote:
       | My iceberg touched to bottom. Nice.
        
       | mikewarot wrote:
       | I drew an iceberg like I imagined them to be, it lifted only a
       | little bit out of the water and was stable. Which made me very
       | happy.
        
         | chime wrote:
         | I drew a triangle with a small part sticking out above water
         | and the whole thing flipped into V.
        
       | KennethPT wrote:
       | It's amazing that this kind of simulation can be done so
       | accurately with javascript in a web browser. I have no idea how
       | it was implemented but the computational load must be nontrivial.
        
         | whatever_dude wrote:
         | I haven't looked at the code but it's likely some out-of-the-
         | box physics engine, many of them available in JS. They often
         | have to employ many more complex physics features. Buoyancy is
         | just one of them. Computationally I'm sure it's complex, but
         | it's made to run at game tickrates, less than the max budget of
         | 16ms at a time.
        
       | markdown wrote:
       | Icebergs really are unstable, despite the popular perception that
       | 90% of the berg is underwater, ensuring that the top 10% is
       | stable.
       | 
       | Eg: https://www.instagram.com/p/CFMVvtQhLZj/
        
       | lettergram wrote:
       | Draw an hour glass and the iceberg will fly away off the screen
       | lol
       | 
       | Good besides
        
       | tenken wrote:
       | This appears to be trying to find the direction of the Normal
       | Force on the center of mass..
        
         | thaumasiotes wrote:
         | It's trying to position the center of mass of the submerged ice
         | directly below the center of mass of the entire iceberg.
        
       | intrasight wrote:
       | Has anyone drawn the Titanic iceberg yet?
        
       | bernardv wrote:
       | It's a lot of fun to play with and test your intuition
        
       | rightbyte wrote:
       | Is it accurate thought? I mean the icebergs are 3d and are
       | thicker in the middle. If the shape is 2d the tips have more mass
       | then they should.
        
       | rhdxmr wrote:
       | So much fun! I majored in mechanical engineering but I am
       | developing software totally irrelevant with it. This is
       | reminiscent of what I learned in university. I feel fun and
       | curious about the model for simulating this.
        
       | trustdragon wrote:
       | The more nodes you put the more crazy the motion.
        
       | arthurcolle wrote:
       | It would be cool if you could draw multiple icebergs and see how
       | they bump into each other/displace the water when multiple are
       | next to each other.
        
         | rkagerer wrote:
         | Destructible icebergs would be a favorite as well. I drew a
         | barbell in the air and desperately wanted it to crack in half
         | when it hit the surface.
        
       | hermitcrab wrote:
       | Cool. I notice that something dropped from the top accelerates
       | downwards. But something released at the bottom doesn't seem to
       | accelerate noticeably upwards. Even with drag, a bouyant object
       | should accelerate towards the suface, shouldn't it?
        
         | santialbo wrote:
         | Note drag increases with speed. So objects accelerate until
         | drag negates buoyancy and then it just goes upwards at a
         | costant speed.
        
           | hermitcrab wrote:
           | I guess that the 'terminal velocity' is quite slow as the
           | difference between water and ice buoyancy is small.
        
       | thaumasiotes wrote:
       | What a cool idea.
       | 
       | Drawing a star is fun.
       | 
       | If you draw something in the basic shape of a Y, with two thick
       | arms and one thin arm, my instinct tells me that the two thick
       | arms should end up on the top, with the thin one pointing down
       | into the water. Is that accurate? There's not much jostling in
       | the demo; any of the arms might end up pointing down.
       | 
       | EDIT: You can also pretty easily get something to float in either
       | an M or a W configuration. Now I want a slider for turbulence; I
       | bet some shapes are hard to dislodge from their current
       | orientation and some are easy.
        
         | koolba wrote:
         | Yes this is pretty cool! It'd be awesome if you could link to
         | the drawings. Though I bet descriptions of most of the images
         | would rhyme with "ice rocks".
        
           | saagarjha wrote:
           | I thought I was the only one who drew Spock...
        
         | marcosdumay wrote:
         | Hum... The most stable position is with the thin arm down, but
         | all three have meta-stability, so what position it ends up on
         | is path-dependent (until you go there and poke it so it rotates
         | really fast).
        
       | dotancohen wrote:
       | Challenge: Frame the sun. It took me about a dozen tries.
        
         | dotancohen wrote:
         | Here's a decent one: https://imgur.com/a/aKZbWD8
        
       | eyelidlessness wrote:
       | Couldn't sink an iceberg shaped like Swiss cheese.
        
       | [deleted]
        
       | k_sze wrote:
       | Hmm... what determines whether an iceberg would flip over? I
       | tried drawing bowl-shaped icebergs, one upright and one upside-
       | down. Both stayed in their general orientation without flipping
       | over.
        
         | chrisdalke wrote:
         | For many shapes, there are multiple points of stability! If you
         | drew a cross, you'd find that it could stabilize on any two
         | corners.
         | 
         | Stability of a floating object is determined by a "righting
         | arm": A torque produced by the horizontal offset between the
         | object's center of mass, and the center of buoyancy (The center
         | of mass of the portion underwater).
         | 
         | Sometimes, that torque produces "positive stability" -- When
         | the object tilts into the water, the center of buoyancy shifts
         | in a direction that increases the righting arm force and pushes
         | the object back upright.
         | 
         | On the other hand, other shapes produce "negative stability" --
         | Tilting the object shifts the center of buoyancy in a direction
         | that reduces the righting arm force, so the object flips.
         | 
         | This is why ships are (roughly) square shaped when looking at a
         | cross section: If you visualize a floating box tilting to the
         | right, more of the right side will be underwater. This produces
         | a righting arm force that turns the box back to the left.
         | 
         | The worst case for stability is a circle, since no matter what
         | angle the shape is at, the righting moment is always zero --
         | There's no horizontal offset between the center of mass and
         | center of buoyancy, so a circle never has a righting force.
        
           | praptak wrote:
           | When it comes to stability there is a crucial handicap
           | between ships and icebergs. The former have non-uniform mass,
           | so it is possible for a ship's center of mass to be below its
           | center of buoyancy. That's why ships have ballast - it lowers
           | the center of mass relative to the center of buoyancy.
           | 
           | An iceberg is uniform, so its center of buoyancy is always
           | below its center of mass. This makes its stability trickier,
           | as it relies on changes in the shape of the buoyancy to
           | follow the center of mass when disturbed.
           | 
           | A ship is a pendulum, an iceberg is an upright stick balanced
           | on one's nose :)
        
             | chrisdalke wrote:
             | Good point -- The way I described it really applies to
             | _any_ object floating in water. I don't have much
             | experience with ship design, but on small boat design you
             | can rely mostly on the geometry of the boat to produce a
             | sufficient righting moment even with a very high center of
             | mass.
             | 
             | Some off-shore speedboats have really incredible self-
             | righting because they've been designed to always have
             | positive stability at all angles. One of my favorite videos
             | of this in action: https://www.youtube.com/watch?v=Y2i1fOJ-
             | itw
        
               | sgtnoodle wrote:
               | It's possible to engineer a stable boat in this
               | simulation based on that principle for stability.
               | 
               | https://ibb.co/T1KG5DM
               | 
               | The trick is to draw a low-mass object with high
               | displacement, which happens to be possible because of the
               | existence of, uh, anti-iceberg? that has negative mass.
        
               | praptak wrote:
               | Yes, small boats are often constrained by shallow water,
               | so they cannot have too much ballast not to mention
               | things like bulb-keel. This means the hull needs to be
               | sufficiently broad and flat.
        
         | thaumasiotes wrote:
         | I suspect, based on nothing in particular, that one of those
         | orientations is more stable than the other, but the demo
         | doesn't provide enough turbulence to get from one to the other.
        
           | gus_massa wrote:
           | I agree. Finding the absolute minimum when there are many
           | local minimums can be very difficult.
           | 
           | I like https://en.wikipedia.org/wiki/Simulated_annealing it
           | does not guaranty to find the absolute minimum, it has a few
           | parameters that are difficult to tweak, but I got good
           | results.
        
       | tobmlt wrote:
       | I love the linked twitter page detailing the ... details of
       | floating configurations for icebergs. My old mentor used to talk
       | about how hard it was for the solvers to find stable
       | configurations for floating bodies/structures/rubberDuckies "back
       | in the old days"
       | 
       | Ah well... good times, and watch out for rotations that don't
       | matter!
        
       | FriedrichN wrote:
       | Is it just me or is there something funky with the cursor offset?
       | It seems to draw the line under my cursor more as I draw closer
       | to the bottom edge.
       | 
       | Other than that, pretty cool!
        
       ___________________________________________________________________
       (page generated 2021-02-20 23:01 UTC)