Stellarium 0.15.2
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
SphericalConvexPolygon Class Reference

A special case of SphericalPolygon for which the polygon is convex. More...

#include <StelSphereGeometry.hpp>

+ Inheritance diagram for SphericalConvexPolygon:
+ Collaboration diagram for SphericalConvexPolygon:

Public Member Functions

 SphericalConvexPolygon ()
 Default constructor. More...
 
 SphericalConvexPolygon (const QVector< QVector< Vec3d > > &contours)
 Constructor from a list of contours. More...
 
 SphericalConvexPolygon (const QVector< Vec3d > &contour)
 Constructor from one contour. More...
 
 SphericalConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2)
 Special constructor for triangle. More...
 
 SphericalConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2, const Vec3d &e3)
 Special constructor for quads. More...
 
virtual SphericalRegionType getType () const
 
virtual OctahedronPolygon getOctahedronPolygon () const
 Return the octahedron contour representation of the polygon. More...
 
virtual StelVertexArray getFillVertexArray () const
 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 double getArea () const
 Return the area of the region in steradians. More...
 
virtual bool isEmpty () const
 Return true if the region is empty. More...
 
virtual Vec3d getPointInside () const
 Return a point located inside the region. More...
 
virtual SphericalCap getBoundingCap () const
 Return a bounding SphericalCap. More...
 
QVector< SphericalCapgetBoundingSphericalCaps () const
 Return the list of SphericalCap bounding the ConvexPolygon. 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(). 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 &) const
 
virtual bool intersects (const SphericalCap &r) const
 
virtual bool intersects (const SphericalPolygon &r) const
 
virtual bool intersects (const SphericalConvexPolygon &r) const
 
virtual bool intersects (const SphericalPoint &r) const
 
virtual bool intersects (const AllSkySphericalRegion &) const
 
void setContour (const QVector< Vec3d > &acontour)
 Set a single contour defining the SphericalPolygon. More...
 
const QVector< Vec3d > & getConvexContour () const
 Get the single contour defining the SphericalConvexPolygon. More...
 
bool checkValid () const
 Check if the polygon is valid, i.e. it has no side >180. More...
 
- Public Member Functions inherited from SphericalRegion
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 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
 
virtual SphericalRegionP getIntersection (const SphericalPoint &r) const
 
