Stellarium  0.17.0
Public Member Functions | Static Public Member Functions
SphericalPolygon Class Reference

Class defining default implementations for some spherical geometry methods. More...

#include <StelSphereGeometry.hpp>

Public Member Functions

 SphericalPolygon (const QVector< QVector< Vec3d > > &contours)
 Constructor from a list of contours.
 
 SphericalPolygon (const QVector< Vec3d > &contour)
 Constructor from one contour.
 
 SphericalPolygon (const OctahedronPolygon &octContour)
 
 SphericalPolygon (const QList< OctahedronPolygon > &octContours)
 
virtual SphericalRegionType getType () const
 
virtual OctahedronPolygon getOctahedronPolygon () const
 Return the octahedron contour representation of the polygon. More...
 
virtual QVariantList toQVariant () const
 Serialize the region into a QVariant map matching the JSON format. More...
 
virtual void serialize (QDataStream &out) const
 Serialize the region. This method must allow as fast as possible serialization and work with deserialize().
 
virtual SphericalCap getBoundingCap () const
 Return a bounding SphericalCap. More...
 
virtual bool contains (const Vec3d &p) const
 
virtual bool contains (const SphericalPolygon &r) const
 
virtual bool contains (const SphericalConvexPolygon &r) const
 
virtual bool contains (const SphericalCap &r) const
 
virtual bool contains (const SphericalPoint &r) const
 
virtual bool contains (const AllSkySphericalRegion &r) const
 
virtual bool intersects (const SphericalPolygon &r) const
 
virtual bool intersects (const SphericalConvexPolygon &r) const
 
virtual bool intersects (const SphericalCap &r) const
 
virtual bool intersects (const SphericalPoint &r) const
 
virtual bool intersects (const AllSkySphericalRegion &) const
 
virtual SphericalRegionP getIntersection (const SphericalPoint &r) const
 
virtual SphericalRegionP getIntersection (const AllSkySphericalRegion &) const
 
virtual SphericalRegionP getUnion (const SphericalPoint &) const
 
virtual SphericalRegionP getUnion (const EmptySphericalRegion &) const
 
virtual SphericalRegionP getSubtraction (const SphericalPoint &) const
 
virtual SphericalRegionP getSubtraction (const EmptySphericalRegion &) const
 
void setContours (const QVector< QVector< Vec3d > > &contours)
 Set the contours defining the SphericalPolygon. More...
 
void setContour (const QVector< Vec3d > &contour)
 Set a single contour defining the SphericalPolygon. More...
 
QVector< QVector< Vec3d > > getClosedOutlineContours () const
 Return the list of closed contours defining the polygon boundaries.
 
- Public Member Functions inherited from SphericalRegion
virtual double getArea () const
 Return the area of the region in steradians.
 
virtual bool isEmpty () const
 Return true if the region is empty.
 
virtual Vec3d getPointInside () const
 Return a point located inside the region.
 
virtual QVector< SphericalCapgetBoundingSphericalCaps () const
 Return the list of SphericalCap bounding the ConvexPolygon.
 
virtual SphericalRegionP getEnlarged (double margin) const
 Return an enlarged version of this SphericalRegion so that any point distant of more than the given margin now lays within the region. More...
 
virtual StelVertexArray getFillVertexArray () const
 Return an openGL compatible array to be displayed using vertex arrays.
 
virtual StelVertexArray getOutlineVertexArray () const
 Get the outline of the contours defining the SphericalPolygon. More...
 
virtual QVector< QVector< Vec3d > > getSimplifiedContours () const
 Get the contours defining the SphericalPolygon when combined using a positive winding rule. More...
 
QByteArray toJSON () const
 Output a JSON string representing the polygon. More...
 
bool contains (const SphericalRegion *r) const
 Returns whether a SphericalRegion is contained into this region. More...
 
bool contains (const SphericalRegionP r) const
 
bool contains (const EmptySphericalRegion &) const
 
bool intersects (const SphericalRegion *r) const
 Returns whether a SphericalRegion intersects with this region. More...
 
