Core 1.0
Public Member Functions | Protected Attributes | List of all members
KTope Class Reference

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...
 
KTopeoperator+= (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ KTope() [1/2]

KTope::KTope ( const Vector v)
explicit

Creates a single vertex k-tope.

Parameters
vPoint.

◆ KTope() [2/2]

KTope::KTope ( const Box box)
explicit

Creates a cubic k-tope.

Parameters
boxThe box.

Member Function Documentation

◆ Inside()

bool KTope::Inside ( const Vector p) const

Check if a point is inside the KTope.

Parameters
pPoint.

◆ Intersect() [1/2]

bool KTope::Intersect ( const KTope k) const

Check if two k-topes intersect.

Parameters
kArgument k-tope.

◆ Intersect() [2/2]

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.

Parameters
rayThe ray.
tmin,tmaxIntersection depths.

◆ operator+()

KTope KTope::operator+ ( const KTope b) const

Computes the Minkowski sum of two k-topes structures.

Parameters
bArgument k-topes.

◆ operator+=()

KTope & KTope::operator+= ( const Vector p)

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.

Parameters
pPoint.

◆ Scale()

KTope KTope::Scale ( const double &  a) const

Scale a k-tope.

Parameters
aReal.