How to rotate 3D points manually

LukeNeo's picture

Hi, I need to rotate 3D points manually. On siggraph site I found this great explanation about what formula to use.. http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran... ..but I can't get the right result.

In the composition attached there are two meshes: one build with JS manually and rendered with points, the other is build with standard cube patch. JS vertices and cube vertices share the same initial positions. JS vertices are manually rotated using siggraph formula about x and y rotations, while cube is rotated using standard 3D transformations patch.

..why I can't get same results on both meshes vertices? Is there any error in the way I implemented the rotation formula?

Thank you for any hint!

PreviewAttachmentSize
rotation_test_kineme.qtz11.7 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: How to rotate 3D points manually

Here's a quick fix by way of exemplification - put that Iterator into a 3D Transform, un-publish those rotational proxy inputs, set them to zero but feed the 3D Transformation patch, wrapping the Iterator, the rotational values directly . Sorted, methinks, until the next how do I .... ? :-)

PreviewAttachmentSize
rotation_test_kineme rotationally synced.qtz12.12 KB

LukeNeo's picture
Re: How to rotate 3D points manually

Hy cybero, thank you for the reply. Your composition is a fix for the synch, but.. is not what I was searching for. :-) I do need to rotate manually JS vertices using my own Javascript (or openCL or something else), because I need to know for each vertex the final position (after I applied the rotations). Instead, using your approach my vertices remains in the same position (I'm only rotating the whole world, NOT each vertex position).

I DO NEED something that transform mesh vertices just like the standard patch "mesh transform". I started my work using that patch and retriving final vertices position from its output, but I can't use it because it is too slow: I need to mantain more than 60 FPS, while if I use mesh transform patch I obtain 25 FPS when I rotate the mesh.

cybero's picture
Re: How to rotate 3D points manually

right that has helped to clarify what's being sought for me, pardon my misunderstanding.

gtoledo3's picture
Re: How to rotate 3D points manually

(dbl post)

gtoledo3's picture
Re: How to rotate 3D points manually

Noise Industries makes a patch that rotates vectors too, called NI Rotate Points.

cybero's picture
Re: How to rotate 3D points manually

That looks like a great match :-), but I'm not getting the points on the corners, am I not supposed to ?

LukeNeo's picture
Re: How to rotate 3D points manually

gtoledo3 wrote:
Noise Industries makes a patch that rotates vectors too, called NI Rotate Points.

Is it free downloadable? I can't find it on NI site.

I tried (see the attachment) to add another way to transform my vertices: using the OpenCL-based affine transform macro by dust (http://kineme.net/composition/dust/affinemeshtransformmacro), but the final position of the vertices are still different from my Javascript and from 3D Transformation patch.. maybe I used that macro-patch in the wrong way?

PreviewAttachmentSize
rotation_test_kineme_with_affine_patch.qtz48.29 KB

gtoledo3's picture
Re: How to rotate 3D points manually

It's a patch that gets included when you download their plugin... it's not a distinct plugin.

You might want to look at the fastaffinetransform qtz in the quartzcomposer framework for a neat example on just the transform stuff.

LukeNeo's picture
Re: How to rotate 3D points manually

LukeNeo wrote:
maybe I used that macro-patch in the wrong way?

Ok, I finally got it!

The affine transformation patch by dust works great: the reason because the cube wasn't rotated in the correct way is that 3D transform patch rotates vertices FIRST on the Y axis and THEN on the X axis. So If inside the affine transformation patch we modify vertices FIRST usign affineTransformVerticesRotation(Y) and then affineTransformVerticesRotation(X).. it works in the same way of 3D transformation patch! :)

Thank you!