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 | List of all members
lsst.geom.geometry.SphericalCircle Class Reference
Inheritance diagram for lsst.geom.geometry.SphericalCircle:
lsst.geom.geometry.SphericalRegion

Public Member Functions

def __init__
 
def getBoundingBox
 
def getBoundingCircle
 
def getCenter
 
def getRadius
 
def isEmpty
 
def isFull
 
def contains
 
def intersects
 
def __repr__
 
def __eq__
 

Public Attributes

 center
 
 radius
 
 boundingBox
 

Detailed Description

A circle on the unit sphere. Points falling exactly on the
circle are considered to be inside (contained by) the circle.

Definition at line 766 of file geometry.py.

Constructor & Destructor Documentation

def lsst.geom.geometry.SphericalCircle.__init__ (   self,
  center,
  radius 
)
Creates a new spherical circle with the given center and radius.

Definition at line 770 of file geometry.py.

771  def __init__(self, center, radius):
772  """Creates a new spherical circle with the given center and radius.
773  """
774  self.center = sphericalCoords(center)
775  self.radius = float(radius)
776  self.boundingBox = None
777  if self.radius < 0.0 or self.radius > 180.0:
778  raise RuntimeError(
779  'Circle radius is negative or greater than 180 deg')
780  self.center = (reduceTheta(self.center[0]), self.center[1])

Member Function Documentation

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

Definition at line 919 of file geometry.py.

920  def __eq__(self, other):
921  if isinstance(other, SphericalCircle):
922  if self.isEmpty() and other.isEmpty():
923  return True
924  if self.radius == other.radius:
925  if self.center[1] == other.center[1]:
926  if abs(self.center[1]) == 90.0:
927  return True
928  return self.center[0] == other.center[0]
929  return False
930 
def lsst.geom.geometry.SphericalCircle.__repr__ (   self)
Returns a string representation of this circle.

Definition at line 913 of file geometry.py.

914  def __repr__(self):
915  """Returns a string representation of this circle.
916  """
917  return ''.join([self.__class__.__name__ , '(', repr(self.center),
918  ', ', repr(self.radius), ')'])
def lsst.geom.geometry.SphericalCircle.contains (   self,
  pointOrRegion 
)
Returns True if the specified point or spherical region is
completely contained in this circle. Note that the implementation
is conservative where ellipses are concerned: False may be returned
for an ellipse that is actually completely contained in this circle.

Definition at line 829 of file geometry.py.

830  def contains(self, pointOrRegion):
831  """Returns True if the specified point or spherical region is
832  completely contained in this circle. Note that the implementation
833  is conservative where ellipses are concerned: False may be returned
834  for an ellipse that is actually completely contained in this circle.
835  """
836  if self.isEmpty():
837  return False
838  pr = pointOrRegion
839  c = self.center
840  r = self.radius
841  if isinstance(pr, SphericalBox):
842  if pr.isEmpty():
843  return False
844  minp = pr.getMin()
845  maxp = pr.getMax()
846  if (sphericalAngularSep(c, minp) > r or
847  sphericalAngularSep(c, maxp) > r or
848  sphericalAngularSep(c, (minp[0], maxp[1])) > r or
849  sphericalAngularSep(c, (maxp[0], minp[1])) > r):
850  return False
851  a = alpha(r, c[1], minp[1])
852  if a != None:
853  if (pr.containsPoint((c[0] + a, minp[1])) or
854  pr.containsPoint((c[0] - a, minp[1]))):
855  return False
856  a = alpha(r, c[1], maxp[1])
857  if a != None:
858  if (pr.containsPoint((c[0] + a, maxp[1])) or
859  pr.containsPoint((c[0] - a, maxp[1]))):
860  return False
861  return True
862  elif isinstance(pr, SphericalCircle):
863  if pr.isEmpty():
864  return False
865  return sphericalAngularSep(c, pr.center) <= r - pr.radius
866  elif isinstance(pr, SphericalEllipse):
867  bc = pr.getBoundingCircle()
868  return sphericalAngularSep(c, bc.center) <= r - bc.radius
869  elif isinstance(pr, SphericalConvexPolygon):
870  p = cartesianUnitVector(c)
871  for v in pr.getVertices():
872  if cartesianAngularSep(p, v) > r:
873  return False
874  return True
875  else:
876  return sphericalAngularSep(c, sphericalCoords(pr)) <= r
def lsst.geom.geometry.SphericalCircle.getBoundingBox (   self)
Returns a bounding box for this spherical circle.

