SpatiumLib
|
#include <Sphere.h>
Public Member Functions | |
Sphere (const Point3 &origin, double radius) | |
Constructor. More... | |
Sphere (double radius) | |
Constructor. More... | |
Sphere (const Sphere &other)=default | |
Copy constructor. More... | |
Sphere & | operator= (const Sphere &other)=default |
Assignment operator. More... | |
virtual | ~Sphere ()=default |
Destructor. More... | |
void | origin (const Point3 &origin) |
Set origin of sphere. More... | |
Point3 | origin () const |
Get origin of sphere. More... | |
void | radius (double radius) |
Set radius of sphere. More... | |
double | radius () const |
Get radius of sphere. More... | |
double | distanceTo (const Point3 &point) const override |
Compute Euclidean distance to point. More... | |
Point3 | projectPoint (const Point3 &point) const override |
Project point onto sphere. More... | |
bool | intersectLine (const Point3 &origin, const Vector3 &direction, Point3 &intersection) const override |
Intersect line with sphere. More... | |
Vector3 | surfaceNormal (const Point3 &point) const |
Compute surface normal at given point. More... | |
double | distanceToHorizon (double height) const |
Compute distance to horizon as straight line from a point above surface to the horizon. More... | |
Point3 | pointOnHorizon (const Point3 &point, double direction) |
Compute point on horizon in a given direction. More... | |
Point3 | sphericalToCartesianCoordinates (double longitude, double latitude, double height) |
Compute Cartesian coordinates from spherical coordinates. More... | |
Point3 | cartesianToSphericalCoordinates (double x, double y, double z) |
Compute spherical coordinates from Cartesian coordinates. Cartesian vector (-1, 0, 0) points towards origin of spherical coordinate system. More... | |
![]() | |
Geometry ()=default | |
virtual | ~Geometry ()=default |
Protected Attributes | |
Point3 | m_origin |
double | m_radius |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Sphere &sphere) |
Output to ostream. More... | |
Sphere geometry.
A sphere is defined by a point (origin) and a radius.
Parametric description = x^2 + y^2 + z^2 = r^2
|
inline |
Constructor.
|
inline |
Constructor.
|
default |
Copy constructor.
|
virtualdefault |
Destructor.
|
inline |
Compute spherical coordinates from Cartesian coordinates. Cartesian vector (-1, 0, 0) points towards origin of spherical coordinate system.
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | z | Z coordinate |
|
inlineoverridevirtual |
Compute Euclidean distance to point.
[in] | point | Point |
Implements spatium::geom3d::Geometry.
|
inline |
Compute distance to horizon as straight line from a point above surface to the horizon.
[in] | height | Height above surface |
[in] | height | Height above surface |
|
inlineoverridevirtual |
Intersect line with sphere.
[in] | origin | Origin of line |
[in] | direction | Direction of line |
[out] | intersection | Intersection point |
Implements spatium::geom3d::Geometry.
|
inline |
Set origin of sphere.
[in] | origin | Origin |
|
inline |
Get origin of sphere.
Compute point on horizon in a given direction.
[in] | point | Point above surface |
[in] | direction | Direction towards horizon as polar coordinate in radians. 0 = east, 1/2 pi = north, etc. |
Project point onto sphere.
[in] | point | Point |
Implements spatium::geom3d::Geometry.
|
inline |
Set radius of sphere.
[in] | radius | Radius |
|
inline |
Get radius of sphere.
|
inline |
Compute Cartesian coordinates from spherical coordinates.
[in] | longitude | Longitude in radians |
[in] | latitude | Latitude in radians |
[in] | height | Height above surface |
Compute surface normal at given point.
[in] | point | Point |
|
friend |
Output to ostream.
|
protected |
|
protected |