Ocean
|
This class implements a 3D sphere. More...
Public Member Functions | |
SphereT3 ()=default | |
Creates an invalid sphere. More... | |
SphereT3 (const VectorT3< T > ¢er, const T radius) | |
Creates a new sphere by a center point and a radius. More... | |
SphereT3 (const BoxT3< T > &boundingBox) | |
Creates a new sphere entirely containing a given 3D box. More... | |
const VectorT3< T > & | center () const |
Returns the center of the sphere. More... | |
const T & | radius () const |
Returns the radius of the sphere. More... | |
bool | isInside (const VectorT3< T > &point) const |
Returns whether a given point is inside this sphere. More... | |
bool | isInsideEps (const VectorT3< T > &point, const T eps=NumericT< T >::eps()) const |
Returns whether a given point is inside this sphere including a thin epsilon boundary. More... | |
bool | hasIntersection (const LineT3< T > &ray) const |
Returns whether a given ray has an intersection with this sphere. More... | |
bool | hasIntersection (const LineT3< T > &ray, const HomogenousMatrixT4< T > &sphere_T_ray) const |
Returns whether a given ray has an intersection with this sphere. More... | |
bool | hasIntersection (const SphereT3< T > &sphere) const |
Returns whether two spheres have an intersection. More... | |
bool | isValid () const |
Returns whether this radius of this sphere is not negative and thus the sphere is valid. More... | |
SphereT3< T > | operator* (const T factor) const |
Returns a new sphere with an enlarged radius (the center of the sphere stays constant). More... | |
SphereT3< T > & | operator*= (const T factor) |
Multiplies the radius of this sphere with a given factor. More... | |
Static Public Member Functions | |
static VectorT3< T > | coordinateToVector (const T latitude, const T longitude) |
Converts a 2D location coordinate on the surface of a unit sphere to a vector with unit length. More... | |
static void | vectorToCoordinate (const VectorT3< T > &coordinateVector, T &latitude, T &longitude) |
Converts a vector pointing to the surface of a unit sphere to a 2D location coordinate. More... | |
static T | shortestDistance (const T latitudeA, const T longitudeA, const T latitudeB, const T longitudeB) |
Calculates the shortest distance between two 2D location coordinates on the surface of a unit sphere. More... | |
Protected Attributes | |
VectorT3< T > | center_ = VectorT3<T>(0, 0, 0) |
Sphere center. More... | |
T | radius_ = T(-1) |
Sphere radius. More... | |
This class implements a 3D sphere.
|
default |
Creates an invalid sphere.
|
inline |
Creates a new sphere by a center point and a radius.
center | The center of the sphere |
radius | The radius of the sphere, with range [0, infinity), negative to create an invalid sphere |
|
inlineexplicit |
Creates a new sphere entirely containing a given 3D box.
boundingBox | The box which will be contained by the new sphere, must be valid |
|
inline |
Returns the center of the sphere.
|
static |
Converts a 2D location coordinate on the surface of a unit sphere to a vector with unit length.
The north/south axis of the sphere is parallel to the y-axis, the z-axis points towards the longitude 0 at the equator, the x-axis points towards the longitude PI/2 at the equator.
latitude | The latitude coordinate of the location, in radian, with range [-PI/2, PI/2] |
longitude | The longitude coordinate of the location, in radian, with range [-PI, PI] |
bool Ocean::SphereT3< T >::hasIntersection | ( | const LineT3< T > & | ray | ) | const |
Returns whether a given ray has an intersection with this sphere.
ray | The ray to be tested |
|
inline |
Returns whether a given ray has an intersection with this sphere.
ray | Ray to be tested, must be valid |
sphere_T_ray | The transformation between ray and this sphere, must be valid |
|
inline |
Returns whether two spheres have an intersection.
sphere | Second sphere to test |
|
inline |
Returns whether a given point is inside this sphere.
point | The point to check |
|
inline |
Returns whether a given point is inside this sphere including a thin epsilon boundary.
point | The point to check |
eps | Epsilon to be used, with range [0, infinity) |
|
inline |
Returns whether this radius of this sphere is not negative and thus the sphere is valid.
|
inline |
Returns a new sphere with an enlarged radius (the center of the sphere stays constant).
factor | The factor to be multiplied with the radius of this sphere, with range [0, infinity) |
|
inline |
Multiplies the radius of this sphere with a given factor.
factor | The factor to be multiplied with the radius, with range [0, infinity) |
|
inline |
Returns the radius of the sphere.
|
static |
Calculates the shortest distance between two 2D location coordinates on the surface of a unit sphere.
The shortest distance is identical to the shortest angle (in radian) in a unit sphere.
This function applies the Haversine formula.
latitudeA | The latitude coordinate of the first location, in radian, with range [-PI/2, PI/2] |
longitudeA | The longitude coordinate of the first location, in radian, with range [-PI, PI] |
latitudeB | The latitude coordinate of the second location, in radian, with range [-PI/2, PI/2] |
longitudeB | The longitude coordinate of the second location, in radian, with range [-PI, PI] |
|
static |
Converts a vector pointing to the surface of a unit sphere to a 2D location coordinate.
coordinateVector | The vector pointing to the location on the unit sphere, must have unit length |
latitude | The resulting latitude coordinate of the location, in radian, with range range [-PI/2, PI/2] |
longitude | The resulting longitude coordinate of the location, in radian, with range range [-PI, PI] |
|
protected |
Sphere center.
|
protected |
Sphere radius.