Stellarium 0.12.2
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
SphericalCap Class Reference

A SphericalCap is defined by a direction and an aperture. More...

#include <StelSphereGeometry.hpp>

Public Member Functions

 SphericalCap ()
 Construct a SphericalCap with a 90 deg aperture and an undefined direction. More...
 
 SphericalCap (double x, double y, double z)
 Construct a SphericalCap from its direction and assumes a 90 deg aperture. More...
 
 SphericalCap (const Vec3d &an, double ar)
 Construct a SphericalCap from its direction and aperture. More...
 
 SphericalCap (const SphericalCap &other)
 Copy constructor. More...
 
virtual SphericalRegionType getType () const
 
virtual OctahedronPolygon getOctahedronPolygon () const
 Return the octahedron contour representation of the polygon. More...
 
virtual double getArea () const
 Get the area of the intersection of the halfspace on the sphere in steradian. More...
 
virtual bool isEmpty () const
 Return true if the region is empty. More...
 
virtual Vec3d getPointInside () const
 Return a point located inside the SphericalCap. More...
 
virtual SphericalCap getBoundingCap () const
 Return itself. More...
 
bool contains (const Vec3d &v) const
 
virtual bool contains (const SphericalConvexPolygon &r) const
 
virtual bool contains (const SphericalCap &h) const
 
virtual bool contains (const AllSkySphericalRegion &) const
 
virtual bool intersects (const SphericalPolygon &r) const
 
virtual bool intersects (const SphericalConvexPolygon &r) const
 
virtual bool intersects (const SphericalCap &h) const
 Returns whether a SphericalCap intersects with this one. More...
 
virtual bool intersects (const AllSkySphericalRegion &) const
 
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...
 
double getRadius () const
 Return the radiusof the cap in radian. More...
 
bool intersectsHalfSpace (double hn0, double hn1, double hn2) const
 Returns whether a HalfSpace (like a SphericalCap with d=0) intersects with this SphericalCap. More...
 
bool clipGreatCircle (Vec3d &v1, Vec3d &v2) const
 Clip the passed great circle connecting points v1 and v2. More...
 
bool operator== (const SphericalCap &other) const
 Comparison operator. More...
 
QVector< Vec3dgetClosedOutlineContour () const
 Return the list of closed contours defining the polygon boundaries. More...
 
bool intersectsConvexContour (const Vec3d *vertice, int nbVertice) const
 Return whether the cap intersect with a convex contour defined by nbVertice. More...
 
bool containsTriangle (const Triplet< Vec3d > triangle) const
 Does the cap contain the passed triangle? More...
 
bool intersectsTriangle (const Triplet< Vec3d > &triangle) const
 Does the cap intersect with the passed triangle? More...
 
- Public Member Functions inherited from SphericalRegion
 SphericalRegion ()
 Default constructor. Inializes with no vertex buffers. More...
 
virtual ~SphericalRegion ()
 Destructor. Cleans up vertex buffers, if any. More...
 
virtual QVector< SphericalCapgetBoundingSphericalCaps () const
 Return the list of SphericalCap bounding the ConvexPolygon. 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 const QVector< Vec3d > & getFillVertexPositions () const
 Get a vector of vertex positions forming the region. More...
 
virtual PrimitiveType getFillPrimitiveType () const
 Get primitive type determining how vertices in vector returned by getFillVertexPositions() form triangles. More...
 
virtual const QVector< Vec3d > & getOutlineVertexPositions () const
 Get the outline of the contours defining the SphericalPolygon. More...
 
virtual PrimitiveType getOutlinePrimitiveType () const
 Get primitive type determining how vertices in vector returned by getOutlinePrimitiveType() form lines. 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
 
virtual bool contains (const SphericalPolygon &r) const
 
virtual bool contains (const SphericalPoint &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 SphericalPoint &r) 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
 
