Core 1.0
|
Convex polytopes with fixed normals, also referred to as k-topes. More...
#include <ktope.h>
Public Member Functions | |
KTope () | |
Empty. | |
KTope (const Vector &) | |
Creates a single vertex k-tope. More... | |
KTope (const Box &) | |
Creates a cubic k-tope. More... | |
KTope & | operator+= (const Vector &) |
Adds a vertex to the k-tope structure. More... | |
Vector | Normal (int) const |
Returns the i-th normal of the k-tope. | |
bool | Intersect (const Ray &, double &, double &) const |
Compute the intersection between a k-tope and a ray parametrized by its origin and direction vectors. Sorted intersection depths are returned if intersection occurs. More... | |
bool | Inside (const Vector &) const |
Check if a point is inside the KTope. More... | |
bool | Intersect (const KTope &) const |
Check if two k-topes intersect. More... | |
KTope | operator+ (const KTope &) const |
Computes the Minkowski sum of two k-topes structures. More... | |
KTope | Scale (const double &) const |
Scale a k-tope. More... | |
Protected Attributes | |
double | c [18] = { 0.0 } |
Array of constants defining the planes. | |
Convex polytopes with fixed normals, also referred to as k-topes.
This version implements a 18-polytope, which performs the fastest for a variety of applications. Refer to Klosowki, Efficient collision detection using bounding volumes hierarchies of k-dops, IEEE Transactions on Visualisation and Computer Graphics, 4(1), 1998.
The class stores the offset corresponding to the fixed normal directions.
This class implements some useful functions, such as the intersection between a k-tope and a ray.
|
explicit |
Creates a single vertex k-tope.
v | Point. |
|
explicit |
Creates a cubic k-tope.
box | The box. |
bool KTope::Inside | ( | const Vector & | p | ) | const |
Check if a point is inside the KTope.
p | Point. |
bool KTope::Intersect | ( | const KTope & | k | ) | const |
Check if two k-topes intersect.
k | Argument k-tope. |
bool KTope::Intersect | ( | const Ray & | ray, |
double & | tmin, | ||
double & | tmax | ||
) | const |
Compute the intersection between a k-tope and a ray parametrized by its origin and direction vectors. Sorted intersection depths are returned if intersection occurs.
ray | The ray. |
tmin,tmax | Intersection depths. |
Computes the Minkowski sum of two k-topes structures.
b | Argument k-topes. |
Adds a vertex to the k-tope structure.
This function does not modify the k-tope if the point lies inside the k-tope, otherwise plane coefficients are updated accordingly.
p | Point. |
KTope KTope::Scale | ( | const double & | a | ) | const |
Scale a k-tope.
a | Real. |