Skip to content
Alessandro Febretti edited this page Aug 28, 2013 · 3 revisions

[[module omega | Python-Reference#module-omega]]

Spheres are constructed with a center Point3 and a radius:

   >>> s = Sphere(Point3(1.0, 1.0, 1.0), 0.5)
   >>> s
   Sphere(<1.00, 1.00, 1.00>, radius=0.50)

Internally there are two attributes: c, giving the center point and r, giving the radius.

The following methods are supported:

intersect(other)

If other is a Point3, returns True if the point lies within the sphere. If other is a Line3, Ray3 or LineSegment3, returns a LineSegment3 giving the intersection, or None if the line does not intersect the sphere.

connect(other)

Returns a LineSegment3 which is the minimum length line segment that can connect the two shapes. other may be a Point3, Line3, Ray3, LineSegment3, Sphere or Plane.

distance(other)

Returns the absolute minimum distance to other. Internally this simply returns the length of the result of connect.

Clone this wiki locally