jit.gl.multiple quad orientation

Dg's icon

Hi,
How to get the multiple quad being oriented not to the viewer but following the given shape.
Here the global given shape is generated w/ the classic nurbs, little bump effect
Is this at least possible w/ jitter?

Max Patch
Copy patch and select New From Clipboard in Max.

Federico-AmazingMaxStuff's icon

Hi Kired, what do you mean oriented following the given shape? The matrix is an array of vertices, there's no information about rotation. Toward what you would like to rotate them?

Dg's icon

Of course you can rotate the quads, have a look
Here the quads are shaped around a sphere
The question is would it be possible to orient the quads flat around the sphere

Max Patch
Copy patch and select New From Clipboard in Max.

Federico-AmazingMaxStuff's icon

Is this what you mean?

Max Patch
Copy patch and select New From Clipboard in Max.

Dg's icon

Yes great, many thx :))
lack of maths ... where can I find some theory?

Federico-AmazingMaxStuff's icon

You can arrive to that with a bit of trigonometry.
Basically you get the x and y from the equation of a sphere, then calculate the z rotation using the atan2 function that gives you the angle between a point in 2D and the x axis.
For the y roation I went a bit with trial and error.
I'm sure if you google "quad orientation sphere" or "plane tangent sphere" something will come out.
Cheers!

Dg's icon

Great! thank you :)
It would be nice to have a feature in Max allowing to orient the quads to the volume for all situation, for example:

Max Patch
Copy patch and select New From Clipboard in Max.


Rob Ramirez's icon

you can use the normals from the nurbs matrixouput as a direction vector. if you'd prefer not to calculate the math yourself, you can let jit.anim.node to it for you. simply iterate the normal matrix values, setting the @direction attribute of a non-automatic jit.anim.node, update the anim.node, query it's rotate values, and plug those into a matrix for jit.gl.multiple:

Max Patch
Copy patch and select New From Clipboard in Max.

Federico-AmazingMaxStuff's icon
Dg's icon

oooooww! this is nice, thx.