inters

AutoCad AutoLISP Functions

 
inters
 
 
 

Finds the intersection of two lines

(inters pt1 pt2 pt3 pt4 [onseg]) 

All points are expressed in terms of the current UCS. If all four point arguments are 3D, inters checks for 3D intersection. If any of the points are 2D, inters projects the lines onto the current construction plane and checks only for 2D intersection.

Arguments

pt1

One endpoint of the first line.

pt2

The other endpoint of the first line.

pt3

One endpoint of the second line.

pt4

The other endpoint of the second line.

onseg

If specified as nil, the lines defined by the four pt arguments are considered infinite in length. If the onseg argument is omitted or is not nil, the intersection point must lie on both lines or inters returns nil.

Return Values

If the onseg argument is present and is nil, inters returns the point where the lines intersect, even if that point is off the end of one or both of the lines. If the onseg argument is omitted or is not nil, the intersection point must lie on both lines or inters returns nil. The inters function returns nil if the two lines do not intersect.

Examples

(setq a '(1.0 1.0) b '(9.0 9.0)) 
(setq c '(4.0 1.0) d '(4.0 2.0))

Command: (inters a b c d)

nil

Command: (inters a b c d T)

nil

Command: (inters a b c d nil)

(4.0 4.0)