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

SphericalCap Class Reference

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

#include <StelSphereGeometry.hpp>

Inherits SphericalRegion.

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 SphericalConvexPolygon &r) const
virtual bool contains (const SphericalCap &h) const
virtual bool contains (const AllSkySphericalRegion &r) 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 &poly) const
virtual QVariantMap 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 (  )  [inline]

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

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

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

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

Construct a SphericalCap from its direction and aperture.

Parameters:
an a unit vector indicating the direction.
ar cosinus of the aperture.

SphericalCap::SphericalCap ( const SphericalCap other  )  [inline]

Copy constructor.


Member Function Documentation

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 double SphericalCap::getArea (  )  const [inline, virtual]

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

Reimplemented from SphericalRegion.

virtual bool SphericalCap::isEmpty (  )  const [inline, virtual]

Return true if the region is empty.

Reimplemented from SphericalRegion.

virtual Vec3d SphericalCap::getPointInside (  )  const [inline, virtual]

Return a point located inside the SphericalCap.

Reimplemented from SphericalRegion.

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

Return itself.

Reimplemented from SphericalRegion.

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.

virtual QVariantMap SphericalCap::toQVariant (  )  const [virtual]

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

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

Implements SphericalRegion.

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

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

Implements SphericalRegion.

double SphericalCap::getRadius (  )  const [inline]

Return the radiusof the cap in radian.

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:
hn0 the x direction of the halfspace.
hn1 the y direction of the halfspace.
hn2 the z direction of the halfspace.

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::operator== ( const SphericalCap other  )  const [inline]

Comparison operator.

QVector<Vec3d> SphericalCap::getClosedOutlineContour (  )  const

Return the list of closed contours defining the polygon boundaries.

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

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

bool SphericalCap::containsTriangle ( const Vec3d vertice  )  const

Return whether the cap contains the passed triangle.

bool SphericalCap::intersectsTriangle ( const Vec3d vertice  )  const

Return whether the cap intersect with the passed triangle.

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

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

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

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.


Member Data Documentation

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

The cos of cone radius.


Generated on Mon Mar 22 09:55:38 2010 for Stellarium by  doxygen 1.5.5