Show HN: I was curious about spherical helix, ended up making this visualization

visualrambling.space

417 points by damarberlari 5 hours ago


I was wondering how I can arrange objects along a spherical helix path, and read some articles on it.

I ended up learning about parametric equations again, and make this visualization to document what I learned:

https://visualrambling.space/moving-objects-in-3d/

feel free to visit and let me know what you think!

srean - 5 hours ago

These used to be super important in early oceanic navigation. It is easier to maintain a constant bearing throughout the voyage. So that's the plan sailors would try to stick close to. These led to let loxodromic curves or rhumb lines.

https://en.m.wikipedia.org/wiki/Rhumb_line

Mercator maps made it easier to compute what that bearing ought to be.

https://en.m.wikipedia.org/wiki/Mercator_projection

This configuration is a mathematical gift that keeps giving. Look at it side on in a polar projection you get a logarithmic spiral. Look at it side on you get a wave packet. It's mathematics is so interesting that Erdos had to have a go at it [0]

On a meta note, today seems spherical geometry day on HN.

https://news.ycombinator.com/item?id=44956297

https://news.ycombinator.com/item?id=44939456

https://news.ycombinator.com/item?id=44938622

[0] Spiraling the Earth with C. G. J. Jacobi. Paul Erdös

https://pubs.aip.org/aapt/ajp/article-abstract/68/10/888/105...

sfink - 4 hours ago

Awesome visualizations.

The part that I was expecting to see but didn't: how can you move at a constant speed? For the original purpose of positioning objects along a path, it doesn't matter. But when moving, you can see it's moving much more slowly at the beginning and end (mostly determined by the radius). What if I want it to travel at a constant rate? Or even apply an easing function to the speed?

I'm sure there's some fancy mathematical trick that would just do it. If I were only more comfortable with math... my handwavy sketch would be to compute the speed function by differentiating the formulas to get dx, dy, and dz and passing them through the Pythagorean equation, then reparameterize on a t' variable using the inverse of the speed function? Maybe? I feel like I'm speaking using words I don't understand.

pavel_lishin - 22 minutes ago

I've recently gotten interested in p5js, which is a fun and easy way to explore this kind of stuff; if anyone here is currently thinking (like I am) that you want to try this out yourself, I'd give it a try: https://p5js.org/tutorials/setting-up-your-environment/

mayoff - 27 minutes ago

You can play with the equations on 3D Desmos here: https://www.desmos.com/3d/t66etxi1y8

Interesting to note that the parametric equations of the spiral are linear in spherical coordinates. https://en.wikipedia.org/wiki/List_of_common_coordinate_tran...

erikerikson - 4 hours ago

Thanks. My useful feedback is that navigation violated my expectations. I was in mobile FWIW. I didn't know what to do so I started to scroll. My touch to the screen kicked into the next pane so I'm like "oh, okay". I happened to touch the right side so I thought that advanced it and so when I later clicked an extra time unintentionally, I tried to click the left side to go back (note that people who read right to left it top to bottom may have different intuitions [or be used to an insensitive web]). Unfortunately that just skipped another screen so that I missed two in a row. Not fatal because I kept going but disappointing and micro-sad. I think some subtle guidance could have removed the ambiguity and helped me focus and engage better.

pimlottc - 5 hours ago

I was wondering about the “correctness” of the z-axis movement for the spherical helix. You could pick lots of different functions, including simple linear motion (z = c * t). This would obviously affect the thickness and consistency of the “peels”.

The equation used creates a visually appealing result but I’m wondering what a good goal would be in terms of consistency in the distance between the spirals, or evenness in area divided, or something like that.

How was this particular function selected? Was it derived in some way or simply hand-selected to look pleasing?

willdelorm - 32 minutes ago

I am about to start my computer science degree, so this visualization got me really excited to dive into the mathematics of it all. I love to see these kind of animations, but the math behind them sends my brain spinning! Very cool to see it broken down in a digestible way like this.

RugnirViking - 5 hours ago

It's a pretty basic primer to the subject, but good for kids learning maths. Could do with some callbacks to maths concepts like the circle equation ( x = r cos (t) and y = r sin (t) ).

