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?
Thank You
Forum topic · General Scripting
By Aleksey Kidisyuk · 2016-10-01
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?
Thank You
.
miauu · 2016-10-02
Do not miss this: http://forums.cgsociety.org/showthread.php?f=98&t=295257
(
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
)
Aleksey Kidisyuk · 2016-10-03
Thank You!
Perfect