LineSphereIntersection

Calculates the intersection of a line and a sphere.   

Syntax

rhinoscriptsyntax.LineSphereIntersection (line, sphere_center, sphere_radius)

rhinoscript.line.LineSphereIntersection (line, sphere_center, sphere_radius)

Parameters

line

Required.  Line.

sphere_center

Required.  Point3d.  The center point of the sphere.

sphere_radius

Required.  Number.  The radius of the sphere.

Returns

List

A list of intersection points, either one or two, if successful.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

radius = 10

line = (-10,0,0), (10,0,10)

points = rs.LineSphereIntersection(line, (0,0,0), radius)

if points:

    for point in points: rs.AddPoint(point)

Also See

LineCylinderIntersection

LineLineIntersection

LinePlaneIntersection