virtual void drawFill (class StelRenderer *renderer, const DrawParams &params)
 Draw the region as triangles (i.e. More...
 
virtual void drawOutline (class StelRenderer *renderer, const DrawParams &params)
 Draw the outline of the region. More...
 

Static Public Member Functions

static SphericalRegionP deserialize (QDataStream &in)
 Deserialize the region. This method must allow as fast as possible deserialization. More...
 
static double relativeAreaOverlap (const SphericalCap &c1, const SphericalCap &c2)
 Return the relative overlap between the areas of the 2 caps, i.e: min(intersectionArea/c1.area, intersectionArea/c2.area) More...
 
static double relativeDiameterOverlap (const SphericalCap &c1, const SphericalCap &c2)
 Return the relative overlap between the diameter of the 2 caps, i.e: min(intersectionDistance/c1.diameter, intersectionDistance/c2.diameter) More...
 
static bool intersectionPoints (const SphericalCap &h1, const SphericalCap &h2, Vec3d &p1, Vec3d &p2)
 Compute the intersection of 2 halfspaces on the sphere (usually on 2 points) and return it in p1 and p2. More...
 

Public Attributes

Vec3d n
 The direction unit vector. Only if d==0, this vector doesn't need to be unit. More...
 
double d
 The cos of cone radius. 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...
 
- Protected Member Functions inherited from SphericalRegion
virtual void updateFillVertexBuffer (class StelRenderer *renderer, const DrawParams &params, bool handleDiscontinuity)
 Update the vertex buffer used by drawFill(). More...
 
virtual void drawFillVertexBuffer (class StelRenderer *renderer, class StelProjector *projector)
 Drawing part of drawFill() - assumes the buffer/s is/are generated. More...
 
virtual bool needToUpdateFillVertexBuffers () const
 Do we need to update vertex buffer/s used by drawFill()? More...
 
virtual void fillVertexBuffersUpdated ()
 Called after updating vertex buffer/s used by drawFill(). More...
 
- Protected Attributes inherited from SphericalRegion
StelVertexBuffer< PlainVertex > * fillPlainVertexBuffer
 Cached plain vertex buffer for drawing. More...
 
bool useProjector
 Should Renderer draw calls specify a projector? More...
 

Detailed Description

A SphericalCap is defined by a direction and an aperture.

It forms a cone from the center of the Coordinate frame with a radius d. It is a disc on the sphere, a region above a circle on the unit sphere.

Definition at line 504 of file StelSphereGeometry.hpp.

Constructor & Destructor Documentation

SphericalCap::SphericalCap ( )
inline

Construct a SphericalCap with a 90 deg aperture and an undefined direction.

Definition at line 508 of file StelSphereGeometry.hpp.

SphericalCap::SphericalCap ( double  x,
double  y,
double  z 
)
inline

Construct a SphericalCap from its direction and assumes a 90 deg aperture.

Definition at line 511 of file StelSphereGeometry.hpp.

SphericalCap::SphericalCap ( const Vec3d an,
double  ar 
)
inline

Construct a SphericalCap from its direction and aperture.

Parameters
ana unit vector indicating the direction.
arcosinus of the aperture.

Definition at line 516 of file StelSphereGeometry.hpp.

SphericalCap::SphericalCap ( const SphericalCap other)
inline

Copy constructor.

Definition at line 529 of file StelSphereGeometry.hpp.

Member Function Documentation

bool SphericalCap::clipGreatCircle ( Vec3d v1,
Vec3d v2 
) const

Clip the passed great circle connecting points v1 and v2.

Returns
true if the great circle intersects with the cap, false otherwise.
bool SphericalCap::containsTriangle ( const Triplet< Vec3d triangle) const

Does the cap contain the passed triangle?

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

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

virtual double SphericalCap::getArea ( ) const
inlinevirtual

Get the area of the intersection of the halfspace on the sphere in steradian.

Reimplemented from SphericalRegion.

Definition at line 535 of file StelSphereGeometry.hpp.

virtual SphericalCap SphericalCap::getBoundingCap ( ) const
inlinevirtual

Return itself.

Reimplemented from SphericalRegion.

Definition at line 544 of file StelSphereGeometry.hpp.

QVector<Vec3d> SphericalCap::getClosedOutlineContour ( ) const

Return the list of closed contours defining the polygon boundaries.

virtual OctahedronPolygon SphericalCap::getOctahedronPolygon ( ) const
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.

virtual Vec3d SphericalCap::getPointInside ( ) const
inlinevirtual

Return a point located inside the SphericalCap.

Reimplemented from SphericalRegion.

Definition at line 541 of file StelSphereGeometry.hpp.

double SphericalCap::getRadius ( ) const
inline

Return the radiusof the cap in radian.

Definition at line 582 of file StelSphereGeometry.hpp.

static bool SphericalCap::intersectionPoints ( const SphericalCap h1,
const SphericalCap h2,
Vec3d p1,
Vec3d p2 
)
static

Compute the intersection of 2 halfspaces on the sphere (usually on 2 points) and return it in p1 and p2.

If the 2 SphericalCap don't intersect or intersect only at 1 point, false is returned and p1 and p2 are undefined.

virtual bool SphericalCap::intersects ( const SphericalCap h) const
inlinevirtual

Returns whether a SphericalCap intersects with this one.

I managed to make it without sqrt or acos, so it is very fast!

See Also
http://f4bien.blogspot.com/2009/05/spherical-geometry-optimisations.html for detailed explanations.

Reimplemented from SphericalRegion.

Definition at line 564 of file StelSphereGeometry.hpp.

bool SphericalCap::intersectsConvexContour ( const Vec3d vertice,
int  nbVertice 
) const

Return whether the cap intersect with a convex contour defined by nbVertice.

bool SphericalCap::intersectsHalfSpace ( double  hn0,
double  hn1,
double  hn2 
) const
inline

Returns whether a HalfSpace (like a SphericalCap with d=0) intersects with this SphericalCap.

Parameters
hn0the x direction of the halfspace.
hn1the y direction of the halfspace.
hn2the z direction of the halfspace.

Definition at line 588 of file StelSphereGeometry.hpp.

bool SphericalCap::intersectsTriangle ( const Triplet< Vec3d > &  triangle) const

Does the cap intersect with the passed triangle?

virtual bool SphericalCap::isEmpty ( ) const
inlinevirtual

Return true if the region is empty.

Reimplemented from SphericalRegion.

Definition at line 538 of file StelSphereGeometry.hpp.

bool SphericalCap::operator== ( const SphericalCap other) const
inline

Comparison operator.

Definition at line 599 of file StelSphereGeometry.hpp.

static double SphericalCap::relativeAreaOverlap ( const SphericalCap c1,
const SphericalCap c2 
)
static

Return the relative overlap between the areas of the 2 caps, i.e: min(intersectionArea/c1.area, intersectionArea/c2.area)

static double SphericalCap::relativeDiameterOverlap ( const SphericalCap c1,
const SphericalCap c2 
)
static

Return the relative overlap between the diameter of the 2 caps, i.e: min(intersectionDistance/c1.diameter, intersectionDistance/c2.diameter)

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

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

Implements SphericalRegion.

Definition at line 576 of file StelSphereGeometry.hpp.

virtual QVariantList SphericalCap::toQVariant ( ) const
virtual

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

The format is ["CAP", [ra, dec], radius], with ra dec in degree in ICRS frame and radius in degree (between 0 and 180 deg)

Implements SphericalRegion.

Member Data Documentation

double SphericalCap::d

The cos of cone radius.

Definition at line 631 of file StelSphereGeometry.hpp.

Vec3d SphericalCap::n

The direction unit vector. Only if d==0, this vector doesn't need to be unit.

Definition at line 629 of file StelSphereGeometry.hpp.


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