Stellarium  1.2
Public Types | Public Member Functions
SphericalRegion Class Referenceabstract

#include <StelSphereGeometry.hpp>

Public Types

enum  SphericalRegionType {
  Point = 0, Cap = 1, AllSky = 2, Polygon = 3,
  ConvexPolygon = 4, Empty = 5, Invalid = 6
}
 

Public Member Functions

virtual SphericalRegionType getType () const =0
 
virtual OctahedronPolygon getOctahedronPolygon () const =0
 Return the octahedron contour representation of the polygon. More...
 
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 SphericalCap getBoundingCap () const
 Return a bounding SphericalCap. More...
 
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 getFillVertexArray (const Vec3d &observerVelocityForAberration)
 Return an OpenGL compatible array to be displayed using vertex arrays. More...
 
virtual StelVertexArray getOutlineVertexArray () const
 Get the outline of the contours defining the SphericalPolygon. More...
 
virtual StelVertexArray getOutlineVertexArray (Vec3d observerVelocityForAberration)
 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...
 
virtual QVariantList toQVariant () const =0
 Serialize the region into a QVariant list matching the JSON format.
 
virtual void serialize (QDataStream &out) const =0
 Serialize the region. This method must allow as fast as possible serialization and work with deserialize().
 
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
 
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
 
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
 
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 &r) const
 
bool intersects (const EmptySphericalRegion &) 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
 
virtual SphericalRegionP getSubtraction (const SphericalPoint &r) const
 
SphericalRegionP getSubtraction (const AllSkySphericalRegion &r) const
 
virtual SphericalRegionP getSubtraction (const EmptySphericalRegion &r) const
 

Detailed Description

Abstract class defining a region of the sphere. It provides default implementation for the general non-convex polygon which can extend on more than 180 deg based on the OctahedronPolygon class. Subclasses provides special faster implementations of many methods.

Member Enumeration Documentation

◆ SphericalRegionType

define types for all supported regions.

Member Function Documentation

◆ contains()

bool SphericalRegion::contains ( const SphericalRegion r) const

A default potentially very slow implementation is provided for each case.

◆ getBoundingCap()

virtual SphericalCap SphericalRegion::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 in SphericalConvexPolygon, SphericalPolygon, EmptySphericalRegion, AllSkySphericalRegion, SphericalPoint, and SphericalCap.

◆ getEnlarged()

virtual SphericalRegionP SphericalRegion::getEnlarged ( double  margin) const
virtual

The returned region can be larger than the smallest enlarging region, therefore returning false positive on subsequent intersection tests. The default implementation always return an enlarged bounding SphericalCap.

Parameters
marginthe minimum enlargement margin in radian.

◆ getFillVertexArray()

virtual StelVertexArray SphericalRegion::getFillVertexArray ( const Vec3d observerVelocityForAberration)
inlinevirtual
Note
Presumably these general polygons of the base class don't describe geometry that may undergo aberration, so the observerVelocity must be zero. Implementation in derived classes should show aberration correction.

Reimplemented in SphericalTexturedConvexPolygon, SphericalTexturedPolygon, and SphericalConvexPolygon.

◆ getOctahedronPolygon()

virtual OctahedronPolygon SphericalRegion::getOctahedronPolygon ( ) const
pure virtual

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

Implemented in SphericalConvexPolygon, SphericalPolygon, EmptySphericalRegion, AllSkySphericalRegion, SphericalPoint, and SphericalCap.

◆ getOutlineVertexArray() [1/2]

virtual StelVertexArray SphericalRegion::getOutlineVertexArray ( ) const
inlinevirtual
Returns
a list of vertex which taken 2 by 2 define the contours of the polygon.

Reimplemented in SphericalConvexPolygon.

◆ getOutlineVertexArray() [2/2]

virtual StelVertexArray SphericalRegion::getOutlineVertexArray ( Vec3d  observerVelocityForAberration)
inlinevirtual
Note
Presumably these general polygons of the base class don't describe geometry that may undergo aberration, so the observerVelocity must be zero. Implementation in derived classes should show aberration correction.

Reimplemented in SphericalConvexPolygon.

◆ getSimplifiedContours()

virtual QVector<QVector<Vec3d > > SphericalRegion::getSimplifiedContours ( ) const
virtual

The default implementation returns a list of tessellated triangles derived from the OctahedronPolygon.

◆ getSubtraction()

SphericalRegionP SphericalRegion::getSubtraction ( const SphericalRegion r) const

A default potentially very slow implementation is provided for each case.

◆ intersects()

bool SphericalRegion::intersects ( const SphericalRegion r) const

A default potentially very slow implementation is provided for each case.

◆ toJSON()

QByteArray SphericalRegion::toJSON ( ) const

This method is convenient for debugging.