14 ms·
Draw an iceberg and see how it would float in water
- thaumasiotes 6y agoWhat 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 6y agoYes 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 6y agoI thought I was the only one who drew Spock…
- marcosdumay 6y agoHum... 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).
- djrogers 6y agoWhoa - cool. After 3 tries I got one that didn't move at all!
- frabjoused 6y agoYou can occasionally produce JS errors, and then all future icebergs won't move.
- djrogers 6y agoThat makes me feel less smart
- sys_64738 6y agoI got one to float upwards into the air? Can that really happen?
- MattGaiser 6y agoWhat shape?
- jhardy54 6y agoI got very strange behavior like that with figure 8s.
- s0rce 6y agoDepends how much helium is inside.
- yesenadam 6y agoDraw 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 6y agoTo 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 6y agoYeah, 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 6y agoThe 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.
- xwdv 6y agoCan’t wait to see a 3D version!
- _kst_ 6y agoI 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.
- taeric 6y agoIf you do the same shape without "crossing" over the lines, it does as you might expect. So, yeah, amusing bug. :D
- mkl 6y agoIf 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.
- anoncow 6y agoFigure of 8 icebergs fly off, then sink completely and finally float. Fun stuff. Is the source available? And some of them completely disappear!
- thaumasiotes 6y agoYes, you can see the source just by doing "view source" in the browser. It's nicely commented and everything.
- elc0c0 6y agoyeah!!
- jzer0cool 6y agoI 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!
- deleted 6y ago[deleted]
- dheera 6y ago
- therealdrag0 6y agoTry drawing an infinity symbol. It flips out.
- thaumasiotes 6y agoI think it makes mistakes whenever your line crosses itself.
- iambateman 6y agoThis is so fun. Thanks for putting it together.
- foobarbecue 6y agoNow make them melt & capsize, add some units, and you have a genuinely useful research tool
- covfiefy 6y agoThe twitter thread that spawned this https://twitter.com/GlacialMeg/status/1362557149147058178 https://twitter.com/GlacialMeg/status/1362557149147058178
- JBiserkov 6y agoGreat page! Was this inspired by https://twitter.com/GlacialMeg/status/1362557149147058178 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.
- jsnell 6y agoClearly yes. The page links to that exact tweet, and says it was the inspiration.
- JBiserkov 6y agoMy bad, I didn't notice the scroll bar. The only text I saw "above the fold" was the one above the drawing surface.
- _tom_ 6y agoThere 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.
- activatedgeek 6y agoPretty cool! Can someone summarize how this works? Is this simply a numerical integration of volume and then some assumptions to compute the buoyant force?
- tolbish 6y agoVery cool! I love when HN feels like a hands-on museum.
- korginator 6y agoI drew a four leaf clover and it shot out of the page
- pengwing 6y agoSidenote: Good demonstration that even in 2021 jQuery has its place as the right tool for the job: quickly hacking together a small project.
- Waterluvian 6y agoWhat parts of jquery in particular?
- XCSme 6y agoI think the Node querySelector $('selector'), attaching event listeners, getting and setting element width/height
- efreak 6y agoMy script template includes some things like `var $=a=>{return document.querySelector(a)}`, `...prototype.evt=(a,b)=>{var e=this.addEventListener(a,b);this.events=this.events||[];this.events.push(e);return e}` and a few other shortcuts. I generally do a mass search and replace to remove them before saving as sometimes i modify them, and conflicting userscripts isn't fun.
- XCSme 6y agoYes, you can replace basic functionality with a few lines of code, but jQuery has more features. For example, jQuery.on('') also works with dynamically created elements. If you want that in vanilla JS you have to write more lines a code, I actually created a library/function for this specific use case: https://github.com/Cristy94/dynamic-listener https://github.com/Cristy94/dynamic-listener
- bjarneh 6y agojquery is still a superb library, such a clever design.
- azinman2 6y agoIt 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.
- lettergram 6y agoDraw an hour glass and the iceberg will fly away off the screen lol Good besides
- tenken 6y agoThis appears to be trying to find the direction of the Normal Force on the center of mass..
- thaumasiotes 6y agoIt's trying to position the center of mass of the submerged ice directly below the center of mass of the entire iceberg.
- arthurcolle 6y agoIt 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 6y agoDestructible 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.
- k_sze 6y agoHmm... 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 6y agoFor 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 6y agoWhen 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 6y ago
- peterburkimsher 6y agoDraw a heart, and it's stable!
- jay-anderson 6y agoOne 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.
- theflyinghorse 6y agoSomehow I am wiling to bet that penis will be found to be the most commonly drawn shape.
- gred 6y agoBe right back.
- dhsysusbsjsi 6y agoLooks like the top shaft is above the waterline
- eimrine 6y agohttps://donotdrawapenis.com/ https://donotdrawapenis.com/
- aksss 6y agoHourglass shape behaves pretty cool - that is, two triangles joined at their points
- mikewarot 6y agoI 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 6y agoI drew a triangle with a small part sticking out above water and the whole thing flipped into V.
- trustdragon 6y agoThe more nodes you put the more crazy the motion.
- eyelidlessness 6y agoCouldn’t sink an iceberg shaped like Swiss cheese.
- winrid 6y agoThe algorithm for determining the outline seems pretty efficient. I just drew circles for a while, and it instantly figured out the bounds.
- yesenadam 6y agoThe twitter thread links to this article about stable equilibria explaining some of the physics https://physicstoday.scitation.org/doi/10.1063/PT.3.4373 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=27S4PV482ZK2A0N5 http://111.90.145.71/scimag/get.php?doi=10.2307/2325023&key=...
- erostrate 6y agoAnother version of the pdf: https://pdfhost.io/v/im99v6oam_howthingsfloat1991pdf.pdf https://pdfhost.io/v/im99v6oam_howthingsfloat1991pdf.pdf
- markdown 6y agoIcebergs 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/ https://www.instagram.com/p/CFMVvtQhLZj/
- tobmlt 6y agoI 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!
- deleted 6y ago[deleted]
- daemoon 6y agoDraw a thin line of ice and it bounces of the water.
- dave_sid 6y agoI did the Loch Ness Monster.
- mojuba 6y agoThe 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 https://imgur.com/a/uiaW1qN
- ledauphin 6y agoon the one hand, this is clearly a 2D simplification of a 3D problem. on the other... if you imagine your spiral as projecting outward a non-infinite distance, how could it possibly "trap" air? the air would flow toward (and away from) the viewing plane very quickly.
- mojuba 6y agoYes but surely concavities with trapped air are possible in real life? Not necessarily in the form of a spiral.
- amelius 6y agoI tried drawing a "boat", i.e. U-shape in the air region. But somehow water went in.
- Tepix 6y agoCan you draw something where only a triangle sticks out of the watery?
- FriedrichN 6y agoIs 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!
- SethMurphy 6y agoThis is so calming for me. I could draw myself to sleep.
- KennethPT 6y agoIt'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 6y agoI 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.
- MauranKilom 6y agoSo 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.
- capableweb 6y agoI 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 6y agoOne way to avoid this might be to create an internal 3D model by rotating the drawing about the y-axis.
- lowercase1 6y agoIt's just potential energy minimization. A tall thin iceberg will float on its size in 2D or 3D.
- Retric 6y agoThat’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.
- tgb 6y ago
- __s 6y agoFeature request: multiple icebergs, even better if they can collide
- amelius 6y agoShould have a button: "add polar bear"
- akamhy 6y agoDraw a sine wave for a dancing iceberg! It's not a joke.
- akamhy 6y agonot exactly a sine wave but https://streamable.com/99ujca https://streamable.com/99ujca is an example.
- simias 6y agoI 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.
- peter_retief 6y agoMy terrible iceberg. https://imgur.com/HD2TRdO https://imgur.com/HD2TRdO
- l0rn 6y agoi broke it: https://imgur.com/8e6AKMK https://imgur.com/8e6AKMK
- intrasight 6y agoHas anyone drawn the Titanic iceberg yet?
- rightbyte 6y agoIs 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.
- bernardv 6y agoIt’s a lot of fun to play with and test your intuition
- rhdxmr 6y agoSo 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.
- hermitcrab 6y agoCool. 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 6y agoNote drag increases with speed. So objects accelerate until drag negates buoyancy and then it just goes upwards at a costant speed.
- hermitcrab 6y agoI guess that the 'terminal velocity' is quite slow as the difference between water and ice buoyancy is small.
- zupa-hu 6y agoI thought it would be fun to share icebergs. ^^ https://iceberger.boomla.net/?id=0162f6a3c3e7e1e1bde4fade9c11e7d5c4f798ec75 https://iceberger.boomla.net/?id=0162f6a3c3e7e1e1bde4fade9c1...
- standardUser 6y agoAnd here I was just drawing penises!
- zupa-hu 6y agoLOL - the ice melts!!! Here is a video at 12800x speed :P https://twitter.com/tiborhalter/status/1363195782917144578 https://twitter.com/tiborhalter/status/1363195782917144578
- mrtweetyhack 6y agoMy iceberg touched to bottom. Nice.
- plorg 6y agoThere 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.
- soheil 6y agoIf you drawn an iceberg the size of the world then there won't be anything to float.
- rimiform 6y agoYou 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 https://imgur.com/a/0lcW8xT
- Enginerrrd 6y agoThis works for the classic ice-cream cone shape to induce stable dynamics too. [0]https://imgur.com/a/F5TshLR https://imgur.com/a/F5TshLR
- dotancohen 6y agoChallenge: Frame the sun. It took me about a dozen tries.
- dotancohen 6y agoHere's a decent one: https://imgur.com/a/aKZbWD8 https://imgur.com/a/aKZbWD8
- samplenoise 6y agoIs it possible to draw one that turns more than 90 deg before reaching equilibrium?
- samplenoise 6y agoDifficult but yes https://iceberger.boomla.net/?id=0112fe237a9686a4fdb49c1f1c6445267d424a3a26 https://iceberger.boomla.net/?id=0112fe237a9686a4fdb49c1f1c6...
- maybenotafart 6y agoaccording to this, your standard "tip of the iceberg" triangle everyone refers to when using that phrase is all wrong
- postalrat 6y agoWorks fine in groups https://i.imgur.com/RQE5Eku.png https://i.imgur.com/RQE5Eku.png
- zhamisen 6y agoVery cool! It would be nice to use it for showing how a figure bounded by a Zindler curve [1] and with half the density of water will float in water in any position. [1]: https://en.wikipedia.org/wiki/Zindler_curve https://en.wikipedia.org/wiki/Zindler_curve
- Blikkentrekker 6y agoI was hoping for my phallusbergs to float with the scrotum upwards, but sadly they float on their sides.
- fito 6y agoJust leaving this here: https://twitter.com/alexbell/status/1363161637121892357 https://twitter.com/alexbell/status/1363161637121892357
- milkrocks 6y agoA penis shape floats very well and level.