virtual SphericalRegionP getIntersection (const AllSkySphericalRegion &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
 
virtual SphericalRegionP getUnion (const SphericalPoint &r) const
 
SphericalRegionP getUnion (const AllSkySphericalRegion &r) const
 
virtual SphericalRegionP getUnion (const EmptySphericalRegion &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
 
virtual SphericalRegionP getSubtraction (const SphericalPoint &r) const
 
SphericalRegionP getSubtraction (const AllSkySphericalRegion &r) const
 
virtual SphericalRegionP getSubtraction (const EmptySphericalRegion &r) const
 

Static Public Member Functions

static bool checkValidContour (const QVector< Vec3d > &contour)
 Check if the passed contour is convex and valid, i.e. it has no side >180. More...
 
static SphericalRegionP deserialize (QDataStream &in)
 Deserialize the region. This method must allow as fast as possible deserialization. More...
 

Protected Member Functions

void updateBoundingCap ()
 Update the bounding cap from the vertex list. More...
 
bool areAllPointsOutsideOneSide (const QVector< Vec3d > &points) const
 Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary. More...
 
bool containsConvexContour (const Vec3d *vertice, int nbVertex) const
 

Static Protected Member Functions

static bool areAllPointsOutsideOneSide (const Vec3d *thisContour, int nbThisContour, const Vec3d *points, int nbPoints)
 Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary. More...
 

Protected Attributes

QVector< Vec3dcontour
 A list of vertices of the convex contour. More...
 
SphericalCap cachedBoundingCap
 Cache the bounding cap. More...
 

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. More...
 

Detailed Description

A special case of SphericalPolygon for which the polygon is convex.

Definition at line 627 of file StelSphereGeometry.hpp.

Constructor & Destructor Documentation

SphericalConvexPolygon::SphericalConvexPolygon ( )
inline

Default constructor.

Definition at line 635 of file StelSphereGeometry.hpp.

SphericalConvexPolygon::SphericalConvexPolygon ( const QVector< QVector< Vec3d > > &  contours)
inline

Constructor from a list of contours.

Definition at line 638 of file StelSphereGeometry.hpp.

SphericalConvexPolygon::SphericalConvexPolygon ( const QVector< Vec3d > &  contour)
inline

Constructor from one contour.

Definition at line 640 of file StelSphereGeometry.hpp.

SphericalConvexPolygon::SphericalConvexPolygon ( const Vec3d e0,
const Vec3d e1,
const Vec3d e2 
)
inline

Special constructor for triangle.

Definition at line 642 of file StelSphereGeometry.hpp.

SphericalConvexPolygon::SphericalConvexPolygon ( const Vec3d e0,
const Vec3d e1,
const Vec3d e2,
const Vec3d e3 
)
inline

Special constructor for quads.

Definition at line 644 of file StelSphereGeometry.hpp.

Member Function Documentation

static bool SphericalConvexPolygon::areAllPointsOutsideOneSide ( const Vec3d thisContour,
int  nbThisContour,
const Vec3d points,
int  nbPoints 
)
staticprotected

Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary.

Parameters
thisContourthe vertices defining the contour.
nbThisContournb of vertice of the contour.
pointsthe points to test.
nbPointsthe number of points to test.
bool SphericalConvexPolygon::areAllPointsOutsideOneSide ( const QVector< Vec3d > &  points) const
inlineprotected

Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary.

Definition at line 729 of file StelSphereGeometry.hpp.

bool SphericalConvexPolygon::checkValid ( ) const

Check if the polygon is valid, i.e. it has no side >180.

static bool SphericalConvexPolygon::checkValidContour ( const QVector< Vec3d > &  contour)
static

Check if the passed contour is convex and valid, i.e. it has no side >180.

static SphericalRegionP SphericalConvexPolygon::deserialize ( QDataStream &  in)
static

Deserialize the region. This method must allow as fast as possible deserialization.

virtual double SphericalConvexPolygon::getArea ( ) const
virtual

Return the area of the region in steradians.

Reimplemented from SphericalRegion.

virtual SphericalCap SphericalConvexPolygon::getBoundingCap ( ) const
inlinevirtual

Return a bounding SphericalCap.

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.

Definition at line 653 of file StelSphereGeometry.hpp.

QVector<SphericalCap> SphericalConvexPolygon::getBoundingSphericalCaps ( ) const
virtual

Return the list of SphericalCap bounding the ConvexPolygon.

Reimplemented from SphericalRegion.

const QVector<Vec3d>& SphericalConvexPolygon::getConvexContour ( ) const
inline

Get the single contour defining the SphericalConvexPolygon.

Definition at line 700 of file StelSphereGeometry.hpp.

virtual StelVertexArray SphericalConvexPolygon::getFillVertexArray ( ) const
inlinevirtual

Return an openGL compatible array to be displayed using vertex arrays.

Reimplemented from SphericalRegion.

Reimplemented in SphericalTexturedConvexPolygon.

Definition at line 648 of file StelSphereGeometry.hpp.

virtual OctahedronPolygon SphericalConvexPolygon::getOctahedronPolygon ( ) const
inlinevirtual

Return the octahedron contour representation of the polygon.

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

Implements SphericalRegion.

Definition at line 647 of file StelSphereGeometry.hpp.

virtual StelVertexArray SphericalConvexPolygon::getOutlineVertexArray ( ) const
inlinevirtual

Get the outline of the contours defining the SphericalPolygon.

Returns
a list of vertex which taken 2 by 2 define the contours of the polygon.

Reimplemented from SphericalRegion.

Definition at line 649 of file StelSphereGeometry.hpp.

virtual Vec3d SphericalConvexPolygon::getPointInside ( ) const
virtual

Return a point located inside the region.

Reimplemented from SphericalRegion.

virtual bool SphericalConvexPolygon::isEmpty ( ) const
inlinevirtual

Return true if the region is empty.

Reimplemented from SphericalRegion.

Definition at line 651 of file StelSphereGeometry.hpp.

virtual void SphericalConvexPolygon::serialize ( QDataStream &  out) const
inlinevirtual

Serialize the region. This method must allow as fast as possible serialization and work with deserialize().

Implements SphericalRegion.

Reimplemented in SphericalTexturedConvexPolygon.

Definition at line 660 of file StelSphereGeometry.hpp.

void SphericalConvexPolygon::setContour ( const QVector< Vec3d > &  acontour)
inline

Set a single contour defining the SphericalPolygon.

Parameters
acontoura contour defining the polygon area.

Definition at line 697 of file StelSphereGeometry.hpp.

virtual QVariantList SphericalConvexPolygon::toQVariant ( ) const
virtual

Serialize the region into a QVariant map matching the JSON format.

The format is

["CONVEX_POLYGON", [[ra,dec], [ra,dec], [ra,dec], [ra,dec]]]

where the coords are a closed convex contour, with each points defined by ra dec in degree in the ICRS frame.

Implements SphericalRegion.

Reimplemented in SphericalTexturedConvexPolygon.

void SphericalConvexPolygon::updateBoundingCap ( )
protected

Update the bounding cap from the vertex list.

Member Data Documentation

SphericalCap SphericalConvexPolygon::cachedBoundingCap
protected

Cache the bounding cap.

Definition at line 716 of file StelSphereGeometry.hpp.

QVector<Vec3d> SphericalConvexPolygon::contour
protected

A list of vertices of the convex contour.

Definition at line 713 of file StelSphereGeometry.hpp.


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