Hello Tech Artists community. This is my 1st post here. I’ve found so many helpful posts on this site and want to thank this community for your help.
I have a Python / Maya / Vector question for the guys who know their linear algebra / matrices math out there.
When considering a 3d plane, all you need to define is a point on the plane and the normal. In Python, I have a simple class that defines a plane in 3d space.
class Vector(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
class Plane(object):
def __init__(self, point, normal):
self.point = point
self.normal = normal
def createMesh(self):
pass
p1 = Plane(Vector(0,0,0), Vector(0,1,0))
p2 = Plane(Vector(0,0,0), Vector(0.447, 0.894, 0))
When creating a poly plane in Maya, it’s starting position is (0,0,0) and it’s normal is (0,1,0), so in this instance, p1 represents the starting position of a polygon plane.
Now, lets say I want to create a poly plane for p2. I could create a plane for p1, but now I need to figure out the rotation values so that p1 rotates to p2. I want to write this into the createMesh def so I can create a polygon plane and move it to the position of the point and rotate it so it’s normal matches. I know I could break this into x, y, and z angles between and figure out the Pythagorean theorem, then use trig to figure out the angles per axis, but that is a lot of code, and I’m sure there’s a simpler way to do this with linear algebra.
I know this would probably be easiest to figure out with a matrix, however I’m one of those guys who is still trying to wrap his head around linear transformations with matrices. If you’re so inclined, I would LOVE an explanation of how to go about this with matrices.
Thanks guys!
tylerART