I'm having issues determining the normal vector of a plane in a specfic point on it. Let's say I have the 3 points of a plane, and the point inside the plane where I need the vector. I need to know how to do this on python without the use of any modules, pure python. Thanks!!
normal vector?
Collapse
X
-
Tags: None
-
You will need a point/vector object class which can easily be written in Python. Having 3 points, p1, p2 and p3, the normal vector Nv of a plane is the cross product of the vectors p1->p2 and p1->p3. The unit vector would be:
Code:m = magnitude(Nv) Point(Nv.x/m, Nv.y/m, Nv.z/m)
The cross product of 2 vectors (p1 and p2):Code:def cross_product(p1, p2): '''Return the cross product of two Point object vectors. The cross product of two vectors is a vector perpendicular to the two vectors. For example, in an orthonormal basis, the cross product of a vector along the X axis and a vector along the Y axis returns a vector along the Z axis.''' return Point(p1.y*p2.z - p1.z*p2.y, p1.z*p2.x - p1.x*p2.z, p1.x*p2.y - p1.y*p2.x)
-
i know the 4th point lies on the plane because the plane is intersected by a line,that 4th point is the intersection of the line and the plane, thanks for the answer, i'm actually trying that right nowComment
Comment