Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/geometry_util.html
Дата изменения: Fri Apr 8 12:46:14 2016
Дата индексирования: Mon Apr 11 02:46:32 2016
Кодировка:

Поисковые слова: mercury program
Python: module geometry_util
 
 
geometry_util
index
geometry_util.py

PURPOSE --
A module for dealing with points, lines, segments, etc.
 
DEVELOPER --
Don Chance
 
MODIFICATION HISTORY --
Initial implementation 8/22/00

 
Classes
       
convex_polygon
point
segment

 
class convex_polygon
    A class for convex polygons.
 
  Methods defined here:
__init__(self, vertices)
The constructor requires a list of point objects.
__repr__(self)
contained_by_polygon(self, other)
Tests to see if polygon 'self' is completely inside polygon 'other'.  Returns
1 if this is the case, 0 otherwise.
contains_point(self, a_point)
Tests to see if the input point object is inside the polygon.  Returns 1 if
this is the case, 0 otherwise.
contains_polygon(self, other)
Tests to see if polygon 'other' is completely inside polygon 'self'.  Returns
1 if this is the case, 0 otherwise.
equals(self, other)
Returns 1 if self and other contain exactly the same vertices in the
same order.

 
class point
    A 2 dimensional cartesian coordinate point class
 
  Methods defined here:
__init__(self, tup, y=None)
Requires a tuple of two point objects.
__repr__(self)
equals(self, other)
Returns 1 if self and other are the same point.  Otherwise
returns 0.

 
class segment
    A class for line segments.
 
  Methods defined here:
__init__(self, point1, point2)
To construct a segment two point objects are required.
__repr__(self)
equals(self, other)
Return 1 if self and other are exactly the same.
intersect(self, other)
Returns 1 if the two segments intersect, 0 otherwise.
is_in_range(self, a_point)
Check that the given point is between the two x coordinates
and the two y coordinates.  Returns 1 if this is the case, 0 otherwise.

 
Data
        DEBUG = 0
POINT_AT_INFINITY = (0.000000, 2000.000000)