Stellarium 0.12.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · File Structure

SphericalConvexPolygon Class Reference

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

#include <StelSphereGeometry.hpp>

List of all members.

Public Member Functions

 SphericalConvexPolygon ()
 Default constructor.
 SphericalConvexPolygon (const QVector< QVector< Vec3d > > &contours)
 Constructor from a list of contours.
 SphericalConvexPolygon (const QVector< Vec3d > &contour)
 Constructor from one contour.
 SphericalConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2)
 Special constructor for triangle.
 SphericalConvexPolygon (const Vec3d &e0, const Vec3d &e1, const Vec3d &e2, const Vec3d &e3)
 Special constructor for quads.
virtual SphericalRegionType getType () const
virtual OctahedronPolygon getOctahedronPolygon () const
 Return the octahedron contour representation of the polygon.
virtual const QVector< Vec3d > & getFillVertexPositions () const
 Get a vector of vertex positions forming the region.
virtual PrimitiveType getFillPrimitiveType () const
 Get primitive type determining how vertices in vector returned by getFillVertexPositions() form triangles.
virtual const QVector< Vec3d > & getOutlineVertexPositions () const
 Get the outline of the contours defining the SphericalPolygon.
virtual PrimitiveType getOutlinePrimitiveType () const
 Get primitive type determining how vertices in vector returned by getOutlinePrimitiveType() form lines.
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 SphericalCap getBoundingCap () const
 Return a bounding SphericalCap.
QVector< SphericalCapgetBoundingSphericalCaps () const
 Return the list of SphericalCap bounding the ConvexPolygon.
virtual QVariantList toQVariant () const
 Serialize the region into a QVariant map matching the JSON format.
virtual void serialize (QDataStream &out) const
 Serialize the region. This method must allow as fast as possible serialization and work with deserialize().
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.
const QVector< Vec3d > & getConvexContour () const
 Get the single contour defining the SphericalConvexPolygon.
bool checkValid () const
 Check if the polygon is valid, i.e. it has no side >180.

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.
static SphericalRegionP deserialize (QDataStream &in)
 Deserialize the region. This method must allow as fast as possible deserialization.

Protected Member Functions

void updateBoundingCap ()
 Update the bounding cap from the vertex list.
virtual void updateFillVertexBuffer (class StelRenderer *renderer, const DrawParams &params, bool handleDiscontinuity)
 Update the vertex buffer used by drawFill().
virtual void drawFillVertexBuffer (class StelRenderer *renderer, class StelProjector *projector)
 Drawing part of drawFill() - assumes the buffer/s is/are generated.
virtual bool needToUpdateFillVertexBuffers () const
 Do we need to update vertex buffer/s used by drawFill()?
virtual void fillVertexBuffersUpdated ()
 Called after updating vertex buffer/s used by drawFill().
bool areAllPointsOutsideOneSide (const QVector< Vec3d > &points) const
 Computes whether the passed points are all outside of at least one SphericalCap defining the polygon boundary.
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.

Protected Attributes

QVector< Vec3dcontour
 A list of vertices of the convex contour.
SphericalCap cachedBoundingCap
 Cache the bounding cap.
bool fillVertexBufferNeedsUpdate
 Does the drawFill() vertex buffer need an update?

Detailed Description

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

Definition at line 867 of file StelSphereGeometry.hpp.


Constructor & Destructor Documentation

SphericalConvexPolygon::SphericalConvexPolygon (  )  [inline]

Default constructor.

Definition at line 875 of file StelSphereGeometry.hpp.

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

Constructor from a list of contours.

Definition at line 878 of file StelSphereGeometry.hpp.

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

Constructor from one contour.

Definition at line 886 of file StelSphereGeometry.hpp.

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

Special constructor for triangle.

Definition at line 893 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 900 of file StelSphereGeometry.hpp.


Member Function Documentation

bool SphericalConvexPolygon::areAllPointsOutsideOneSide ( const QVector< Vec3d > &  points  )  const [inline, protected]

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

Definition at line 1034 of file StelSphereGeometry.hpp.

static bool SphericalConvexPolygon::areAllPointsOutsideOneSide ( const Vec3d thisContour,
int  nbThisContour,
const Vec3d points,
int  nbPoints 
) [static, protected]

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

Parameters:
thisContour the vertices defining the contour.
nbThisContour nb of vertice of the contour.
points the points to test.
nbPoints the number of points to test.
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 void SphericalConvexPolygon::drawFillVertexBuffer ( class StelRenderer renderer,
class StelProjector projector 
) [protected, virtual]

