LSSTApplications  12.1-5-gbdcc3ab,15.0+10,15.0+19,15.0-1-g19261fa+10,15.0-1-g60afb23+19,15.0-1-g615e0bb+11,15.0-1-g6668b0b+6,15.0-1-g788a293+19,15.0-1-ga91101e+19,15.0-1-gae1598d+9,15.0-1-gd076f1f+17,15.0-1-gdf18595+3,15.0-1-gf4f1c34+9,15.0-10-g113cadf7+2,15.0-11-g5674e3b,15.0-2-g100d730+12,15.0-2-g20c4630+8,15.0-2-g35685a8+15,15.0-2-g5dfaa72+8,15.0-2-gf38729e+14,15.0-24-g02ed2a30c+2,15.0-3-g11fe1a0+3,15.0-3-g130a88a+2,15.0-3-g707930d+1,15.0-3-g9103c06+9,15.0-3-ga03b4ca+26,15.0-3-gaec6799+6,15.0-4-g32c2b40+2,15.0-4-g535e784+3,15.0-4-g654b129+17,15.0-5-g23e394c+7,15.0-5-g54bfcd9+2,15.0-5-gb31927c,15.0-6-g4418537+2,15.0-7-g0c26201,15.0-7-g6bb3a066+2,15.0-9-g5661f8f+4,w.2018.18
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__ (self, center, radius)
 
def getBoundingBox (self)
 
def getBoundingCircle (self)
 
def getCenter (self)
 
def getRadius (self)
 
def isEmpty (self)
 
def isFull (self)
 
def contains (self, pointOrRegion)
 
def intersects (self, pointOrRegion)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 

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 794 of file geometry.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 799 of file geometry.py.

799  def __init__(self, center, radius):
800  """Creates a new spherical circle with the given center and radius.
801  """
802  self.center = sphericalCoords(center)
803  self.radius = float(radius)
804  self.boundingBox = None
805  if self.radius < 0.0 or self.radius > 180.0:
806  raise RuntimeError(
807  'Circle radius is negative or greater than 180 deg')
808  self.center = (reduceTheta(self.center[0]), self.center[1])
809 
def sphericalCoords(args)
Definition: geometry.py:108
def __init__(self, minimum, dataRange, Q)
Definition: rgb.py:414
def reduceTheta(theta)
Definition: geometry.py:194

Member Function Documentation

◆ __eq__()

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

Definition at line 948 of file geometry.py.

948  def __eq__(self, other):
949  if isinstance(other, SphericalCircle):
950  if self.isEmpty() and other.isEmpty():
951  return True
952  if self.radius == other.radius:
953  if self.center[1] == other.center[1]:
954  if abs(self.center[1]) == 90.0:
955  return True
956  return self.center[0] == other.center[0]
957  return False
958 
Angle abs(Angle const &a)
Definition: Angle.h:106

◆ __hash__()

def lsst.geom.geometry.SphericalCircle.__hash__ (   self)

Definition at line 959 of file geometry.py.

959  def __hash__(self):
960  return hash((self.center, self.radius))
961 

◆ __repr__()

def lsst.geom.geometry.SphericalCircle.__repr__ (   self)
Returns a string representation of this circle.

Definition at line 942 of file geometry.py.

942  def __repr__(self):
943  """Returns a string representation of this circle.
944  """
945  return ''.join([self.__class__.__name__, '(', repr(self.center),
946  ', ', repr(self.radius), ')'])
947 

◆ contains()

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 858 of file geometry.py.

858  def contains(self, pointOrRegion):
859  """Returns True if the specified point or spherical region is
860  completely contained in this circle. Note that the implementation
861  is conservative where ellipses are concerned: False may be returned
862  for an ellipse that is actually completely contained in this circle.
863  """
864  if self.isEmpty():
865  return False
866  pr = pointOrRegion
867  c = self.center
868  r = self.radius
869  if isinstance(pr, SphericalBox):
870  if pr.isEmpty():
871  return False
872  minp = pr.getMin()
873  maxp = pr.getMax()
874  if (sphericalAngularSep(c, minp) > r or
875  sphericalAngularSep(c, maxp) > r or
876  sphericalAngularSep(c, (minp[0], maxp[1])) > r or
877  sphericalAngularSep(c, (maxp[0], minp[1])) > r):
878  return False
879  a = alpha(r, c[1], minp[1])
880  if a is not None:
881  if (pr.containsPoint((c[0] + a, minp[1])) or
882  pr.containsPoint((c[0] - a, minp[1]))):
883  return False
884  a = alpha(r, c[1], maxp[1])
885  if a is not None:
886  if (pr.containsPoint((c[0] + a, maxp[1])) or
887  pr.containsPoint((c[0] - a, maxp[1]))):
888  return False
889  return True
890  elif isinstance(pr, SphericalCircle):
891  if pr.isEmpty():
892  return False
893  return sphericalAngularSep(c, pr.center) <= r - pr.radius
894  elif isinstance(pr, SphericalEllipse):
895  bc = pr.getBoundingCircle()
896  return sphericalAngularSep(c, bc.center) <= r - bc.radius
897  elif isinstance(pr, SphericalConvexPolygon):
898  p = cartesianUnitVector(c)
899  for v in pr.getVertices():
900  if cartesianAngularSep(p, v) > r:
901  return False
902  return True
903  else:
904  return sphericalAngularSep(c, sphericalCoords(pr)) <= r
905 
bool contains(VertexIterator const begin, VertexIterator const end, UnitVector3d const &v)
def sphericalCoords(args)
Definition: geometry.py:108
def alpha(r, centerPhi, phi)
Definition: geometry.py:222
def sphericalAngularSep(p1, p2)
Definition: geometry.py:169
def cartesianUnitVector(args)
Definition: geometry.py:141
def cartesianAngularSep(v1, v2)
Definition: geometry.py:260

