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

A solid 3D cone, whose base is a circular disk and apex is a point perpendicularly above the disk centre. More...

#include <Cone3.hpp>

Inheritance diagram for Cone3:
RayIntersectableN< N, T >

Public Member Functions

 Cone3 ()
 Default constructor. More...
 
 Cone3 (Vector3 const &base_center_, Vector3 const &apex_, Real base_radius_)
 Initialize with an axis (line segment from the center of the base to the apex) and a base radius. More...
 
bool contains (Vector3 const &p) const
 Check if the cone contains a point. More...
 
Vector3 getApex () const
 Get the apex point. More...
 
Vector3 getBaseCenter () const
 Get the center of the base disk. More...
 
Real getBaseRadius () const
 Get the base radius of the cone. More...
 
AxisAlignedBox3 getBounds () const
 Get a bounding box for the cone. More...
 
Vector3 const & getDirection () const
 Get the unnormalized direction vector of the cone from the center of the base to the apex. More...
 
bool intersects (Vector3 const &p) const
 Test if this cone intersects (contains) a point. More...
 
Real length () const
 Get the length of the cone. 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 &base_center_, Vector3 const &apex_)
 Set the axis of the cone (line from the center of the base to the apex). More...
 
void setBaseRadius (Real base_radius_)
 Set the base radius of the cone. More...
 
Real squaredLength () const
 Get the square of the length of the cone. More...
 
std::string toString () const
 Get a textual representation of the cone. More...
 

Detailed Description

A solid 3D cone, whose base is a circular disk and apex is a point perpendicularly above the disk centre.

Definition at line 30 of file Cone3.hpp.

Constructor & Destructor Documentation

Cone3 ( )

Default constructor.

Does not initialize anything.

Definition at line 36 of file Cone3.hpp.

Cone3 ( Vector3 const &  base_center_,
Vector3 const &  apex_,
Real  base_radius_ 
)

Initialize with an axis (line segment from the center of the base to the apex) and a base radius.

Definition at line 39 of file Cone3.hpp.

Member Function Documentation

bool contains ( Vector3 const &  p) const

Check if the cone contains a point.

Definition at line 77 of file Cone3.hpp.

Vector3 getApex ( ) const

Get the apex point.

Definition at line 49 of file Cone3.hpp.

Vector3 getBaseCenter ( ) const

Get the center of the base disk.

Definition at line 46 of file Cone3.hpp.

Real getBaseRadius ( ) const

Get the base radius of the cone.

Definition at line 68 of file Cone3.hpp.

AxisAlignedBox3 getBounds ( ) const

Get a bounding box for the cone.

Definition at line 84 of file Cone3.hpp.

Vector3 const& getDirection ( ) const

Get the unnormalized direction vector of the cone from the center of the base to the apex.

Definition at line 52 of file Cone3.hpp.

bool intersects ( Vector3 const &  p) const

Test if this cone intersects (contains) a point.

Definition at line 74 of file Cone3.hpp.

Real length ( ) const

Get the length of the cone.

Definition at line 55 of file Cone3.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 &  base_center_,
Vector3 const &  apex_ 
)

Set the axis of the cone (line from the center of the base to the apex).

Definition at line 61 of file Cone3.hpp.

void setBaseRadius ( Real  base_radius_)

Set the base radius of the cone.

Definition at line 71 of file Cone3.hpp.

Real squaredLength ( ) const

Get the square of the length of the cone.

Definition at line 58 of file Cone3.hpp.

std::string toString ( ) const

Get a textual representation of the cone.

Definition at line 91 of file Cone3.hpp.


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