Ocean
|
This class implements a bounding sphere. More...
Public Member Functions | |
BoundingSphere () | |
Creates an invalid bounding sphere. More... | |
BoundingSphere (const Vector3 ¢er, const Scalar radius) | |
Creates a new bounding sphere by a center point and a radius. More... | |
BoundingSphere (const BoundingBox &boundingBox) | |
Creates a new bounding sphere by a given bounding box. More... | |
bool | intersections (const Line3 &ray, Vector3 &position0, Scalar &distance0, Vector3 &position1, Scalar &distance1) const |
Returns both intersection points between a given ray and this sphere. More... | |
bool | intersections (const Line3 &ray, const HomogenousMatrix4 &transformation, const HomogenousMatrix4 &invertedTransformation, Vector3 &position0, Scalar &distance0, Vector3 &position1, Scalar &distance1) const |
Returns both intersection points between a given ray and this sphere. More... | |
bool | intersections (const Line3 &ray, Vector3 &position0, Scalar &distance0, Vector3 &normal0, Vector3 &position1, Scalar &distance1, Vector3 &normal1) const |
Returns both intersection points between a given ray and this sphere. More... | |
bool | intersections (const Line3 &ray, const HomogenousMatrix4 &transformation, const HomogenousMatrix4 &invertedTransformation, Vector3 &position0, Scalar &distance0, Vector3 &normal0, Vector3 &position1, Scalar &distance1, Vector3 &normal1) const |
Returns both intersection points between a given ray and this sphere. More... | |
bool | positiveFrontIntersection (const Line3 &ray, Vector3 &position, Scalar &distance) const |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveFrontIntersection (const Line3 &ray, Vector3 &position, Scalar &distance, Vector3 &normal) const |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveFrontIntersection (const Line3 &ray, const HomogenousMatrix4 &transformation, const HomogenousMatrix4 &invertedTransformation, Vector3 &position, Scalar &distance) const |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveFrontIntersection (const Line3 &ray, const HomogenousMatrix4 &transformation, const HomogenousMatrix4 &invertedTransformation, Vector3 &position, Scalar &distance, Vector3 &normal) const |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveBackIntersection (const Line3 &ray, Vector3 &position, Scalar &distance) const |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveBackIntersection (const Line3 &ray, Vector3 &position, Scalar &distance, Vector3 &normal) const |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveBackIntersection (const Line3 &ray, const HomogenousMatrix4 &transformation, const HomogenousMatrix4 &invertedTransformation, Vector3 &position, Scalar &distance) const |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive. More... | |
bool | positiveBackIntersection (const Line3 &ray, const HomogenousMatrix4 &transformation, const HomogenousMatrix4 &invertedTransformation, Vector3 &position, Scalar &distance, Vector3 &normal) const |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive. More... | |
Public Member Functions inherited from Ocean::SphereT3< Scalar > | |
SphereT3 ()=default | |
Creates an invalid sphere. More... | |
SphereT3 (const VectorT3< Scalar > ¢er, const Scalar radius) | |
Creates a new sphere by a center point and a radius. More... | |
SphereT3 (const BoxT3< Scalar > &boundingBox) | |
Creates a new sphere entirely containing a given 3D box. More... | |
const VectorT3< Scalar > & | center () const |
Returns the center of the sphere. More... | |
const Scalar & | radius () const |
Returns the radius of the sphere. More... | |
bool | isInside (const VectorT3< Scalar > &point) const |
Returns whether a given point is inside this sphere. More... | |
bool | isInsideEps (const VectorT3< Scalar > &point, const Scalar eps=NumericT< Scalar >::eps()) const |
Returns whether a given point is inside this sphere including a thin epsilon boundary. More... | |
bool | hasIntersection (const LineT3< Scalar > &ray) const |
Returns whether a given ray has an intersection with this sphere. More... | |
bool | hasIntersection (const LineT3< Scalar > &ray, const HomogenousMatrixT4< Scalar > &sphere_T_ray) const |
Returns whether a given ray has an intersection with this sphere. More... | |
bool | hasIntersection (const SphereT3< Scalar > &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< Scalar > | operator* (const Scalar factor) const |
Returns a new sphere with an enlarged radius (the center of the sphere stays constant). More... | |
SphereT3< Scalar > & | operator*= (const Scalar factor) |
Multiplies the radius of this sphere with a given factor. More... | |
Private Attributes | |
Scalar | inverseRadius_ |
Inverse of the sphere radius. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Ocean::SphereT3< Scalar > | |
static VectorT3< Scalar > | coordinateToVector (const Scalar latitude, const Scalar 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< Scalar > &coordinateVector, Scalar &latitude, Scalar &longitude) |
Converts a vector pointing to the surface of a unit sphere to a 2D location coordinate. More... | |
static Scalar | shortestDistance (const Scalar latitudeA, const Scalar longitudeA, const Scalar latitudeB, const Scalar longitudeB) |
Calculates the shortest distance between two 2D location coordinates on the surface of a unit sphere. More... | |
Protected Attributes inherited from Ocean::SphereT3< Scalar > | |
VectorT3< Scalar > | center_ |
Sphere center. More... | |
Scalar | radius_ |
Sphere radius. More... | |
This class implements a bounding sphere.
|
inline |
Creates an invalid bounding sphere.
Creates a new bounding sphere by a center point and a radius.
center | Center of the bounding sphere |
radius | Radius of the bounding sphere |
|
inlineexplicit |
Creates a new bounding sphere by a given bounding box.
boundingBox | Bounding box to be converted |
|
inline |
Returns both intersection points between a given ray and this sphere.
The intersection points are determined without consideration of the ray direction
.
ray | Ray to determine the nearest intersection point for |
transformation | Transformation of the given world transformation (for the sphere) |
invertedTransformation | Inverted transformation of the given world transformation (for the sphere) |
position0 | Resulting nearest intersection position |
distance0 | Resulting nearest intersection distance, regarding to the length of the ray direction |
normal0 | Resulting nearest intersection normal |
position1 | Resulting farthest intersection position |
distance1 | Resulting farthest intersection distance, regarding to the length of the ray direction |
normal1 | Resulting farthest intersection normal |
|
inline |
Returns both intersection points between a given ray and this sphere.
The intersection points are determined without consideration of the ray direction
.
ray | Ray to determine the nearest intersection point for |
transformation | Transformation of the given world transformation (for the sphere) |
invertedTransformation | Inverted transformation of the given world transformation (for the sphere) |
position0 | Resulting nearest intersection position |
distance0 | Resulting nearest intersection distance, regarding to the length of the ray direction |
position1 | Resulting farthest intersection position |
distance1 | Resulting farthest intersection distance, regarding to the length of the ray direction |
|
inline |
Returns both intersection points between a given ray and this sphere.
The intersection points are determined without consideration of the ray direction
.
ray | Ray to determine the nearest intersection point for |
position0 | Resulting nearest intersection position |
distance0 | Resulting nearest intersection distance, regarding to the length of the ray direction |
normal0 | Resulting nearest intersection normal |
position1 | Resulting farthest intersection position |
distance1 | Resulting farthest intersection distance, regarding to the length of the ray direction |
normal1 | Resulting farthest intersection normal |
bool Ocean::BoundingSphere::intersections | ( | const Line3 & | ray, |
Vector3 & | position0, | ||
Scalar & | distance0, | ||
Vector3 & | position1, | ||
Scalar & | distance1 | ||
) | const |
Returns both intersection points between a given ray and this sphere.
The intersection points are determined without consideration of the ray direction
.
ray | Ray to determine the nearest intersection point for |
position0 | Resulting nearest intersection position |
distance0 | Resulting nearest intersection distance, regarding to the length of the ray direction |
position1 | Resulting farthest intersection position |
distance1 | Resulting farthest intersection distance, regarding to the length of the ray direction |
|
inline |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be positive.
ray | Ray to determine the intersection point for |
transformation | Transformation of the given world transformation (for the sphere) |
invertedTransformation | Inverted transformation of the given world transformation (for the sphere) |
position | Resulting intersection position |
distance | Resulting intersection distance |
|
inline |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be positive.
ray | Ray to determine the intersection point for |
transformation | Transformation of the given world transformation (for the sphere) |
invertedTransformation | Inverted transformation of the given world transformation (for the sphere) |
position | Resulting intersection position |
distance | Resulting intersection distance |
normal | Resulting intersection normal |
bool Ocean::BoundingSphere::positiveBackIntersection | ( | const Line3 & | ray, |
Vector3 & | position, | ||
Scalar & | distance | ||
) | const |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be positive.
ray | Ray to determine the intersection point for |
position | Resulting intersection position |
distance | Resulting intersection distance |
|
inline |
Returns the back intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be positive.
ray | Ray to determine the intersection point for |
position | Resulting intersection position |
distance | Resulting intersection distance |
normal | Resulting intersection normal |
|
inline |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be negative.
ray | Ray to determine the intersection point for |
transformation | Transformation of the given world transformation (for the sphere) |
invertedTransformation | Inverted transformation of the given world transformation (for the sphere) |
position | Resulting intersection position |
distance | Resulting intersection distance |
|
inline |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be negative.
ray | Ray to determine the intersection point for |
transformation | Transformation of the given world transformation (for the sphere) |
invertedTransformation | Inverted transformation of the given world transformation (for the sphere) |
position | Resulting intersection position |
distance | Resulting intersection distance |
normal | Resulting intersection normal |
bool Ocean::BoundingSphere::positiveFrontIntersection | ( | const Line3 & | ray, |
Vector3 & | position, | ||
Scalar & | distance | ||
) | const |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be negative.
ray | Ray to determine the intersection point for |
position | Resulting intersection position |
distance | Resulting intersection distance |
|
inline |
Returns the front intersection point between a given ray and this sphere whenever the distance is positive.
The dot product between the ray direction and the intersection normal will be negative.
ray | Ray to determine the intersection point for |
position | Resulting intersection position |
distance | Resulting intersection distance |
normal | Resulting intersection normal |
|
private |
Inverse of the sphere radius.