◆ getBoundingBox()

def lsst.geom.geometry.SphericalCircle.getBoundingBox (   self)
Returns a bounding box for this spherical circle.

Definition at line 810 of file geometry.py.

810  def getBoundingBox(self):
811  """Returns a bounding box for this spherical circle.
812  """
813  if self.boundingBox is None:
814  if self.isEmpty():
815  self.boundingBox = SphericalBox()
816  elif self.isFull():
817  self.boundingBox = SphericalBox()
818  self.boundingBox.setFull()
819  else:
820  alpha = maxAlpha(self.radius, self.center[1])
821  minPhi = clampPhi(self.center[1] - self.radius)
822  maxPhi = clampPhi(self.center[1] + self.radius)
823  if alpha > 180.0 - ANGLE_EPSILON:
824  minTheta = 0.0
825  maxTheta = 360.0
826  else:
827  minTheta = self.center[0] - alpha
828  maxTheta = self.center[0] + alpha
829  self.boundingBox = SphericalBox((minTheta, minPhi),
830  (maxTheta, maxPhi))
831  return self.boundingBox
832 
def maxAlpha(r, centerPhi)
Definition: geometry.py:240
def clampPhi(phi)
Definition: geometry.py:184

◆ getBoundingCircle()

def lsst.geom.geometry.SphericalCircle.getBoundingCircle (   self)

Definition at line 833 of file geometry.py.

833  def getBoundingCircle(self):
834  return self
835 

◆ getCenter()

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 836 of file geometry.py.

836  def getCenter(self):
837  """Returns an (ra, dec) 2-tuple of floats corresponding to the
838  center of this circle.
839  """
840  return self.center
841 

◆ getRadius()

def lsst.geom.geometry.SphericalCircle.getRadius (   self)
Returns the radius (degrees) of this circle.

Definition at line 842 of file geometry.py.

842  def getRadius(self):
843  """Returns the radius (degrees) of this circle.
844  """
845  return self.radius
846 

◆ intersects()

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 906 of file geometry.py.

906  def intersects(self, pointOrRegion):
907  """Returns True if the given point or spherical region intersects
908  this circle. Note that the implementation is conservative where
909  ellipses are concerned: True may be returned for an ellipse that
910  is actually disjoint from this circle.
911  """
912  if self.isEmpty():
913  return False
914  pr = pointOrRegion
915  c = self.center
916  r = self.radius
917  if isinstance(pr, SphericalBox):
918  if pr.isEmpty():
919  return False
920  elif pr.containsPoint(c):
921  return True
922  minp = pr.getMin()
923  maxp = pr.getMax()
924  if (minPhiEdgeSep(c, minp[1], minp[0], maxp[0]) <= r or
925  minPhiEdgeSep(c, maxp[1], minp[0], maxp[0]) <= r):
926  return True
927  p = cartesianUnitVector(c)
928  return (minThetaEdgeSep(p, minp[0], minp[1], maxp[1]) <= r or
929  minThetaEdgeSep(p, maxp[0], minp[1], maxp[1]) <= r)
930  elif isinstance(pr, SphericalCircle):
931  if pr.isEmpty():
932  return False
933  return sphericalAngularSep(c, pr.center) <= r + pr.radius
934  elif isinstance(pr, SphericalEllipse):
935  bc = pr.getBoundingCircle()
936  return sphericalAngularSep(c, bc.center) <= r + bc.radius
937  elif isinstance(pr, SphericalConvexPolygon):
938  return pr.intersects(self)
939  else:
940  return sphericalAngularSep(c, sphericalCoords(pr)) <= r
941 
def minThetaEdgeSep(p, theta, minPhi, maxPhi)
Definition: geometry.py:301
def minPhiEdgeSep(p, phi, minTheta, maxTheta)
Definition: geometry.py:285
def sphericalCoords(args)
Definition: geometry.py:108
def sphericalAngularSep(p1, p2)
Definition: geometry.py:169
def cartesianUnitVector(args)
Definition: geometry.py:141

◆ isEmpty()

def lsst.geom.geometry.SphericalCircle.isEmpty (   self)
Returns True if this circle contains no points.

Definition at line 847 of file geometry.py.

847  def isEmpty(self):
848  """Returns True if this circle contains no points.
849  """
850  return self.radius < 0.0
851 

◆ isFull()

def lsst.geom.geometry.SphericalCircle.isFull (   self)
Returns True if this spherical box contains every point
on the unit sphere.

Definition at line 852 of file geometry.py.

852  def isFull(self):
853  """Returns True if this spherical box contains every point
854  on the unit sphere.
855  """
856  return self.radius >= 180.0
857 

Member Data Documentation

◆ boundingBox

lsst.geom.geometry.SphericalCircle.boundingBox

Definition at line 804 of file geometry.py.

◆ center

lsst.geom.geometry.SphericalCircle.center

Definition at line 802 of file geometry.py.

◆ radius

lsst.geom.geometry.SphericalCircle.radius

Definition at line 803 of file geometry.py.


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