-
Notifications
You must be signed in to change notification settings - Fork 26
Point
Alessandro Febretti edited this page Aug 28, 2013
·
0 revisions
> module omega Two versions of the Point class exist. Point2 represents 2D points, and Point3 represents 3D points. Both have the same interface
Construct in the obvious way:
>>> p = Point3(1.0, 2.0, 3.0) >>> p Point3(1.00, 2.00, 3.00)
Point subclasses Vector, so all of Vector operators and methods apply. In particular, subtracting two points gives a vector:
>>> Point2(1.0, 2.0) - Point2(1.0, 0.0) Vector2(0.00, 2.00)
The following methods are also defined:
intersect(other)
- For a 3D point, If other is a Sphere, returns
True
if the point lies within the sphere. For a 2D point, other must be a Circle connect(other)
- Returns a LineSegment which is the minimum length line segment that can connect the two shapes. other may be a Point, Line, Ray, LineSegment, Sphere or Plane.
distance(other)
- Returns the absolute minimum distance to other. Internally this
simply returns the length of the result of
connect
.