# rotation of vertices (and maybe math utils?)

hi there,
imagine i have a few vertices and i want them to transform (rotate) from [0,0,3] to [2,2,1]. how? in python…

you can’t rotate vertices. they’re just vectors.

well, maybe i expressed not very well…
there is e.g. a cube which stands on one of its own vertices. this one is [0,0,0].
exactly the opposide one lies on the z axis, let’s say [0,0,3].
now i want to grab the seconds one [0,0,3] and as i transform(rotate) it i want the remaining vertices to move accordingly or proportionaly so the all vertices together will still form the cube.
so the [0,0,0] will stay on its place

and i only know the coordinates of those old vertices and the coordinates of where i want the second one (the most upper one, [0,0,3]) to be.

a picture is worth thousand words:

``````
^ [0,0,3] -----
/ \            |
/   \           |
\   /           v [the new positions]
|\ /|
| V |
| | |
\ | /
\|/
V [0,0,0]

``````

how to calculate the coordinates of the others?
is there a simple method? can be mathutils of any help?
help.

Something like:

``````
def rotate(self, vertices, axis, angle):
rotation = RotationMatrix(angle, 4, "r", axis)
return [MatMultVec(rotation, vertex) for vertex in vertices]

``````

where axis and vertices are Mathutils vectors.