help with vectorMath

Where can I find documentation on the VectorMath addon? I can’t seem to find it anywhere :frowning:

to be more specific, I need to rotate many objects(pictures) towards a given point and then make them move toward that point as well.

look at the sourcecode of the vector math example: it does exactly what you need

I added the vectorMath addon, but I have really no idea how to implement its rotate function in my ofImages since it is not of the ofxVec2f class. Any help?

ok, ofImage by default draw themselves staright; in order to rotate them you need:

  • an angle (which I suppose you’re calculating with vectors)
  • a pivot point (probably the corner or the center of the pic)
  • some code to actually make the rotation

you probably already have the first 2 things; for the last one you can use ofRotate() (probably together with ofPushMatrix()/ofPopMatrix()) or its pure openGL counterpart glRotatef() (with glPushMatrix()/glPopMatrix()).

you could also draw a rectangle using your ofxVex2f points as vertexes and then use your image as a texture, but the other method is probably easier.

I got the rotation figured out(without the vectorMath addon), but I still need to make the images move towards the point they are rotated at. I’m thinking that they should rotate THEN move down/up their local y-axis. Does it make sense?

glTranslatef() is your friend both for defining the rotation center and for moving your images around

I got it working! Thanks for the help!