How to roll a yoga mat - box geometry + rotations

Hello community,
since few days I can’t wrap my head around a problem - I want to roll a yoga mat (box geometry).
I tried many vertex deformations and still hopeless.
(I know some time ago, Yuri Artiukh(akella) made a demo with rolling a plane geometry in an archimedean spiral - though his solution didn’t work here).

A more general case would be - how to roll a deformed box along any curve..
But let’s say my problem for now would be just to roll a yoga mat.

I appreciate any advice how to get to the solution. Hope the sketches are clear enough.
Thanks!

I’m very hesitant whether to post the next, or not to post it, because it might look very tempting to you, but at the same time it is far from your approach, because:

I had fun making this demo.

https://codepen.io/boytchev/full/yyygJbz

image

13 Likes

Hi @PavelBoytchev
I think it’s a work of pure genius! :wink:

1 Like

@PavelBoytchev I am beyond speechless. Wow. Didn’t expect it :slight_smile:
So basically the yoga mat is built of multiple boxes, which are rotated along z axis.
The Math.atan2() is there to calculate the rolling angle..

Gonna brush up now my knowledge about Pythagorean spiral.

Thank you so much!

1 Like

Yes, the general formula for the angle between two boxes in rolled state is:

\alpha = k \arctan \frac{1}{\sqrt{n}}

where k defines how tight the spiral is, and n is the box. In the demo k=2.35, but you may try with k=1 to see the difference.

For large n the Pythagorean spiral approximates the Archimedean spiral and they become visually the same. I use Pythagorean, because I found it easier to calculate angles.

Also, there is no need to have multiple boxes, it could be just one box with many subdivisions along one of the edges. I used boxes to save myself from calculating a few more (co)sines and digging into position/normal attributes.

2 Likes