Notifications
Clear all
[Closed] Define plane from normal vector
Feb 17, 2009 10:38 pm
I have a normal vector and a point, and I need to define a plane (three points) based on these.
Can anyone help, I’ve read the maths and the geometric calculations thread but I’m not quite getting it…
3 Replies
Feb 17, 2009 10:38 pm
Have you looked at the “How do I align the UVW_Modifier’s Gizmo to a selected face?” example in the Maxscript Help?
-Eric
Feb 17, 2009 10:38 pm
Hi Rorschach,
if you need 3 generic points on the plane defined by position and normal vector, you can use the matrixFromNormal MaxScript function. The three point you’ll get will be the first input position, and two points on plane defining an angle of 90 degrees distant 1 unit from the plane origin.
function planeFromNormal p3PlanePos p3PlaneNorm =
(
if ((classOf p3PlanePos) == Point3) and ((classOf p3PlaneNorm) == Point3) then
(
local m3Temp = matrixFromNormal (normalize(p3PlaneNorm))
-- points for visual test
point size:3 position:(p3PlanePos) wireColor:red
point size:3 position:(p3PlanePos + m3Temp.row1) wireColor:green
point size:3 position:(p3PlanePos + m3Temp.row2) wireColor:green
point size:3 position:(p3PlanePos + p3PlaneNorm) wireColor:blue
return #(p3PlanePos, (p3PlanePos + m3Temp.row1), (p3PlanePos + m3Temp.row2))
)
else
(
throw "Wrong input in function planeFromNormal()"
)
)
- Enrico
1 Reply