Possible topics to branch further into would be polar coordinates and linear algebra basics (vectors, transformations, transformations in 3d space). If you the author aren't sure of such topics, I would recommend 3blue1brown yt videos on the matter

Possibly better for that than for programmers (given it doesn't include code or libraries used or anything about actually manipulating 3d objects like vertices, stretching and morphing to achieve the effect shown etc)

reeece - 2 hours ago

The animations are so fluid!

I very recently was looking to generate some complex shapes, and stumbled onto the complex problem of "disperse N points on sphere" and all its nuances.

There was a really cool / simple algorithm that was mentioned called the fibonacci-sphere that also generates a spiral around a sphere, but for the point dispersal. Here's a paper [1] on it that talks more about it.

[1] - https://arxiv.org/pdf/0912.4540

alias_neo - an hour ago

Really nice visualisation.

Does anyone know of any tooling I could use to do some plotting like this in 3D space even a fraction as nice looking as OPs? I'm not a web dev but I am a dev, but would prefer something high enough level that I can focus on the "what" (to plot) rather than the "how".

thefringthing - an hour ago

Grammar problem: "In 3D space, we position objects by setting its coordinates" should read either "their coordinates" or "an object".

gabeyaw - 2 hours ago

This reminds me of how the spins in MRI are manipulated in order to acquire the signal. Tracking the tips of the spins traces out similar looking paths. https://m.youtube.com/watch?v=vapJRr6gAds&t=2786s

Duanemclemore - 5 hours ago

This is excellent. I'm always looking for good things to show my students on coordinate systems and geometry, and this joins the list. Thank you for diving down the rabbit hole and bringing this back for everyone.

If you want really great further consideration of creating geometric figures with parametric equations, Joseph Choma's book "Morphing" is an all-timer.

https://www.quercusbooks.co.uk/titles/joseph-choma/morphing/...

latexr - 4 hours ago

> If you like this, please consider following me on Twitter and sharing this with your friends.

I do like this and will share with a couple of friends. But I no longer have a Twitter account and will definitely not rejoin. Would you consider adding an RSS or JSON feed to your website? Or make a Mastodon account, those provide RSS feeds by default.

danans - 5 hours ago

Nifty, but what I'm curious about is how you created the drain/fill effect on the cube.

dcanelhas - 2 hours ago

https://www.johndcook.com/blog/2023/08/12/fibonacci-lattice/

If you want a spiral that covers the sphere with evenly spaced samples, consider this approach.

dgrin91 - 4 hours ago

Very cool & pretty, but I feel a little let down. There is a huge leap from the basics of 3d plotting & spheres to the crazy pattern you tease and then show at the end. I understand it as someone who kind of knows this stuff already, but I think its way too big of a leap for someone who doesn't have the background.

fluoridation - 5 hours ago

For me personally it's simpler to think about it as having an f(theta, r) = r (cos(thetha), sin(theta)), interpreting theta as a compass direction and r as a distance to walk along a great circle. So g(t) = polar_to_R3(f(t k, t l)). Changing the relative sizes of k and l changes the tightness of the helix.

hailpixel - 4 hours ago

I LOVE when people geek out about the most simple mathematical things*, especially discovering the animation power of the trigonometric functions... or any of mathematics underlying modern interactive stuff. It's one thing to know what they do, it's another to understand the power of that tool.

* I wrote a similar article around making "blobs" a while back: https://www.hailpixel.com/articles/generative-art-simple-mat...

tantalor - 3 hours ago

> Together, these functions create a spherical helix... That's all!

This strikes me as backwards reasoning.

You are showing "these functions" -> spherical helix

But I actually want spherical helix -> "these functions"

1. What if I want to make some other shape? I'm lost.

2. I have learned nothing about the spherical helix.

NooZ - an hour ago

I never tought this would be interesting but it is VERY much.

mustaphah - 3 hours ago

I can't tell why, but I'm getting terrible performance on Linux/Brave. The CPU spikes immediately on visit. I'm on a powerful machine (32 GiB RAM, Intel i9 w/ 24 cores).

MarcelOlsz - 2 hours ago

Wish the bundle.js wasn't minified so I can look at the code and see what's going on!

mostlyk - 5 hours ago

This is super nice to view, could you share how you made it? I want to make something similar for Rotation Matrices

1970-01-01 - 5 hours ago

That is beautiful animation. This is a great example of a visual lesson that leaves a chalkboard in the dust (ha).

lucho_mzmz - 2 hours ago

Cool! My first instinct was to scroll. I suggest you treat the scroll down as a signal to move 1 slide further

lucho_mzmz - 2 hours ago

Cool! My first instinct was to scroll. I suggest you use the scroll down as a signal to move 1 slide further

aacid - 4 hours ago

Really love this project, I only have small little UX nitpick: as lefthanded person it is quite cumbersome to tap right side of screen. Go to solution is to navigate using swiping which is ambidexterous.

ShahoG - 3 hours ago

This was amazing! I also checked the understanding neural network. Looking forward to the next part in that one. Keep up the good work!

ramathornn - 2 hours ago

This is so cool! Thanks for sharing, stuff like this is why I love HN.

taherchhabra - 2 hours ago

so beautiful. thank you for this. I am trying to develop intuition for sine cosine etc. and it did fire some neurons in my brain not sure i can put that into words

maxbaines - 5 hours ago

Best thing I have seen on HN in ages. Also interesting for a CNC geek.

stephenlf - 3 hours ago

I love the slight aliasing on the visuals (iOS Safari). It makes it obvious that it’s rendered on the fly.

jtbayly - 3 hours ago

I believe there is a typo here:

y = 10 * sin(πt/2) * sin(0.02 * πt)

On the previous two slides the end is sin(0.2 * πt)

mystraline - 4 hours ago

When I first opened it, its basically a bunch of static pages that made absolutely no sense. My first question was 'why is this garbage being #1 on HN?'

Then I realized that, unlike the early web with banners of "best viewed in Netscape navigator", this was an unstated "best viewed in google chrome".

Alas. At least please check and validate if the site works in Firefox, or notify appropriately. Because this demonstrably does not.

fleebee - 5 hours ago

I love this. It's pretty and really easy to digest.

chamomeal - 5 hours ago

Really nice animations! This is the type of thing that was really hard for me to grasp in school. This lays it out so plainly.

meken - 2 hours ago

This was delightful - thank you!

SKILNER - 4 hours ago

That's an excellent job of teaching - thank you!

nedsma - 3 hours ago

Brilliant, I learned something today.

dwayne_dibley - 3 hours ago

Well this is lovely. Well done.

markusw - 4 hours ago

Beautifully done, thank you for sharing. :-)

