please, can someone help me?
imagine i have a few vertices and i want them to transform (rotate) from [0,0,3] to [2,2,1]. how? in python…
thank you in advance!
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?
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.
thank you for your answer. unfortunately (hope you dont kill me):
is the “axis” normal vector perpendicular to eg [0,0,3] and [new,new,new] and the angle a dot product of those?
if so, is it ok that i dont know if the angle is positive or negative? (because dot product is cos angle)
or is there another way?