LineCurveIntersection

Intersect an infinite line and a curve object.

Syntax

Rhino.LineCurveIntersection (arrLine, strCurve [, dblTolerance])

Parameters

arrLine

Required.  Array.  Two 3-D points identifying the starting and ending points of the line.

strCurve

Required.  String.  The identifier of the curve object.

dblTolerance

Optional.  Number.  The intersection tolerance. If omitted, the document's absolute tolerance is used.

Returns

Array

A two-dimensional array of intersection information if successful.  The array will contain one or more of the following elements:

Element

Type

Description

(n, 0)

Number

The intersection event type, either Point (1) or Overlap (2).

(n, 1)

 

Array (3-D Point)

If the event type is Point (1), then the intersection point on the line.

If the event type is Overlap (2), then intersection start point on the line.

(n, 2)

 

Array (3-D Point)

If the event type is Point (1), then the intersection point on the line.

If the event type is Overlap (2), then intersection end point on the line.

(n, 3)

 

Array (3-D Point)

If the event type is Point (1), then the intersection point on the curve.

If the event type is Overlap (2), then intersection start point on the curve.

(n, 4)

 

Array (3-D Point)

If the event type is Point (1), then the intersection point on the curve.

If the event type is Overlap (2), then intersection end point on the curve.

(n, 5)

 

Number

If the event type is Point (1), then the line parameter.

If the event type is Overlap (2), then the start value of the line parameter range.

(n, 6)

 

Number

If the event type is Point (1), then the line parameter.

If the event type is Overlap (2),  then the end value of the line parameter range.

(n, 7)

 

Number

If the event type is Point (1), then the curve parameter.

If the event type is Overlap (2), then the start value of the curve parameter range.

(n, 8)

 

Number

If the event type is Point (1), then the curve parameter.

If the event type is Overlap (2), then the end value of the curve parameter range.

Null

If not successful, or on error.

Example

Sub TestLineCurveIntersection

  Dim strCurve, arrStart, arrEnd, arrX, i

  strCurve = Rhino.GetObject("Select curve", 4)

  If IsNull(strCurve) Then Exit Sub

  arrStart = Rhino.GetPoint("Start of line")

  If IsNull(arrStart) Then Exit Sub

  arrEnd = Rhino.GetPoint("End of line", arrStart)

  If IsNull(arrEnd) Then Exit Sub

  arrX = Rhino.LineCurveIntersection(Array(arrStart, arrEnd), strCurve)

  If IsArray(arrX) Then

    For i = 0 To UBound(arrX)

      Rhino.AddPoint arrX(i,1)

    Next

  End If

End Sub

Also See

LineArcIntersection

LineBoxIntersection

LineCircleIntersection

LineCylinderIntersection

LineLineIntersection

LinePlaneIntersection

LineSphereIntersection