IntersectSpheres

Calculates the intersection of two spheres.   

Syntax

Rhino.IntersectSpheres (arrSpherePlane0, dblSphereRadius0, arrSpherePlane1, dblSphereRadius1)

Parameters

arrSpherePlane0

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

dblSphereRadius0

Required.  Number.  The radius of the first sphere.

arrSpherePlane1

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

dblSphereRadius1

Required.  Number.  The radius of the second sphere.

Returns

Array

An array of intersection results, if successful. The results are as follows:

Element

Type

Description

0

Number

The type of intersection, where 0 = point, 1 = circle, 2 = spheres are identical.

1

Array

If a point intersection, then an array identifying the 3-D intersection location.

If a circle intersection, then the circle's plane. The origin of the plane will be the center point of the circle.

2 (circle intersection only)

Number

If a circle intersection, then the radius of the circle.

Null

If not successful, or on error.

Example

Dim arrLine, arrPlane, dblHeight, dblRadius

Dim arrResults, i

arrPlane0 = Rhino.WorldXYPlane

arrPlane1 = Rhino.MovePlane(arrPlane0, Array(10,0,0))

dblRadius = 10

arrResults = Rhino.IntersectSpheres(arrPlane0, dblRadius, arrPlane1, dblRadius)

If IsArray(arrResults) Then

  If arrResults(0) = 0 Then

    Rhino.AddPoint arrResults(1)

  Else

    Rhino.AddCircle arrResults(1), arrResults(2)

  End If

End If

Also See

IntersectBreps

IntersectPlanes