Core 1.0
HalfTorus Class Reference

A simple half-torus. More...

#include <torus.h>

Inheritance diagram for HalfTorus:
Torus Circle

Public Member Functions

 HalfTorus (const Torus &)
 Creates a half torus.
 HalfTorus (const Vector &, const Vector &, const double &=1.0, const double &=1.0)
 Creates a half torus.
 ~HalfTorus ()
 Empty.
bool Inside (const Vector &) const
 Check if a point is inside or outside the torus.
Box GetBox () const
 Computes the bounding box.
double R (const Vector &) const
 Compute the squared Euclidean distance between a point and the half-torus.
Vector Normal (const Vector &) const
 Computes the distance vector between a ahlf-torus and a given point.
double Area () const
 Compute the surface area of a torus.
double Volume () const
 Compute the volume of a torus.

Friends

std::ostream & operator<< (std::ostream &s, const HalfTorus &torus)
 Overloaded.

Additional Inherited Members

Protected Member Functions inherited from Torus
 Torus (const Vector &, const Vector &, const double &=1.0, const double &=1.0)
 Creates a torus.
 Torus (const Circle &, const double &=1.0)
 Create a torus.
 Torus (const double &, const double &=1.0)
 Create a horizontal torus centered at origin.
 ~Torus ()
 Empty.
int Intersect (const Ray &, double *, Vector *) const
 Computes the intersection depths and the normals between a ray and a torus.
bool Inside (const Vector &) const
 Check if a point is inside or outside the torus.
Box GetBox () const
 Computes the bounding box of a torus.
double R (const Vector &) const
 Compute the squared Euclidean distance between a point and the torus.
double Signed (const Vector &) const
 Compute the signed Euclidean distance between a point and the torus.
Vector Normal (const Vector &) const
 Computes the distance vector between a torus and a given point.
double Area () const
 Compute the surface area of a torus.
double Volume () const
 Compute the volume of a torus.
double Small () const
 Return the small radius of the torus.
void Scale (const double &)
 Uniformly scales a torus.
Vector RandomInside (Random &=Random::R239) const
 Generate a random vector inside the dodecahedron.
Protected Member Functions inherited from Circle
 Circle ()
 Empty.
 Circle (const double &)
 Creates a circle.
 Circle (const Vector &, const Vector &, const double &)
 Creates a circle.
 Circle (const Vector &, const Vector &, const Vector &)
 Creates a circle given three points.
 ~Circle ()
 Empty.
bool Intersect (const Ray &, double &) const
 Compute the ray-disc intersection.
Vector Center () const
 Gets the center of a circle.
Vector Axis () const
 Axis of the circle.
double Radius () const
 Radius of the circle.
double R (const Vector &) const
 Compute the distance between a point and a circle.
Vector Normal (const Vector &) const
 Computes the distance vector between a circle and a point.
void Rotate (const Matrix &)
 Rotates a circle.
void Translate (const Vector &)
 Translates a circle.
void Scale (const double &)
 Uniformly scales a circle.
Box GetBox () const
 Compute the axis aligned bounding box of a circle.
double Area () const
 Area of a circle.
Vector RandomInside (Random &=Random::R239) const
 Generate a random vector inside the circle.
Vector RandomOn (Random &=Random::R239) const
 Generate a random vector on the circle.
Vector Vogel (int, int) const
 Generate a spiraling vector in the disc.
Static Protected Member Functions inherited from Circle
static double Area (const double &)
 Area of a circle given its radius.
Protected Attributes inherited from Torus
double s = 1.0
 Small radius of the torus.
Protected Attributes inherited from Circle
Vector c = Vector::Null
 Center of the circle.
Vector axis = Vector::Z
 Axis.
double r = 1.0
 Radius.
Static Protected Attributes inherited from Torus
static constexpr const double epsilon = 1e-06
 Epsilon constant for some inside-outside functions.
static const Torus Unit
 Unit vertical torus, major and minor radii equal to 1.
Static Protected Attributes inherited from Circle
static constexpr const double epsilon = 1.0e-10
 Internal epsilon constant.

Detailed Description

A simple half-torus.

Constructor & Destructor Documentation

◆ HalfTorus() [1/2]

HalfTorus::HalfTorus ( const Torus & t)

Creates a half torus.

Parameters
tTorus.

◆ HalfTorus() [2/2]

HalfTorus::HalfTorus ( const Vector & c,
const Vector & axis,
const double & r = 1.0,
const double & s = 1.0 )
explicit

Creates a half torus.

Parameters
cCenter.
axisAxis, which should be normalized.
r,sMajor and minor radii.

Member Function Documentation

◆ Inside()

bool HalfTorus::Inside ( const Vector & p) const

Check if a point is inside or outside the torus.

Parameters
pPoint.

◆ Normal()

Vector HalfTorus::Normal ( const Vector & p) const

Computes the distance vector between a ahlf-torus and a given point.

See also
Torus::Normal(const Vector&) const
Parameters
pPoint.

◆ R()

double HalfTorus::R ( const Vector & p) const

Compute the squared Euclidean distance between a point and the half-torus.

Parameters
pPoint.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const HalfTorus & torus )
friend

Overloaded.

Parameters
sStream.
torusThe torus.