Thea
Torus3 Class Referenceabstract

A solid 3D torus, traced by a circular disk whose radius is the inner radius of the torus, and whose center moves along a larger circle whose radius is the outer radius of the torus. More...

`#include <Torus3.hpp>`

Inheritance diagram for Torus3:

## Public Member Functions

bool contains (Vector3 const &p) const
Check if the torus contains a point. More...

Vector3 const & getAxis () const
Get the axis of the torus, normalized to unit length. More...

AxisAlignedBox3 getBounds () const
Get a bounding box for the torus. More...

Vector3 const & getCenter () const
Get the center of the torus. More...

Get the inner radius of the torus. More...

Get the outer radius of the torus. More...

bool intersects (Vector3 const &p) const
Test if this torus intersects (contains) a point. More...

virtual RayIntersectionN< N, T > rayIntersection (RayN< N, T > const &ray, T max_time=-1) const
Get the intersection of a ray with the object, including the hit time and the normal at the intersection point. More...

virtual T rayIntersectionTime (RayN< N, T > const &ray, T max_time=-1) const =0
Get the time taken for a ray to intersect the object, or a negative value if there was no intersection in the forward direction. More...

virtual bool rayIntersects (RayN< N, T > const &ray, T max_time=-1) const
Check if a ray intersects the object in the forward direction. More...

void setAxis (Vector3 const &axis_)
Set the axis of the torus from an unnormalized direction vector. More...

void setCenter (Vector3 const &center_)
Set the center of the torus. More...

Set the inner radius of the torus. More...

Set the outer radius of the torus. More...

Torus3 ()
Default constructor. More...

Initialize with the center point, the axis (unnormalized direction vector orthogonal to the plane of the torus), and outer and inner radii. More...

std::string toString () const
Get a textual representation of the torus. More...

## Detailed Description

A solid 3D torus, traced by a circular disk whose radius is the inner radius of the torus, and whose center moves along a larger circle whose radius is the outer radius of the torus.

Definition at line 31 of file Torus3.hpp.

## Constructor & Destructor Documentation

 Torus3 ( )

Default constructor.

Does not initialize anything.

Definition at line 37 of file Torus3.hpp.

 Torus3 ( Vector3 const & center_, Vector3 const & axis_, Real outer_radius_, Real inner_radius_ )

Initialize with the center point, the axis (unnormalized direction vector orthogonal to the plane of the torus), and outer and inner radii.

Definition at line 43 of file Torus3.hpp.

## Member Function Documentation

 bool contains ( Vector3 const & p ) const

Check if the torus contains a point.

Definition at line 77 of file Torus3.hpp.

 Vector3 const& getAxis ( ) const

Get the axis of the torus, normalized to unit length.

Definition at line 56 of file Torus3.hpp.

 AxisAlignedBox3 getBounds ( ) const

Get a bounding box for the torus.

Definition at line 86 of file Torus3.hpp.

 Vector3 const& getCenter ( ) const

Get the center of the torus.

Definition at line 50 of file Torus3.hpp.

Get the inner radius of the torus.

Definition at line 68 of file Torus3.hpp.

Get the outer radius of the torus.

Definition at line 62 of file Torus3.hpp.

 bool intersects ( Vector3 const & p ) const

Test if this torus intersects (contains) a point.

Definition at line 74 of file Torus3.hpp.

 virtual RayIntersectionN rayIntersection ( RayN< N, T > const & ray, T max_time = `-1` ) const
virtualinherited

Get the intersection of a ray with the object, including the hit time and the normal at the intersection point.

A negative time is returned if there was no intersection in the forward direction. If the normal cannot be computed, the zero vector is returned.

Parameters
 ray The ray to test for intersection. max_time Maximum allowable hit time, ignored if negative.
Note
The returned normal need not have unit length.

Definition at line 102 of file RayIntersectableN.hpp.

 virtual T rayIntersectionTime ( RayN< N, T > const & ray, T max_time = `-1` ) const
pure virtualinherited

Get the time taken for a ray to intersect the object, or a negative value if there was no intersection in the forward direction.

All subclasses must reimplement this method. If the return value is negative, it should be at least

Parameters
 ray The ray to test for intersection. max_time Maximum allowable hit time, ignored if negative.
 virtual bool rayIntersects ( RayN< N, T > const & ray, T max_time = `-1` ) const
virtualinherited

Check if a ray intersects the object in the forward direction.

Parameters
 ray The ray to test for intersection. max_time Maximum allowable hit time, ignored if negative.

Definition at line 80 of file RayIntersectableN.hpp.

 void setAxis ( Vector3 const & axis_ )

Set the axis of the torus from an unnormalized direction vector.

Definition at line 59 of file Torus3.hpp.

 void setCenter ( Vector3 const & center_ )

Set the center of the torus.

Definition at line 53 of file Torus3.hpp.

Set the inner radius of the torus.

Definition at line 71 of file Torus3.hpp.