Drawing part of drawFill() - assumes the buffer/s is/are generated.

Parameters:
renderer Renderer used for drawing.
projector Projector to project the vertices (NULL if subdivision is enabled, as in that case the projection is done during buffer generation)

Reimplemented from SphericalRegion.

Reimplemented in SphericalTexturedConvexPolygon.

virtual void SphericalConvexPolygon::fillVertexBuffersUpdated (  )  [inline, protected, virtual]

Called after updating vertex buffer/s used by drawFill().

Reimplemented from SphericalRegion.

Definition at line 1021 of file StelSphereGeometry.hpp.

virtual double SphericalConvexPolygon::getArea (  )  const [virtual]

Return the area of the region in steradians.

Reimplemented from SphericalRegion.

virtual SphericalCap SphericalConvexPolygon::getBoundingCap (  )  const [inline, virtual]

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 936 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 988 of file StelSphereGeometry.hpp.

virtual PrimitiveType SphericalConvexPolygon::getFillPrimitiveType (  )  const [inline, virtual]

Get primitive type determining how vertices in vector returned by getFillVertexPositions() form triangles.

Reimplemented from SphericalRegion.

Definition at line 918 of file StelSphereGeometry.hpp.

virtual const QVector<Vec3d>& SphericalConvexPolygon::getFillVertexPositions (  )  const [inline, virtual]

Get a vector of vertex positions forming the region.

Reimplemented from SphericalRegion.

Definition at line 913 of file StelSphereGeometry.hpp.

virtual OctahedronPolygon SphericalConvexPolygon::getOctahedronPolygon (  )  const [inline, virtual]

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 908 of file StelSphereGeometry.hpp.

virtual PrimitiveType SphericalConvexPolygon::getOutlinePrimitiveType (  )  const [inline, virtual]

Get primitive type determining how vertices in vector returned by getOutlinePrimitiveType() form lines.

Reimplemented from SphericalRegion.

Definition at line 928 of file StelSphereGeometry.hpp.

virtual const QVector<Vec3d>& SphericalConvexPolygon::getOutlineVertexPositions (  )  const [inline, virtual]

Get the outline of the contours defining the SphericalPolygon.

Returns:
a list of vertices which define the contours of the polygon.

Reimplemented from SphericalRegion.

Definition at line 923 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 [inline, virtual]

Return true if the region is empty.

Reimplemented from SphericalRegion.

Definition at line 934 of file StelSphereGeometry.hpp.

virtual bool SphericalConvexPolygon::needToUpdateFillVertexBuffers (  )  const [inline, protected, virtual]

Do we need to update vertex buffer/s used by drawFill()?

Might be true if e.g. the region has changed. Note that this is only one possible reason to update the buffers, drawFill() contains the full logic to determine this (e.g. we always update when subdividing is enabled).

Reimplemented from SphericalRegion.

Definition at line 1016 of file StelSphereGeometry.hpp.

virtual void SphericalConvexPolygon::serialize ( QDataStream &  out  )  const [inline, virtual]

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

Implements SphericalRegion.

Reimplemented in SphericalTexturedConvexPolygon.

Definition at line 943 of file StelSphereGeometry.hpp.

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

Set a single contour defining the SphericalPolygon.

Parameters:
acontour a contour defining the polygon area.

Definition at line 980 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.

virtual void SphericalConvexPolygon::updateFillVertexBuffer ( class StelRenderer renderer,
const DrawParams params,
bool  handleDiscontinuity 
) [protected, virtual]

Update the vertex buffer used by drawFill().

Called when drawing parameters have changed, or when we cannot cache vertices (e.g. when subdividing and this projecting outside Renderer).

Parameters:
renderer Renderer to create vertex buffer.
params Parameters used for drawing (which also affect vertex generation).
handleDiscontinuity Do we need to ensure that no triangles cross a projection discontinuity?

Reimplemented from SphericalRegion.

Reimplemented in SphericalTexturedConvexPolygon.


Member Data Documentation

Cache the bounding cap.

Definition at line 1004 of file StelSphereGeometry.hpp.

QVector<Vec3d> SphericalConvexPolygon::contour [protected]

A list of vertices of the convex contour.

Definition at line 1001 of file StelSphereGeometry.hpp.

Does the drawFill() vertex buffer need an update?

Definition at line 1007 of file StelSphereGeometry.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Jan 31 14:05:44 2013 for Stellarium by  doxygen 1.6.3