Notifications
Clear all

[Closed] caculate the meeting points

how to caculate the meeting points of two lines

1 Reply

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.