Thea
Public Member Functions | List of all members
Cylinder3 Class Referenceabstract

A solid 3D cylinder, traced by a circular disk whose center moves along a line segment. More...

#include <Cylinder3.hpp>

Inheritance diagram for Cylinder3:
RayIntersectableN< N, T >

Public Member Functions

bool contains (Vector3 const &p) const
 Check if the cylinder contains a point. More...
 
 Cylinder3 ()
 Default constructor. More...
 
 Cylinder3 (Vector3 const &begin_, Vector3 const &end_, Real radius_)
 Initialize with an axis (line segment from the center of one end to the center of the other end) and a radius. More...
 
AxisAlignedBox3 getBounds () const
 Get a bounding box for the cylinder. More...
 
Vector3 const & getDirection () const
 Get the unnormalized direction vector of the cylinder from the center of one end to the center of the other. More...
 
Vector3 getEndpoint (int i) const
 Get the center of one capping disk of the cylinder: 0 returns the first endpoint and 1 returns the second. More...
 
Real getRadius () const
 Get the radius of the cylinder. More...
 
bool intersects (Vector3 const &p) const
 Test if this cylinder intersects (contains) a point. More...
 
Real length () const
 Get the length of the cylinder. 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 &begin_, Vector3 const &end_)
 Set the axis of the cylinder. More...
 
void setRadius (Real radius_)
 Set the radius of the cylinder. More...
 
Real squaredLength () const
 Get the square of the length of the cylinder. More...
 
std::string toString () const
 Get a textual representation of the cylinder. More...
 

Detailed Description

A solid 3D cylinder, traced by a circular disk whose center moves along a line segment.

Definition at line 30 of file Cylinder3.hpp.

Constructor & Destructor Documentation

Cylinder3 ( )

Default constructor.

Does not initialize anything.

Definition at line 36 of file Cylinder3.hpp.

Cylinder3 ( Vector3 const &  begin_,
Vector3 const &  end_,
Real  radius_ 
)

Initialize with an axis (line segment from the center of one end to the center of the other end) and a radius.

Definition at line 39 of file Cylinder3.hpp.

Member Function Documentation

bool contains ( Vector3 const &  p) const

Check if the cylinder contains a point.

Definition at line 73 of file Cylinder3.hpp.

AxisAlignedBox3 getBounds ( ) const

Get a bounding box for the cylinder.

Definition at line 80 of file Cylinder3.hpp.

Vector3 const& getDirection ( ) const

Get the unnormalized direction vector of the cylinder from the center of one end to the center of the other.

Definition at line 48 of file Cylinder3.hpp.

Vector3 getEndpoint ( int  i) const

Get the center of one capping disk of the cylinder: 0 returns the first endpoint and 1 returns the second.

Definition at line 45 of file Cylinder3.hpp.

Real getRadius ( ) const

Get the radius of the cylinder.

Definition at line 64 of file Cylinder3.hpp.

bool intersects ( Vector3 const &  p) const

Test if this cylinder intersects (contains) a point.

Definition at line 70 of file Cylinder3.hpp.

Real length ( ) const

Get the length of the cylinder.

Definition at line 51 of file Cylinder3.hpp.

virtual RayIntersectionN<N, T> rayIntersection ( RayN< N, T > const &  ray,
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
rayThe ray to test for intersection.
max_timeMaximum allowable hit time, ignored if negative.
Note
The returned normal need not have unit length.

Reimplemented in AxisAlignedBoxNBase< N, T >, AxisAlignedBoxNBase< 3, T >, BallN< N, T >, HyperplaneNBase< N, T >, HyperplaneNBase< N, Real >, HyperplaneNBase< 3, T >, BoxN< N, T >, and BoxN< 3, Real >.

Definition at line 102 of file RayIntersectableN.hpp.

virtual T rayIntersectionTime ( RayN< N, T > const &  ray,
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
rayThe ray to test for intersection.
max_timeMaximum allowable hit time, ignored if negative.

Implemented in AxisAlignedBoxNBase< N, T >, AxisAlignedBoxNBase< 3, T >, HyperplaneNBase< N, T >, HyperplaneNBase< N, Real >, HyperplaneNBase< 3, T >, BallN< N, T >, BoxN< N, T >, and BoxN< 3, Real >.

virtual bool rayIntersects ( RayN< N, T > const &  ray,
max_time = -1 
) const
virtualinherited

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

Parameters
rayThe ray to test for intersection.
max_timeMaximum allowable hit time, ignored if negative.

Reimplemented in AxisAlignedBoxNBase< N, T >, AxisAlignedBoxNBase< 3, T >, HyperplaneNBase< N, T >, HyperplaneNBase< N, Real >, HyperplaneNBase< 3, T >, BallN< N, T >, BoxN< N, T >, and BoxN< 3, Real >.

Definition at line 80 of file RayIntersectableN.hpp.

void setAxis ( Vector3 const &  begin_,
Vector3 const &  end_ 
)

Set the axis of the cylinder.

Definition at line 57 of file Cylinder3.hpp.

void setRadius ( Real  radius_)

Set the radius of the cylinder.

Definition at line 67 of file Cylinder3.hpp.

Real squaredLength ( ) const

Get the square of the length of the cylinder.

Definition at line 54 of file Cylinder3.hpp.

std::string toString ( ) const

Get a textual representation of the cylinder.

Definition at line 87 of file Cylinder3.hpp.


The documentation for this class was generated from the following file: