Stellarium 0.11.1
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure
Public Member Functions | Static Public Member Functions | Public Attributes
SphericalCap Class Reference

#include <StelSphereGeometry.hpp>

List of all members.

Public Member Functions

 SphericalCap ()
 SphericalCap (double x, double y, double z)
 SphericalCap (const Vec3d &an, double ar)
 SphericalCap (const SphericalCap &other)
virtual SphericalRegionType getType () const
virtual OctahedronPolygon getOctahedronPolygon () const
virtual double getArea () const
virtual bool isEmpty () const
virtual Vec3d getPointInside () const
virtual SphericalCap getBoundingCap () const
virtual bool contains (const Vec3d &v) const
virtual bool contains (const Vec3f &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
virtual bool intersects (const AllSkySphericalRegion &) const
virtual QVariantList toQVariant () const
virtual void serialize (QDataStream &out) const
double getRadius () const
bool intersectsHalfSpace (double hn0, double hn1, double hn2) const
bool clipGreatCircle (Vec3d &v1, Vec3d &v2) const
bool operator== (const SphericalCap &other) const
QVector< Vec3dgetClosedOutlineContour () const
bool intersectsConvexContour (const Vec3d *vertice, int nbVertice) const
bool containsTriangle (const Vec3d *vertice) const
bool intersectsTriangle (const Vec3d *vertice) const

Static Public Member Functions

static SphericalRegionP deserialize (QDataStream &in)
static double relativeAreaOverlap (const SphericalCap &c1, const SphericalCap &c2)
static double relativeDiameterOverlap (const SphericalCap &c1, const SphericalCap &c2)
static bool intersectionPoints (const SphericalCap &h1, const SphericalCap &h2, Vec3d &p1, Vec3d &p2)

Public Attributes

Vec3d n
double d

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.


Constructor & Destructor Documentation

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.

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.

Return the octahedron contour representation of the polygon.

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

Implements SphericalRegion.

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 [inline, virtual]

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.

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