|
Core 1.0
|
Spheroids are symmetric ellipsoids, i.e., with the same radial coefficients a = b ≠ c. More...
#include <ellipse.h>
Public Member Functions | |
| Spheroid () | |
| Empty. | |
| Spheroid (const Vector &, const Vector &, const double &, const double &) | |
| Create a spheroid. | |
| Spheroid (const Vector &, const Vector &, const double &) | |
| Create a spheroid. | |
| ~Spheroid () | |
| Empty. | |
| Vector | Center () const |
| Gets the center. | |
| Vector | GetAxis () const |
| Gets the axis. | |
| double | A () const |
| Major radius of the ellipsoid. | |
| double | B () const |
| Minor radius of the ellipsoid. | |
| Box | GetBox () const |
| Compute the bouding box. | |
| Sphere | GetSphere () const |
| Compute the bouding sphere. | |
| Spheroid | Rotated (const Matrix &) const |
| Rotates a spheroid. | |
| Spheroid | Translated (const Vector &) const |
| Translates a spheroid. | |
| double | R (const Vector &) const |
| Compute the squared distance between a point and the spheroid. | |
| int | Intersect (const Ray &, double &, double &) const |
| Computes the intersection between a ray and the spheroid. | |
| double | Volume () const |
| Compute the volume of an ellipsoid. | |
Protected Member Functions | |
| double | Value (const Vector &) const |
| Compute the field function value of a spheroid. | |
Protected Attributes | |
| Vector | c = Vector::Null |
| Center of the ellipsoid. | |
| Vector | axis = Vector::Z |
| Axis. | |
| double | b = 1.0 |
| Axis length, and radial length (revolution). | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Spheroid &spheroid) |
| Overloaded stream operator. | |
Spheroids are symmetric ellipsoids, i.e., with the same radial coefficients a = b ≠ c.
Symmetric spheroids are surfaces of revolution, thus the Euclidean distance of a point or the signed distance can be computed analytically.
| int Spheroid::Intersect | ( | const Ray & | ray, |
| double & | tmin, | ||
| double & | tmax ) const |
Computes the intersection between a ray and the spheroid.
Underlying equation is : \(x^2 / b^2 + y^2 / b^2 + z^2 / a^2 - 1 = 0 \equiv a^2 (x^2 + y^2) + b^2 z^2 - a^2 b^2 = 0\)
| ray | The ray. |
| tmin,tmax | Intersection depths. |
| double Spheroid::R | ( | const Vector & | p | ) | const |
Compute the squared distance between a point and the spheroid.
It is possible to compute the closed form expression of the distance to a spheroid if the spheroid is symmetrical in one axis, in which case the spheroid is a surface of revolution, and the computation boils down to evaluating the distance between a point and an ellipse.
| p | Point. |
Rotates a spheroid.
| r | Rotation matrix. |
Translates a spheroid.
| t | Translation vector. |
|
protected |
Compute the field function value of a spheroid.
| p | Point. |
|
friend |
Overloaded stream operator.
| s | Stream. |
| spheroid | Spheroid. |