Stellarium
24.4
|
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. | |
SphericalCap (double x, double y, double z) | |
Construct a SphericalCap from its direction and assumes a 90 deg aperture. | |
SphericalCap (const Vec3d &an, double ar) | |
Construct a SphericalCap from its direction and aperture. More... | |
SphericalCap (const SphericalCap &other) | |
Copy constructor. | |
SphericalCap & | operator= (const SphericalCap &other) |
SphericalRegionType | getType () const override |
OctahedronPolygon | getOctahedronPolygon () const override |
Return the octahedron contour representation of the polygon. More... | |
double | getArea () const override |
Get the area of the intersection of the halfspace on the sphere in steradian. | |
bool | isEmpty () const override |
Return true if the region is empty. | |
Vec3d | getPointInside () const override |
Return a point located inside the SphericalCap. | |
SphericalCap | getBoundingCap () const override |
Return itself. | |
bool | contains (const Vec3d &v) const override |
virtual bool | contains (const Vec3f &v) const |
bool | contains (const SphericalConvexPolygon &r) const override |
bool | contains (const SphericalCap &h) const override |
bool | contains (const AllSkySphericalRegion &) const override |
bool | intersects (const SphericalPolygon &r) const override |
bool | intersects (const SphericalConvexPolygon &r) const override |
bool | intersects (const SphericalCap &h) const override |
Returns whether a SphericalCap intersects with this one. More... | |
bool | intersects (const AllSkySphericalRegion &) const override |
QVariantList | toQVariant () const override |
Serialize the region into a QVariant map matching the JSON format. More... | |
void | serialize (QDataStream &out) const override |
Serialize the region. This method must allow as fast as possible serialization and work with deserialize(). | |
double | getRadius () const |
Return the radiusof the cap in radian. | |
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. | |
QVector< Vec3d > | getClosedOutlineContour () const |
Return the list of closed contours defining the polygon boundaries. | |
bool | intersectsConvexContour (const Vec3d *vertice, int nbVertice) const |
Return whether the cap intersect with a convex contour defined by nbVertice. | |
bool | containsTriangle (const Vec3d *vertice) const |
Return whether the cap contains the passed triangle. | |
bool | intersectsTriangle (const Vec3d *vertice) const |
Return whether the cap intersect with the passed triangle. | |
Public Member Functions inherited from SphericalRegion | |
virtual QVector< SphericalCap > | getBoundingSphericalCaps () const |
Return the list of SphericalCap bounding the ConvexPolygon. | |
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 StelVertexArray | getFillVertexArray () const |
Return an OpenGL compatible array to be displayed using vertex arrays. | |
virtual StelVertexArray | getFillVertexArray (const Vec3d &observerVelocityForAberration) |
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 StelVertexArray | getOutlineVertexArray (Vec3d observerVelocityForAberration) |
Get the outline of the contours defining the SphericalPolygon. 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 | 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 SphericalRegionP | deserialize (QDataStream &in) |
Deserialize the region. This method must allow as fast as possible deserialization. | |
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) | |
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) | |
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... | |
Data Fields | |
Vec3d | n |
The direction unit vector. Only if d==0, this vector doesn't need to be unit. | |
double | d |
The cos of cone radius. | |
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. | |
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.
|
inline |
Construct a SphericalCap from its direction and aperture.
an | a unit vector indicating the direction. |
ar | cosinus of the aperture. |
Clip the passed great circle connecting points v1 and v2.
|
overridevirtual |
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 |
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.
|
inlineoverridevirtual |
Returns whether a SphericalCap intersects with this one.
I managed to make it without sqrt or acos, so it is very fast!
Reimplemented from SphericalRegion.
|
inline |
Returns whether a HalfSpace (like a SphericalCap with d=0) intersects with this SphericalCap.
hn0 | the x direction of the halfspace. |
hn1 | the y direction of the halfspace. |
hn2 | the z direction of the halfspace. |
|
overridevirtual |
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.