Draw an iceberg and see how it would float in water
https://joshdata.me/iceberger.html
raldi · 5 years ago
61 comments
https://joshdata.me/iceberger.html
raldi · 5 years ago
61 comments
thaumasiotes · 5 years ago
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 · 5 years ago
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 · 5 years ago
I thought I was the only one who drew Spock…
marcosdumay · 5 years ago
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).
djrogers · 5 years ago
Whoa - cool. After 3 tries I got one that didn't move at all!
frabjoused · 5 years ago
You can occasionally produce JS errors, and then all future icebergs won't move.
djrogers · 5 years ago
That makes me feel less smart
sys_64738 · 5 years ago
I got one to float upwards into the air? Can that really happen?
MattGaiser · 5 years ago
What shape?
jhardy54 · 5 years ago
I got very strange behavior like that with figure 8s.
s0rce · 5 years ago
Depends how much helium is inside.
yesenadam · 5 years ago
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 · 5 years ago
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 · 5 years ago
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 · 5 years ago
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.
xwdv · 5 years ago
Can’t wait to see a 3D version!
_kst_ · 5 years ago
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.
taeric · 5 years ago
If you do the same shape without "crossing" over the lines, it does as you might expect. So, yeah, amusing bug. :D
mkl · 5 years ago
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.
anoncow · 5 years ago
Figure of 8 icebergs fly off, then sink completely and finally float. Fun stuff. Is the source available?
And some of them completely disappear!
thaumasiotes · 5 years ago
Yes, you can see the source just by doing "view source" in the browser. It's nicely commented and everything.
elc0c0 · 5 years ago
yeah!!
jzer0cool · 5 years ago
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!
dheera · 5 years ago
I think I broke it https://i.imgur.com/WQiLpKb.png
yibg · 5 years ago
sailboat apparently also floats like a sailboat would: https://imgur.com/a/2DwYh0j
jojobas · 5 years ago
Funnily, it seems to glitch at the screen edges.
fingerlocks · 5 years ago
If you draw a bucket or any convex shape it fills with water (via osmosis?) and sinks.
MarkMc · 5 years ago
This 'bug' actually makes it more interesting and engaging
sgtnoodle · 5 years 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 · 5 years ago
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 · 5 years ago
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 · 5 years ago
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 · 5 years ago
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.
yarcob · 5 years ago
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.
sgtnoodle · 5 years ago
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 · 5 years ago
> 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 · 5 years ago
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.
yarcob · 5 years ago
That's brilliant!
maxrmk · 5 years ago
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.
rbobby · 5 years ago
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.
(there are about 4 completed saw tooths above the screen)
sgtnoodle · 5 years ago
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!
rampant_ai · 5 years ago
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!
sgtnoodle · 5 years ago
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 · 5 years ago
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 · 5 years ago
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 · 5 years ago
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.
crazyKoala2 · 5 years ago
I made a vertical one just by making it very thin: https://gliggy.github.io/tallandthin.png
croes · 5 years ago
Fo be fair, this shape is hardly possible for a real iceberg.
Sharlin · 5 years ago
You mean there are no zero-volume nonorientable-manifold Klein bottle icebergs in real life? :(
NiceWayToDoIT · 5 years ago
Antigravity device :)
wruza · 5 years ago
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.
ajuc · 5 years ago
It's a shame we can't recreate this material in real life :)
ghusbands · 5 years ago
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 · 5 years ago
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.
madprops · 5 years ago
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
t0astbread · 5 years ago
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 · 5 years ago
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.
Aardwolf · 5 years ago
I'm having so much fun with the before-the-fix version, you can make it "jump" out of the water, if you draw a figure 8 under water, and when the negative lobe is at the top and around 75% of the size of the positive one
Even more optimal: https://imgur.com/7gCEJ0T
I've had more extreme versions of this shape teleport off-screen, when starting them under water: https://imgur.com/ymVtTWq
And here's someone holding a balloon: https://imgur.com/8O4rib8
crazyKoala2 · 5 years ago
It still works, you just have to mess around with the lines a bit more: https://gliggy.github.io/broken.png
dheera · 5 years ago
Damnit it was so much more fun before the "fix".
lbblack · 5 years ago
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?
therealdrag0 · 5 years ago
Try drawing an infinity symbol. It flips out.
thaumasiotes · 5 years ago
I think it makes mistakes whenever your line crosses itself.
iambateman · 5 years ago
This is so fun.
Thanks for putting it together.
foobarbecue · 5 years ago
Now make them melt & capsize, add some units, and you have a genuinely useful research tool
covfiefy · 5 years ago
The twitter thread that spawned this
JBiserkov · 5 years ago
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.
jsnell · 5 years ago
Clearly yes. The page links to that exact tweet, and says it was the inspiration.
JBiserkov · 5 years ago
My bad, I didn't notice the scroll bar.
The only text I saw "above the fold" was the one above the drawing surface.
_tom_ · 5 years ago
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.
activatedgeek · 5 years ago
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?
tolbish · 5 years ago
Very cool! I love when HN feels like a hands-on museum.
korginator · 5 years ago
I drew a four leaf clover and it shot out of the page
pengwing · 5 years ago
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 · 5 years ago
What parts of jquery in particular?
XCSme · 5 years ago
I think the Node querySelector $('selector'), attaching event listeners, getting and setting element width/height
efreak · 5 years ago
My 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 · 5 years ago
Yes, 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
bjarneh · 5 years ago
jquery is still a superb library, such a clever design.
azinman2 · 5 years ago
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.
whatshisface · 5 years ago
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 · 5 years ago
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 · 5 years ago
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.
gaius_baltar · 5 years ago
> 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 · 5 years ago
Yes agree completely and the same counter argument can be made for more advanced frontend frameworks.
capableweb · 5 years ago
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.
vmception · 5 years ago
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 · 5 years ago
Was this written by GPT-3?
vmception · 5 years ago
Yes, it was a deep fake trained by solidity and JS developers making 8-figures of revenue launching purely frontend products.
lettergram · 5 years ago
Draw an hour glass and the iceberg will fly away off the screen lol
Good besides
tenken · 5 years ago
This appears to be trying to find the direction of the Normal Force on the center of mass..
thaumasiotes · 5 years ago
It's trying to position the center of mass of the submerged ice directly below the center of mass of the entire iceberg.
arthurcolle · 5 years ago
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 · 5 years ago
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.
k_sze · 5 years ago
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.
thaumasiotes · 5 years ago
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 · 5 years ago
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.
chrisdalke · 5 years ago
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 · 5 years ago
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 · 5 years ago
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 · 5 years ago
It's possible to engineer a stable boat in this simulation based on that principle for stability.
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 · 5 years ago
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.
peterburkimsher · 5 years ago
Draw a heart, and it's stable!
jay-anderson · 5 years ago
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.
theflyinghorse · 5 years ago
Somehow I am wiling to bet that penis will be found to be the most commonly drawn shape.
gred · 5 years ago
Be right back.
dhsysusbsjsi · 5 years ago
Looks like the top shaft is above the waterline
eimrine · 5 years ago
aksss · 5 years ago
Hourglass shape behaves pretty cool - that is, two triangles joined at their points
rkagerer · 5 years ago
And drawing them at the bottom yields very different results than partially or fully above the surface!
aksss · 5 years ago
I think they fixed this - today I can’t make the same shape, it just drops one of the triangles.
rkagerer · 5 years ago
Yeah, they added a sun, too.
mikewarot · 5 years ago
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 · 5 years ago
I drew a triangle with a small part sticking out above water and the whole thing flipped into V.
trustdragon · 5 years ago
The more nodes you put the more crazy the motion.
eyelidlessness · 5 years ago
Couldn’t sink an iceberg shaped like Swiss cheese.
winrid · 5 years ago
The algorithm for determining the outline seems pretty efficient. I just drew circles for a while, and it instantly figured out the bounds.
yesenadam · 5 years ago
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 · 5 years ago
Another version of the pdf: https://pdfhost.io/v/im99v6oam_howthingsfloat1991pdf.pdf
markdown · 5 years ago
Icebergs really are unstable, despite the popular perception that 90% of the berg is underwater, ensuring that the top 10% is stable.
tobmlt · 5 years ago
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!
daemoon · 5 years ago
Draw a thin line of ice and it bounces of the water.
dave_sid · 5 years ago
I did the Loch Ness Monster.
mojuba · 5 years ago
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
ledauphin · 5 years ago
on 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 · 5 years ago
Yes but surely concavities with trapped air are possible in real life? Not necessarily in the form of a spiral.
amelius · 5 years ago
I tried drawing a "boat", i.e. U-shape in the air region. But somehow water went in.
Tepix · 5 years ago
Can you draw something where only a triangle sticks out of the watery?
FriedrichN · 5 years ago
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!
SethMurphy · 5 years ago
This is so calming for me. I could draw myself to sleep.
KennethPT · 5 years ago
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 · 5 years ago
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.
MauranKilom · 5 years ago
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.
capableweb · 5 years ago
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 · 5 years ago
One way to avoid this might be to create an internal 3D model by rotating the drawing about the y-axis.
lowercase1 · 5 years ago
It's just potential energy minimization. A tall thin iceberg will float on its size in 2D or 3D.
Retric · 5 years ago
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.
tgb · 5 years ago
You can but only under very arbitrary situations that aren't common in real life. And if you're assuming it's not hollow and has constant density, then I doubt there's any way to make such an iceberg except if you look at it from one specific angle: looking from the side should give it away. Yet nearly every image of an iceberg seems to show them in that way.
Retric · 5 years ago
That’s a different question. In practice floating icebergs are often at a local minima not the global minima. They can be at very unstable orientations in calm seas. The constant melting process promotes instability.
8note · 5 years ago
This kind of drawing matches early year mechanical engineering courses.
The generalizations are to add density distributions and the 3rd dimension.
The math generalizes just fine for picking points that are stable. The motion on how it gets there relies on the full Navier Stokes vs the simplifications, so I wouldn't trust that you've actually gotten to the right stability point
__s · 5 years ago
Feature request: multiple icebergs, even better if they can collide
amelius · 5 years ago
Should have a button: "add polar bear"
akamhy · 5 years ago
Draw a sine wave for a dancing iceberg! It's not a joke.
akamhy · 5 years ago
not exactly a sine wave but https://streamable.com/99ujca is an example.
simias · 5 years ago
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.
peter_retief · 5 years ago
My terrible iceberg. https://imgur.com/HD2TRdO
l0rn · 5 years ago
i broke it: https://imgur.com/8e6AKMK
intrasight · 5 years ago
Has anyone drawn the Titanic iceberg yet?
rightbyte · 5 years ago
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.
bernardv · 5 years ago
It’s a lot of fun to play with and test your intuition
rhdxmr · 5 years ago
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.
hermitcrab · 5 years ago
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 · 5 years ago
Note drag increases with speed. So objects accelerate until drag negates buoyancy and then it just goes upwards at a costant speed.
hermitcrab · 5 years ago
I guess that the 'terminal velocity' is quite slow as the difference between water and ice buoyancy is small.
zupa-hu · 5 years ago
I thought it would be fun to share icebergs. ^^
https://iceberger.boomla.net/?id=0162f6a3c3e7e1e1bde4fade9c1...
standardUser · 5 years ago
And here I was just drawing penises!
zupa-hu · 5 years ago
LOL - the ice melts!!!
Here is a video at 12800x speed :P
plorg · 5 years ago
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.
soheil · 5 years ago
If you drawn an iceberg the size of the world then there won't be anything to float.
rimiform · 5 years ago
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.
Enginerrrd · 5 years ago
This works for the classic ice-cream cone shape to induce stable dynamics too.
dotancohen · 5 years ago
Challenge: Frame the sun. It took me about a dozen tries.
dotancohen · 5 years ago
Here's a decent one: https://imgur.com/a/aKZbWD8
samplenoise · 5 years ago
Is it possible to draw one that turns more than 90 deg before reaching equilibrium?
samplenoise · 5 years ago
Difficult but yes https://iceberger.boomla.net/?id=0112fe237a9686a4fdb49c1f1c6...
maybenotafart · 5 years ago
according to this, your standard "tip of the iceberg" triangle everyone refers to when using that phrase is all wrong
postalrat · 5 years ago
Works fine in groups https://i.imgur.com/RQE5Eku.png
zhamisen · 5 years ago
Very 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.
Blikkentrekker · 5 years ago
I was hoping for my phallusbergs to float with the scrotum upwards, but sadly they float on their sides.
fito · 5 years ago
Just leaving this here: https://twitter.com/alexbell/status/1363161637121892357
milkrocks · 5 years ago
A penis shape floats very well and level.