A convex polygon on the unit sphere with great circle edges. Points
falling exactly on polygon edges are considered to be inside (contained
by) the polygon.
Definition at line 1075 of file geometry.py.
def lsst.geom.geometry.SphericalConvexPolygon.__init__ |
( |
|
self, |
|
|
|
args |
|
) |
| |
Creates a new polygon. Arguments must be either:
1. a SphericalConvexPolygon
2. a list of vertices
3. a list of vertices and a list of corresponding edges
In the first case, a copy is constructed. In the second case,
the argument must be a sequence of 3 element tuples/lists
(unit cartesian 3-vectors) - a copy of the vertices is stored
and polygon edges are computed. In the last case, copies of the
input vertex and edge lists are stored.
Vertices must be hemispherical and in counter-clockwise order when
viewed from outside the unit sphere in a right handed coordinate
system. They must also form a convex polygon.
When edges are specified, the i-th edge must correspond to the plane
equation of great circle connecting vertices (i - 1, i), that is,
the edge should be a unit cartesian 3-vector parallel to v[i-1] ^ v[i]
(where ^ denotes the vector cross product).
Note that these conditions are NOT verified for performance reasons.
Operations on SphericalConvexPolygon objects constructed with inputs
not satisfying these conditions are undefined. Use the convex()
function to check for convexity and ordering of the vertices. Or,
use the convexHull() function to create a SphericalConvexPolygon
from an arbitrary list of hemispherical input vertices.
Definition at line 1080 of file geometry.py.
1082 """Creates a new polygon. Arguments must be either:
1084 1. a SphericalConvexPolygon
1085 2. a list of vertices
1086 3. a list of vertices and a list of corresponding edges
1088 In the first case, a copy is constructed. In the second case,
1089 the argument must be a sequence of 3 element tuples/lists
1090 (unit cartesian 3-vectors) - a copy of the vertices is stored
1091 and polygon edges are computed. In the last case, copies of the
1092 input vertex and edge lists are stored.
1094 Vertices must be hemispherical and in counter-clockwise order when
1095 viewed from outside the unit sphere in a right handed coordinate
1096 system. They must also form a convex polygon.
1098 When edges are specified, the i-th edge must correspond to the plane
1099 equation of great circle connecting vertices (i - 1, i), that is,
1100 the edge should be a unit cartesian 3-vector parallel to v[i-1] ^ v[i]
1101 (where ^ denotes the vector cross product).
1103 Note that these conditions are NOT verified for performance reasons.
1104 Operations on SphericalConvexPolygon objects constructed with inputs
1105 not satisfying these conditions are undefined. Use the convex()
1106 function to check for convexity and ordering of the vertices. Or,
1107 use the convexHull() function to create a SphericalConvexPolygon
1108 from an arbitrary list of hemispherical input vertices.
1113 raise RuntimeError(
'Expecting at least one argument')
1114 elif len(args) == 1:
1115 if isinstance(args[0], SphericalConvexPolygon):
1117 self.
edges = list(args[0].edges)
1121 elif len(args) == 2:
1123 self.
edges = list(args[1])
1126 'number of edges does not match number of vertices')
1132 'spherical polygon must contain at least 3 vertices')