sch::CD_Pair Class Reference

#include <sch/CD/CD_Pair.h>

Collaboration diagram for sch::CD_Pair:

Public Member Functions

SCH_API CD_Pair (S_Object *Obj1, S_Object *Obj2)
 constructor \IMPORTANT: to create a CD::Pair, two CD::S_Objects must have been created before, these objects moust not be destroyed before this instance More...
 
virtual SCH_API ~CD_Pair (void)
 
SCH_API Scalar getClosestPoints (Point3 &p1, Point3 &p2)
 function that returns the distance SQUARED between two convex objects, and computes the witness points, the distance is set to negative if interpentration More...
 
SCH_API Scalar reComputeClosestPoints (Point3 &p1, Point3 &p2)
 function that returns the distance SQUARED between two convex objects, restarting the computations from the beginning and computes the witness points, the distance is set to negative if interpentration More...
 
SCH_API Scalar getDistance ()
 function that returns the distance SQUARED between two convex objects, the distance is set to negative if interpentration More...
 
SCH_API Scalar getDistanceWithoutPenetrationDepth ()
 function that returns the distance SQUARED between two convex objects, no interpenetration depth computations done the distance is set to zero in this case More...
 
SCH_API bool isInCollision ()
 returns if there is collision or not. If the distance is not already computed, it does not recompute, just returns the result. More...
 
SCH_API void setVector (const Vector3 &)
 Intializes the direction vector (the vector between expected closest points) with a given value. More...
 
const SCH_API Vector3getVector () const
 Gets the last direction vector (can be used to get a normal vector, especially when the distance is zero). This vector is likely NOT normalized. More...
 
SCH_API void setRelativePrecision (Scalar precision)
 sets the relative precision of the proximity queries to a given value. The effective precision is precision^2 . Default is precision=1e-3. More...
 
SCH_API void setEpsilon (Scalar)
 Sets the machine epsilon. Default is 1e-24. More...
 
SCH_API S_Objectoperator[] (unsigned char i)
 returns a pointer to the ith object in the pair More...
 

Protected Member Functions

Scalar GJK ()
 
Scalar penetrationDepth ()
 
void witPoints (Point3 &p1, Point3 &p2)
 

Protected Attributes

S_ObjectsObj1_
 
S_ObjectsObj2_
 
Vector3 lastDirection_
 
int lastFeature1_
 
int lastFeature2_
 
Point3 p1_
 
Point3 p2_
 
Scalar distance_
 
S_ObjectTimeStamp stamp1_
 
S_ObjectTimeStamp stamp2_
 
Scalar precision_
 
Scalar epsilon_
 
Scalar lambda0_
 
Scalar lambda1_
 
Scalar lambda2_
 
Scalar det_
 
bool projectionComputed_
 
bool collision_
 
bool witPointsAreComputed_
 
CD_Simplex s1_
 
CD_Simplex s2_
 
CD_Simplex s_
 
CD_SimplexEnhanced sp_
 
CD_Depth depthPair
 

Detailed Description

Examples
example0.cpp, and example1.cpp.

Constructor & Destructor Documentation

◆ CD_Pair()

SCH_API sch::CD_Pair::CD_Pair ( S_Object Obj1,
S_Object Obj2 
)

constructor \IMPORTANT: to create a CD::Pair, two CD::S_Objects must have been created before, these objects moust not be destroyed before this instance

Parameters
Obj1is a pointer to the first object
Obj1is a pointer to the second object

◆ ~CD_Pair()

virtual SCH_API sch::CD_Pair::~CD_Pair ( void  )
virtual

Member Function Documentation

◆ getClosestPoints()

SCH_API Scalar sch::CD_Pair::getClosestPoints ( Point3 p1,
Point3 p2 
)

function that returns the distance SQUARED between two convex objects, and computes the witness points, the distance is set to negative if interpentration

The witness points are on the surface of the objects with opposite normals. If there is a collision and the penetration depth computation is deactivated then the witness points will only reflect the last step of the distance computation algorithm. Otherwise the witness points are points each on the surface of the other, having opposite normals and being the closest each to the other. In any case the returned distance should be used to obtain the distance.

Parameters
p1is the witness point on the first object
p2is the witness point on the second object
Returns
the distance squared (set to negative when there is penetration)
Examples
example0.cpp.

◆ getDistance()

SCH_API Scalar sch::CD_Pair::getDistance ( )

function that returns the distance SQUARED between two convex objects, the distance is set to negative if interpentration

Examples
example0.cpp.

◆ getDistanceWithoutPenetrationDepth()

SCH_API Scalar sch::CD_Pair::getDistanceWithoutPenetrationDepth ( )

function that returns the distance SQUARED between two convex objects, no interpenetration depth computations done the distance is set to zero in this case

Examples
example0.cpp, and example1.cpp.

◆ getVector()

const SCH_API Vector3& sch::CD_Pair::getVector ( ) const

Gets the last direction vector (can be used to get a normal vector, especially when the distance is zero). This vector is likely NOT normalized.

◆ GJK()

Scalar sch::CD_Pair::GJK ( )
protected

◆ isInCollision()

SCH_API bool sch::CD_Pair::isInCollision ( )

returns if there is collision or not. If the distance is not already computed, it does not recompute, just returns the result.

Examples
example0.cpp.

◆ operator[]()

SCH_API S_Object* sch::CD_Pair::operator[] ( unsigned char  i)
inline

returns a pointer to the ith object in the pair

◆ penetrationDepth()

Scalar sch::CD_Pair::penetrationDepth ( )
protected

◆ reComputeClosestPoints()

SCH_API Scalar sch::CD_Pair::reComputeClosestPoints ( Point3 p1,
Point3 p2 
)

function that returns the distance SQUARED between two convex objects, restarting the computations from the beginning and computes the witness points, the distance is set to negative if interpentration

Parameters
p1is the witness point on the first object
p2is the witness point on the second object

◆ setEpsilon()

SCH_API void sch::CD_Pair::setEpsilon ( Scalar  )

Sets the machine epsilon. Default is 1e-24.

◆ setRelativePrecision()

SCH_API void sch::CD_Pair::setRelativePrecision ( Scalar  precision)

sets the relative precision of the proximity queries to a given value. The effective precision is precision^2 . Default is precision=1e-3.

◆ setVector()

SCH_API void sch::CD_Pair::setVector ( const Vector3 )

Intializes the direction vector (the vector between expected closest points) with a given value.

◆ witPoints()

void sch::CD_Pair::witPoints ( Point3 p1,
Point3 p2 
)
protected

Member Data Documentation

◆ collision_

bool sch::CD_Pair::collision_
protected

◆ depthPair

CD_Depth sch::CD_Pair::depthPair
protected

◆ det_

Scalar sch::CD_Pair::det_
protected

◆ distance_

Scalar sch::CD_Pair::distance_
protected

◆ epsilon_

Scalar sch::CD_Pair::epsilon_
protected

◆ lambda0_

Scalar sch::CD_Pair::lambda0_
protected

◆ lambda1_

Scalar sch::CD_Pair::lambda1_
protected

◆ lambda2_

Scalar sch::CD_Pair::lambda2_
protected

◆ lastDirection_

Vector3 sch::CD_Pair::lastDirection_
protected

◆ lastFeature1_

int sch::CD_Pair::lastFeature1_
protected

◆ lastFeature2_

int sch::CD_Pair::lastFeature2_
protected

◆ p1_

Point3 sch::CD_Pair::p1_
protected

◆ p2_

Point3 sch::CD_Pair::p2_
protected

◆ precision_

Scalar sch::CD_Pair::precision_
protected

◆ projectionComputed_

bool sch::CD_Pair::projectionComputed_
protected

◆ s1_

CD_Simplex sch::CD_Pair::s1_
protected

◆ s2_

CD_Simplex sch::CD_Pair::s2_
protected

◆ s_

CD_Simplex sch::CD_Pair::s_
protected

◆ sObj1_

S_Object* sch::CD_Pair::sObj1_
protected

◆ sObj2_

S_Object * sch::CD_Pair::sObj2_
protected

◆ sp_

CD_SimplexEnhanced sch::CD_Pair::sp_
protected

◆ stamp1_

S_ObjectTimeStamp sch::CD_Pair::stamp1_
protected

◆ stamp2_

S_ObjectTimeStamp sch::CD_Pair::stamp2_
protected

◆ witPointsAreComputed_

bool sch::CD_Pair::witPointsAreComputed_
protected

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