IntersectSpheres

Calculates the intersection of two spheres.   

Syntax

rhinoscript.surface.IntersectSpheres (sphere_plane0, sphere_radius0, sphere_plane1, sphere_radius1)

rhinoscriptsyntax.IntersectSpheres (sphere_plane0, sphere_radius0, sphere_plane1, sphere_radius1)

Parameters

sphere_plane0

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

sphere_radius0

Required.  Number.  The radius of the first sphere.

sphere_plane1

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

sphere_radius1

Required.  Number.  The radius of the second sphere.

Returns

List

A list 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

Point3d or Plane

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.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

plane0 = rs.WorldXYPlane()

plane1 = rs.MovePlane(plane0, (10,0,0))

radius = 10

results = rs.IntersectSpheres(plane0, radius, plane1, radius)

if results:

    if results[0] == 0: rs.AddPoint(results[1])

    else: rs.AddCircle( results[1], results[2])

Also See

IntersectBreps

IntersectPlanes