A solid 3D cone, whose base is a circular disk and apex is a point perpendicularly above the disk centre.
More...
|
| 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...
|
|
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.
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.
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, |
|
|
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. |
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, |
|
|
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. |
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.