PDA

View Full Version : caculate the meeting points


flyingaway
07-17-2009, 10:21 AM
how to caculate the meeting points of two lines

Kameleon
07-17-2009, 11:30 AM
Hey,
First, check : http://forums.cgsociety.org/showthread.php?f=98&t=295257
Second,

(
fn lineLineIntersect pA pB pC pD = (
local a=pB-pA
local b=pD-pC
local c=pC-pA
local cross1 = cross a b
local cross2 = cross c b
pA + ( a*( (dot cross2 cross1)/((length cross1)^2) ) )
)

l1=$Line01
l2=$Line02

l1_p1=getknotpoint l1 1 1
l1_p2=getknotpoint l1 1 2

l2_p1=getknotpoint l2 1 1
l2_p2=getknotpoint l2 1 2

inter=lineLineIntersect l1_p1 l1_p2 l2_p1 l2_p2
point pos:inter
)

Thanks go for prettyPixel for writing the function line to line intersection. Cheers.

CGTalk Moderation
07-17-2009, 11:30 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.