ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
Submitted by Aleksey Kidisyuk on Sat, 2016-10-01 07:34
Hello
Who can help -
I have three vertexes. How can find perpendicular from one vertex to line of two other?
If I have for vertexes. How find perpendicular from vertex to plane of three other vertexes?
(
p01 = point pos:[0,0,0]
p02 = point pos:[100,100,100]
p03 = point pos:[50,70,90]
function PointLineProjection pA pB pC =
(
local vAB = pB - pA
local vAC = pC - pA
local d = dot (normalize vAB)(normalize vAC)(pA + ( vAB *( d *( length vAC / length vAB)))))
pos = PointLineProjection p01.pos p02.pos p03.pos
point pos:pos
)
(
p01 = point pos:[0,0,0]
p02 = point pos:[100,0,0]
p03 = point pos:[0,100,0]
p04 = point pos:[50,70,90]
fn pointPlaneProj pA pB pC pD =
(/*******************************************************************************
<DOC> Find the projection of a point onto a plane.
Arguments:
<point3> pA: Point on the plane.
<point3> pB: Point on the plane.
<point3> pC: Point on the plane.
<point3> pD: Point to project on the plane.
Return:
<point3> Projected point.
*******************************************************************************/
local nABC = normalize (cross (pB - pA)(pC - pA))
pD + ((dot (pA - pD) nABC)* nABC))
pos = pointPlaneProj p01.pos p02.pos p03.pos p04.pos
point pos:pos
)
Comments
.
Do not miss this: http://forums.cgsociety.org/showthread.php?f=98&t=295257
Tools and Scripts for Autodesk 3dsMax
Thank You
Thank You!
Perfect