Core 1.0
Spheroid Class Reference

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.
 

Detailed Description

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.

See also
Ellipse2

Constructor & Destructor Documentation

◆ Spheroid() [1/2]

Spheroid::Spheroid ( const Vector & c,
const Vector & axis,
const double & a,
const double & b )
explicit

Create a spheroid.

Parameters
cCenter.
axisAxis (should be normalized).
a,bAxis length and radial length.

◆ Spheroid() [2/2]

Spheroid::Spheroid ( const Vector & c,
const Vector & axis,
const double & r )
explicit

Create a spheroid.

Parameters
cCenter.
axisAxis of revolution, whose norm will define the first radius.
rRadial length.

Member Function Documentation

◆ Intersect()

int Spheroid::Intersect ( const Ray & ray,
double & tmin,
double & tmax ) const

Computes the intersection between a ray and the spheroid.

Parameters
rayThe ray.
tmin,tmaxIntersection depths.

◆ R()

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.

Parameters
pPoint.
See also
Ellipse2::R(const Vector2&)

◆ Rotated()

Spheroid Spheroid::Rotated ( const Matrix & r) const

Rotates a spheroid.

Parameters
rRotation matrix.

◆ Translated()

Spheroid Spheroid::Translated ( const Vector & t) const

Translates a spheroid.

Parameters
tTranslation vector.

◆ Value()

double Spheroid::Value ( const Vector & p) const
protected

Compute the field function value of a spheroid.

Parameters
pPoint.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const Spheroid & spheroid )
friend

Overloaded stream operator.

Parameters
sStream.
spheroidSpheroid.