rotation a vertex around another vertex?

I am hoping to get into a lil more math and I was wondering how I would rotate a vertex around another vertex

i.e

o = vertex
| = line

o
|
|
|
|
o

o
-


----
-----o
o------------o

Just hoping to make a string sim that reacts to gravity and wind

ok I got the rotation for 2 axis x and y but what about z?

x1, y1 #old coords
cx, cy # center point
x2, y2 # new coords
theta # theta in radians

x2 = cx + (x1 - cx) * cos(theta)-(y1 - cy) * sin(theta)
y2 = cy + (y1 - cy) * cos(theta)-(x1 - cx) * sin(theta)

x2 = cx + (x1 - cx) * cos(theta)+(y1 - cy) * sin(theta)
y2 = cy + (y1 - cy) * cos(theta)-(x1 - cx) * sin(theta)

…?

hi,

its been a long time since i did any maths, so please ignore this if it’s complete nonsense! i don’t know if your x-y equations are right!

but if theta is defined as the rotation angle in x-y plane, then the z coordinate won’t change, right?

so i guess you would need a theta2, defining the angle of the rotation plane as well. then a new equation to get the z co-ordinate…

cheers

Use rotation matrices.

Martin