View Full Version : Define plane from normal vector
Rorschach 02172009, 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.....


PiXeL_MoNKeY
02172009, 11:34 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
SyncViewS
02172009, 11:50 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
Rorschach
02182009, 12:00 AM
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
perfect... just what I was looking for, and I was sooo close ;)
CGTalk Moderation
02182009, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002014, Jelsoft Enterprises Ltd.