thopkinson - 3 hours ago

This is fantastic. What a terrific combination of the creative presentation and the clear exposition of information. You've hit on a very nice aesthetic and a stunningly clear articulation of the underlying mechanics.

ezconnect - 3 hours ago

The solar system spiraling through the universe.

Tyr42 - 4 hours ago

Okay, I have some followup questions. Are the points equally spaced? I.e. the cube's |∆p| is constant? I see you scale z by the sin. What happens of you don't?

scotty79 - 4 hours ago

I was expecting linear progression on z and some nasty square root for amplitude of x,y. It's cool that he basically just used another parametric circle drawn on coordinates z and amplitude of x,y oscillations.

exasperaited - 4 hours ago

This is very cool, but somewhat confusing to the eye, because you are actually demonstrating the movement of a point along a path, while visualising it with a cube whose orientation doesn't change when it feels like it should.

The point that is moving is in the centre of the cube. But the cube's orientation is fixed in global space.

So the cube's orientation relative to the path of the spiral/helix is not quite the same as its orientation relative to the path of the straight line.

Your mission, should you choose to accept it ;-)

https://en.wikipedia.org/wiki/Frenet–Serret_formulas

metalman - 2 hours ago

it's impressive enough to crash my browser (twise) before I got to see it the full digital resource conflict jam and judder!

adammarples - 2 hours ago

Very distracting to try and read text in the middle of a constantly spinning visualisation

nikolayasdf123 - 5 hours ago

quite beautiful

pinoy420 - 4 hours ago

[dead]