Position vertices easier

I have some vertices that forms a figure (Could be a box) I want to be able to set a position (ofVec3) that all the vertices then is moving to relative to a pivot point. As it is right now I made a pivot point that all the vertices is referensing to. I then set the position of the pivot point and the vertices will move relative to that. But is that the right way to do it?

This way I need to keep track of all the points in my figure more or less manual.

The reason I don’t use ofTranslate is that I need to know where my vertices is in relation to all other vertices in the program because I use this form to calculate if vertices in a particle system is inside og outside the figure.

Maybe there is something in this 3D world I just don’t get?

the easiest way to do this is to use ofNode, or even easier use it through of3dPrimitive. just put your vertices in the primitive. then move it, rotate… using the methods it inherits from ofNode, like:

primitive.move(50,0,0);
primitive.rotate(90, 0, 0, 1);
....

that will draw the transformed vertices without having to alter the geometry. if later you need the transformed position of a particular vertex you can do:

primitive.getMesh().getVertex(i) * primitive.getGlobalTransformationMatrix();
1 Like