Definition at line 781 of file geometry.py.

782  def getBoundingBox(self):
783  """Returns a bounding box for this spherical circle.
784  """
785  if self.boundingBox == None:
786  if self.isEmpty():
787  self.boundingBox = SphericalBox()
788  elif self.isFull():
789  self.boundingBox = SphericalBox()
790  self.boundingBox.setFull()
791  else:
792  alpha = maxAlpha(self.radius, self.center[1])
793  minPhi = clampPhi(self.center[1] - self.radius)
794  maxPhi = clampPhi(self.center[1] + self.radius)
795  if alpha > 180.0 - ANGLE_EPSILON:
796  minTheta = 0.0
797  maxTheta = 360.0
798  else:
799  minTheta = self.center[0] - alpha
800  maxTheta = self.center[0] + alpha
801  self.boundingBox = SphericalBox((minTheta, minPhi),
802  (maxTheta, maxPhi))
803  return self.boundingBox
def lsst.geom.geometry.SphericalCircle.getBoundingCircle (   self)

Definition at line 804 of file geometry.py.

805  def getBoundingCircle(self):
806  return self
def lsst.geom.geometry.SphericalCircle.getCenter (   self)
Returns an (ra, dec) 2-tuple of floats corresponding to the
center of this circle.

Definition at line 807 of file geometry.py.

808  def getCenter(self):
809  """Returns an (ra, dec) 2-tuple of floats corresponding to the
810  center of this circle.
811  """
812  return self.center
def lsst.geom.geometry.SphericalCircle.getRadius (   self)
Returns the radius (degrees) of this circle.

Definition at line 813 of file geometry.py.

814  def getRadius(self):
815  """Returns the radius (degrees) of this circle.
816  """
817  return self.radius
def lsst.geom.geometry.SphericalCircle.intersects (   self,
  pointOrRegion 
)
Returns True if the given point or spherical region intersects
this circle. Note that the implementation is conservative where
ellipses are concerned: True may be returned for an ellipse that
is actually disjoint from this circle.

Definition at line 877 of file geometry.py.

878  def intersects(self, pointOrRegion):
879  """Returns True if the given point or spherical region intersects
880  this circle. Note that the implementation is conservative where
881  ellipses are concerned: True may be returned for an ellipse that
882  is actually disjoint from this circle.
883  """
884  if self.isEmpty():
885  return False
886  pr = pointOrRegion
887  c = self.center
888  r = self.radius
889  if isinstance(pr, SphericalBox):
890  if pr.isEmpty():
891  return False
892  elif pr.containsPoint(c):
893  return True
894  minp = pr.getMin()
895  maxp = pr.getMax()
896  if (minPhiEdgeSep(c, minp[1], minp[0], maxp[0]) <= r or
897  minPhiEdgeSep(c, maxp[1], minp[0], maxp[0]) <= r):
898  return True
899  p = cartesianUnitVector(c)
900  return (minThetaEdgeSep(p, minp[0], minp[1], maxp[1]) <= r or
901  minThetaEdgeSep(p, maxp[0], minp[1], maxp[1]) <= r)
902  elif isinstance(pr, SphericalCircle):
903  if pr.isEmpty():
904  return False
905  return sphericalAngularSep(c, pr.center) <= r + pr.radius
906  elif isinstance(pr, SphericalEllipse):
907  bc = pr.getBoundingCircle()
908  return sphericalAngularSep(c, bc.center) <= r + bc.radius
909  elif isinstance(pr, SphericalConvexPolygon):
910  return pr.intersects(self)
911  else:
912  return sphericalAngularSep(c, sphericalCoords(pr)) <= r
def lsst.geom.geometry.SphericalCircle.isEmpty (   self)
Returns True if this circle contains no points.

Definition at line 818 of file geometry.py.

819  def isEmpty(self):
820  """Returns True if this circle contains no points.
821  """
822  return self.radius < 0.0
def lsst.geom.geometry.SphericalCircle.isFull (   self)
Returns True if this spherical box contains every point
on the unit sphere.

Definition at line 823 of file geometry.py.

824  def isFull(self):
825  """Returns True if this spherical box contains every point
826  on the unit sphere.
827  """
828  return self.radius >= 180.0

Member Data Documentation

lsst.geom.geometry.SphericalCircle.boundingBox

Definition at line 775 of file geometry.py.

lsst.geom.geometry.SphericalCircle.center

Definition at line 773 of file geometry.py.

lsst.geom.geometry.SphericalCircle.radius

Definition at line 774 of file geometry.py.


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