LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | Private Member Functions | List of all members
lsst.geom.geometry.SphericalEllipse Class Reference
Inheritance diagram for lsst.geom.geometry.SphericalEllipse:
lsst.geom.geometry.SphericalRegion

Public Member Functions

def __init__
 
def getBoundingBox
 
def getBoundingCircle
 
def getInnerCircle
 
def getCenter
 
def getMajorAxisAngle
 
def getSemiMajorAxisLength
 
def getSemiMinorAxisLength
 
def contains
 
def intersects
 
def __repr__
 
def __eq__
 

Public Attributes

 center
 
 semiMajorAxisLength
 
 semiMinorAxisLength
 
 majorAxisAngle
 
 boundingCircle
 
 innerCircle
 

Private Member Functions

def _containsPoint
 

Detailed Description

An ellipse on the unit sphere. This is a standard 2D cartesian
ellipse defined on the plane tangent to the unit sphere at the ellipse
center and then orthographically projected onto the surface of the
unit sphere.

Definition at line 931 of file geometry.py.

Constructor & Destructor Documentation

def lsst.geom.geometry.SphericalEllipse.__init__ (   self,
  center,
  semiMajorAxisLength,
  semiMinorAxisLength,
  majorAxisAngle 
)

Definition at line 938 of file geometry.py.

939  semiMajorAxisLength, semiMinorAxisLength, majorAxisAngle):
940  self.center = sphericalCoords(center)
941  self.semiMajorAxisLength = float(semiMajorAxisLength)
942  self.semiMinorAxisLength = float(semiMinorAxisLength)
943  a = math.fmod(float(majorAxisAngle), 180.0)
944  if a < 0.0:
945  a += 180.0
946  self.majorAxisAngle = a
947  self.boundingCircle = None
948  self.innerCircle = None
949  if self.semiMinorAxisLength < 0.0:
950  raise RuntimeError('Negative semi-minor axis length')
952  raise RuntimeError(
953  'Semi-major axis length is less than semi-minor axis length')
954  # large spherical ellipses don't make much sense
955  if self.semiMajorAxisLength > 10.0 * ARCSEC_PER_DEG:
956  raise RuntimeError(
957  'Semi-major axis length must be less than or equal to 10 deg')
958  self.center = (reduceTheta(self.center[0]), self.center[1])

Member Function Documentation

def lsst.geom.geometry.SphericalEllipse.__eq__ (   self,
  other 
)

Definition at line 1066 of file geometry.py.

1067  def __eq__(self, other):
1068  if isinstance(other, SphericalEllipse):
1069  return (self.center == other.center and
1070  self.semiMajorAxisLength == other.semiMajorAxisLength and
1071  self.semiMinorAxisLength == other.semiMinorAxisLength and
1072  self.majorAxisAngle == other.majorAxisAngle)
1073  return False
1074 
def lsst.geom.geometry.SphericalEllipse.__repr__ (   self)
Returns a string representation of this ellipse.

Definition at line 1057 of file geometry.py.

1058  def __repr__(self):
1059  """Returns a string representation of this ellipse.
1060  """
1061  return ''.join([
1062  self.__class__.__name__ , '(', repr(self.center), ', ',
1063  repr(self.semiMajorAxisLength), ', ',
1064  repr(self.semiMinorAxisLength), ', ',
1065  repr(self.majorAxisAngle), ')'])
def lsst.geom.geometry.SphericalEllipse._containsPoint (   self,
  v 
)
private

Definition at line 1011 of file geometry.py.

1012  def _containsPoint(self, v):
1013  theta = math.radians(self.center[0])
1014  phi = math.radians(self.center[1])
1015  ang = math.radians(self.majorAxisAngle)
1016  sinTheta = math.sin(theta)
1017  cosTheta = math.cos(theta)
1018  sinPhi = math.sin(phi)
1019  cosPhi = math.cos(phi)
1020  sinAng = math.sin(ang)
1021  cosAng = math.cos(ang)
1022  # get coords of input point in (N,E) basis
1023  n = cosPhi * v[2] - sinPhi * (sinTheta * v[1] + cosTheta * v[0])
1024  e = cosTheta * v[1] - sinTheta * v[0]
1025  # rotate by negated major axis angle
1026  x = sinAng * e + cosAng * n
1027  y = cosAng * e - sinAng * n
1028  # scale by inverse of semi-axis-lengths
1029  x /= math.radians(self.semiMajorAxisLength * DEG_PER_ARCSEC)
1030  y /= math.radians(self.semiMinorAxisLength * DEG_PER_ARCSEC)
1031  # Apply point in circle test for the unit circle centered at the origin
1032  return x * x + y * y <= 1.0
def lsst.geom.geometry.SphericalEllipse.contains (   self,
  pointOrRegion 
)
Returns True if the specified point or spherical region is
completely contained in this ellipse. The implementation is
conservative in the sense that False may be returned for a region
that really is contained by this ellipse.

Definition at line 1033 of file geometry.py.

