LineSphereIntersection

Calculates the intersection of a line and a sphere.   

Syntax

Rhino.LineSphereIntersection (arrLine, arrSpherePlane, dblSphereRadius)

Parameters

arrLine

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

arrSpherePlane

Required.  Array.  An equatorial plane of the sphere.  The origin of the plane will be the center point of the sphere.

dblSphereRadius

Required.  Number.  The radius of the sphere.

Returns

Array

An array of intersection points, either one or two, if successful.

Null

If not successful, or on error.

Example

Dim arrLine, arrPlane, dblHeight, dblRadius

Dim arrPoints, i

arrPlane = Rhino.WorldXYPlane

dblRadius = 10

arrLine = Array(Array(-10,0,0), Array(10,0,10))

arrPoints = Rhino.LineSphereIntersection(arrLine, arrPlane, dblRadius)

If IsArray(arrPoints) Then

  For i = 0 To UBound(arrPoints)

    Rhino.AddPoint arrPoints(i)

  Next

End If

Also See

LineArcIntersection

LineBoxIntersection

LineCircleIntersection

LineCylinderIntersection

LineLineIntersection

LinePlaneIntersection