bool intersects (const SphericalRegionP r) const
 
bool intersects (const Vec3d &p) const
 
bool intersects (const EmptySphericalRegion &) const
 
SphericalRegionP getIntersection (const SphericalRegion *r) const
 Return a new SphericalRegion consisting of the intersection of this and the given region. More...
 
SphericalRegionP getIntersection (const SphericalRegionP r) const
 
virtual SphericalRegionP getIntersection (const SphericalPolygon &r) const
 
virtual SphericalRegionP getIntersection (const SphericalConvexPolygon &r) const
 
virtual SphericalRegionP getIntersection (const SphericalCap &r) const
 
SphericalRegionP getIntersection (const EmptySphericalRegion &r) const
 
SphericalRegionP getUnion (const SphericalRegion *r) const
 Return a new SphericalRegion consisting of the union of this and the given region. More...
 
SphericalRegionP getUnion (const SphericalRegionP r) const
 
virtual SphericalRegionP getUnion (const SphericalPolygon &r) const
 
virtual SphericalRegionP getUnion (const SphericalConvexPolygon &r) const
 
virtual SphericalRegionP getUnion (const SphericalCap &r) const
 
SphericalRegionP getUnion (const AllSkySphericalRegion &r) const
 
SphericalRegionP getSubtraction (const SphericalRegion *r) const
 Return a new SphericalRegion consisting of the subtraction of the given region from this. More...
 
SphericalRegionP getSubtraction (const SphericalRegionP r) const
 
virtual SphericalRegionP getSubtraction (const SphericalPolygon &r) const
 
virtual SphericalRegionP getSubtraction (const SphericalConvexPolygon &r) const
 
virtual SphericalRegionP getSubtraction (const SphericalCap &r) const
 
SphericalRegionP getSubtraction (const AllSkySphericalRegion &r) const
 

Static Public Member Functions

static SphericalRegionP deserialize (QDataStream &in)
 Deserialize the region. This method must allow as fast as possible deserialization.
 
static SphericalRegionP multiUnion (const QList< SphericalRegionP > &regions, bool optimizeByPreGrouping=false)
 Create a new SphericalRegionP which is the union of all the passed ones.
 
static SphericalRegionP multiIntersection (const QList< SphericalRegionP > &regions)
 Create a new SphericalRegionP which is the intersection of all the passed ones.
 

Additional Inherited Members

- Public Types inherited from SphericalRegion
enum  SphericalRegionType {
  Point = 0, Cap = 1, AllSky = 2, Polygon = 3,
  ConvexPolygon = 4, Empty = 5, Invalid = 6
}
 define types for all supported regions.
 

Detailed Description

All methods are reentrant.

Member Function Documentation

virtual SphericalCap SphericalPolygon::getBoundingCap ( ) const
virtual

This method is heavily used and therefore needs to be very fast. The returned SphericalCap doesn't have to be the smallest one, but smaller is better.

Reimplemented from SphericalRegion.

virtual OctahedronPolygon SphericalPolygon::getOctahedronPolygon ( ) const
inlinevirtual

It can be used for safe computation of intersection/union in the general case.

Implements SphericalRegion.

void SphericalPolygon::setContour ( const QVector< Vec3d > &  contour)
inline
Parameters
contoura contour defining the polygon area.
void SphericalPolygon::setContours ( const QVector< QVector< Vec3d > > &  contours)
inline
Parameters
contoursthe list of contours defining the polygon area. The contours are combined using the positive winding rule, meaning that the polygon is the union of the positive contours minus the negative ones.
virtual QVariantList SphericalPolygon::toQVariant ( ) const
virtual

The format is:

[[[ra,dec], [ra,dec], [ra,dec], [ra,dec]], [[ra,dec], [ra,dec], [ra,dec]],[...]]

it is a list of closed contours, with each points defined by ra dec in degree in the ICRS frame.

Implements SphericalRegion.

Reimplemented in SphericalTexturedPolygon.