1034  def contains(self, pointOrRegion):
1035  """Returns True if the specified point or spherical region is
1036  completely contained in this ellipse. The implementation is
1037  conservative in the sense that False may be returned for a region
1038  that really is contained by this ellipse.
1039  """
1040  if isinstance(pointOrRegion, (tuple, list)):
1041  v = cartesianUnitVector(pointOrRegion)
1042  return self._containsPoint(v)
1043  else:
1044  return self.getInnerCircle().contains(pointOrRegion)
def lsst.geom.geometry.SphericalEllipse.getBoundingBox (   self)
Returns a bounding box for this spherical ellipse. Note that at
present this is conservative: a bounding box for the circle C with
radius equal to the semi-major axis length of this ellipse is returned.

Definition at line 959 of file geometry.py.

960  def getBoundingBox(self):
961  """Returns a bounding box for this spherical ellipse. Note that at
962  present this is conservative: a bounding box for the circle C with
963  radius equal to the semi-major axis length of this ellipse is returned.
964  """
965  return self.getBoundingCircle().getBoundingBox()
def lsst.geom.geometry.SphericalEllipse.getBoundingCircle (   self)
Returns a bounding circle for this spherical ellipse. This is
a circle with the same center as this ellipse and with radius
equal to the arcsine of the semi-major axis length.

Definition at line 966 of file geometry.py.

967  def getBoundingCircle(self):
968  """Returns a bounding circle for this spherical ellipse. This is
969  a circle with the same center as this ellipse and with radius
970  equal to the arcsine of the semi-major axis length.
971  """
972  if self.boundingCircle == None:
973  r = math.degrees(math.asin(math.radians(
974  DEG_PER_ARCSEC * self.semiMajorAxisLength)))
975  self.boundingCircle = SphericalCircle(self.center, r)
976  return self.boundingCircle
def lsst.geom.geometry.SphericalEllipse.getCenter (   self)
Returns an (ra, dec) 2-tuple of floats corresponding to the center
of this ellipse.

Definition at line 987 of file geometry.py.

988  def getCenter(self):
989  """Returns an (ra, dec) 2-tuple of floats corresponding to the center
990  of this ellipse.
991  """
992  return self.center
def lsst.geom.geometry.SphericalEllipse.getInnerCircle (   self)
Returns the circle of maximum radius having the same center as
this ellipse and which is completely contained in the ellipse.

Definition at line 977 of file geometry.py.

978  def getInnerCircle(self):
979  """Returns the circle of maximum radius having the same center as
980  this ellipse and which is completely contained in the ellipse.
981  """
982  if self.innerCircle == None:
983  r = math.degrees(math.asin(math.radians(
984  DEG_PER_ARCSEC * self.semiMinorAxisLength)))
985  self.innerCircle = SphericalCircle(self.center, r)
986  return self.innerCircle
def lsst.geom.geometry.SphericalEllipse.getMajorAxisAngle (   self)
Return the major axis angle (east of north, in degrees) for this
ellipse.

Definition at line 993 of file geometry.py.

994  def getMajorAxisAngle(self):
995  """Return the major axis angle (east of north, in degrees) for this
996  ellipse.
997  """
998  return self.majorAxisAngle
def lsst.geom.geometry.SphericalEllipse.getSemiMajorAxisLength (   self)
Returns the semi-major axis length of this ellipse. Units
are in arcsec since ellipses are typically small.

Definition at line 999 of file geometry.py.

1000  def getSemiMajorAxisLength(self):
1001  """Returns the semi-major axis length of this ellipse. Units
1002  are in arcsec since ellipses are typically small.
1003  """
1004  return self.semiMajorAxisLength
def lsst.geom.geometry.SphericalEllipse.getSemiMinorAxisLength (   self)
Returns the semi-minor axis length of this ellipse. Units
are in arcsec since ellipses are typically small.

Definition at line 1005 of file geometry.py.

1006  def getSemiMinorAxisLength(self):
1007  """Returns the semi-minor axis length of this ellipse. Units
1008  are in arcsec since ellipses are typically small.
1009  """
1010  return self.semiMinorAxisLength
def lsst.geom.geometry.SphericalEllipse.intersects (   self,
  pointOrRegion 
)
Returns True if the specified point or spherical region intersects
this ellipse. The implementation is conservative in the sense that
True may be returned for a region that does not intersect this
ellipse.

Definition at line 1045 of file geometry.py.

1046  def intersects(self, pointOrRegion):
1047  """Returns True if the specified point or spherical region intersects
1048  this ellipse. The implementation is conservative in the sense that
1049  True may be returned for a region that does not intersect this
1050  ellipse.
1051  """
1052  if isinstance(pointOrRegion, (tuple, list)):
1053  v = cartesianUnitVector(pointOrRegion)
1054  return self._containsPoint(v)
1055  else:
1056  return self.getBoundingCircle().intersects(pointOrRegion)

Member Data Documentation

lsst.geom.geometry.SphericalEllipse.boundingCircle

Definition at line 946 of file geometry.py.

lsst.geom.geometry.SphericalEllipse.center

Definition at line 939 of file geometry.py.

lsst.geom.geometry.SphericalEllipse.innerCircle

Definition at line 947 of file geometry.py.

lsst.geom.geometry.SphericalEllipse.majorAxisAngle

Definition at line 945 of file geometry.py.

lsst.geom.geometry.SphericalEllipse.semiMajorAxisLength

Definition at line 940 of file geometry.py.

lsst.geom.geometry.SphericalEllipse.semiMinorAxisLength

Definition at line 941 of file geometry.py.


The documentation for this class was generated from the following file: