Public Types | Public Member Functions | Public Attributes | List of all members
coal::details::MinkowskiDiff Struct Reference

Minkowski difference class of two shapes. More...

#include <minkowski_difference.h>

Public Types

typedef Eigen::Array< CoalScalar, 1, 2 > Array2d
 
typedef void(* GetSupportFunction) (const MinkowskiDiff &minkowskiDiff, const Vec3s &dir, Vec3s &support0, Vec3s &support1, support_func_guess_t &hint, ShapeSupportData data[2])
 

Public Member Functions

 MinkowskiDiff ()
 
template<int _SupportOptions = SupportOptions::NoSweptSphere>
void set (const ShapeBase *shape0, const ShapeBase *shape1)
 Set the two shapes, assuming the relative transformation between them is identity. Consequently, all support points computed with the MinkowskiDiff will be expressed in the world frame. More...
 
template<int _SupportOptions = SupportOptions::NoSweptSphere>
void set (const ShapeBase *shape0, const ShapeBase *shape1, const Transform3s &tf0, const Transform3s &tf1)
 Set the two shapes, with a relative transformation from shape0 to shape1. Consequently, all support points computed with the MinkowskiDiff will be expressed in the frame of shape0. More...
 
void support (const Vec3s &dir, Vec3s &supp0, Vec3s &supp1, support_func_guess_t &hint) const
 Support function for the pair of shapes. This method assumes set has already been called. More...
 
template<int _SupportOptions = SupportOptions::NoSweptSphere>
Vec3s support0 (const Vec3s &dir, int &hint) const
 support function for shape0. The output vector is expressed in the local frame of shape0. More...
 
template<int _SupportOptions = SupportOptions::NoSweptSphere>
Vec3s support1 (const Vec3s &dir, int &hint) const
 support function for shape1. The output vector is expressed in the local frame of shape0. This is mandatory because in the end we are interested in support points of the Minkowski difference; hence the supports of shape0 and shape1 must live in the same frame. More...
 

Public Attributes

ShapeSupportData data [2]
 Store temporary data for the computation of the support point for each shape. More...
 
GetSupportFunction getSupportFunc
 
bool normalize_support_direction
 Wether or not to use the normalize heuristic in the GJK Nesterov acceleration. This setting is only applied if the Nesterov acceleration in the GJK class is active. More...
 
Matrix3s oR1
 rotation from shape1 to shape0 such that $ p_in_0 = oR1 * p_in_1 + ot1 $. More...
 
Vec3s ot1
 translation from shape1 to shape0 such that $ p_in_0 = oR1 * p_in_1 + ot1 $. More...
 
const ShapeBaseshapes [2]
 points to two shapes More...
 
Array2d swept_sphere_radius
 The radii of the sphere swepted around each shape of the Minkowski difference. The 2 values correspond to the swept-sphere radius of shape 0 and shape 1. More...
 

Detailed Description

Minkowski difference class of two shapes.

Note
The Minkowski difference is expressed in the frame of the first shape.

Definition at line 53 of file coal/narrowphase/minkowski_difference.h.

Member Typedef Documentation

◆ Array2d

Definition at line 54 of file coal/narrowphase/minkowski_difference.h.

◆ GetSupportFunction

typedef void(* coal::details::MinkowskiDiff::GetSupportFunction) (const MinkowskiDiff &minkowskiDiff, const Vec3s &dir, Vec3s &support0, Vec3s &support1, support_func_guess_t &hint, ShapeSupportData data[2])

Definition at line 81 of file coal/narrowphase/minkowski_difference.h.

Constructor & Destructor Documentation

◆ MinkowskiDiff()

coal::details::MinkowskiDiff::MinkowskiDiff ( )
inline

Definition at line 88 of file coal/narrowphase/minkowski_difference.h.

Member Function Documentation

◆ set() [1/2]

template<int _SupportOptions>
void coal::details::MinkowskiDiff::set ( const ShapeBase shape0,
const ShapeBase shape1 
)

Set the two shapes, assuming the relative transformation between them is identity. Consequently, all support points computed with the MinkowskiDiff will be expressed in the world frame.

Parameters
shape0the first shape.
shape1the second shape.
Template Parameters
SupportOptionsis a value of the SupportOptions enum. If set to WithSweptSphere, the support computation will take into account the swept sphere radius of the shapes. If set to NoSweptSphere, where this information is simply stored in the Minkowski's difference swept_sphere_radius array. This array is then used to correct the solution found when GJK or EPA have converged.
Note
In practice, there is no need to take into account the swept-sphere radius in the iterations of GJK/EPA. It is in fact detrimental to the convergence of both algos. This is because it makes corners and edges of shapes look strictly convex to the algorithms, which leads to poor convergence. This swept sphere template parameter is only here for debugging purposes and for specific uses cases where the swept sphere radius is needed in the support function. The rule is simple. When interacting with GJK/EPA, the SupportOptions template parameter should always be set to NoSweptSphere (except for debugging or testing purposes). When working directly with the shapes involved in the collision, and not relying on GJK/EPA, the SupportOptions template parameter should be set to WithSweptSphere. This is for example the case for specialized collision/distance functions.

Definition at line 293 of file minkowski_difference.cpp.

◆ set() [2/2]

template<int _SupportOptions>
void coal::details::MinkowskiDiff::set ( const ShapeBase shape0,
const ShapeBase shape1,
const Transform3s tf0,
const Transform3s tf1 
)

Set the two shapes, with a relative transformation from shape0 to shape1. Consequently, all support points computed with the MinkowskiDiff will be expressed in the frame of shape0.

Parameters
shape0the first shape.
shape1the second shape.
tf0the transformation of the first shape.
tf1the transformation of the second shape.
Template Parameters
<tt>SupportOptions</tt>see set(const ShapeBase*, const ShapeBase*) for more details.

Definition at line 269 of file minkowski_difference.cpp.

◆ support()

void coal::details::MinkowskiDiff::support ( const Vec3s dir,
Vec3s supp0,
Vec3s supp1,
support_func_guess_t hint 
) const
inline

Support function for the pair of shapes. This method assumes set has already been called.

Parameters
[in]dirthe support direction.
[out]supp0support of shape0 in direction dir, expressed in the frame of shape0.
[out]supp1support of shape1 in direction -dir, expressed in the frame of shape0.
[in/out]hint used to initialize the search when shape is a ConvexBase object.

Definition at line 174 of file coal/narrowphase/minkowski_difference.h.

◆ support0()

template<int _SupportOptions = SupportOptions::NoSweptSphere>
Vec3s coal::details::MinkowskiDiff::support0 ( const Vec3s dir,
int &  hint 
) const
inline

support function for shape0. The output vector is expressed in the local frame of shape0.

Returns
a point which belongs to the set {argmax_{v in shape0} v.dot(dir)}, i.e a support of shape0 in direction dir.
Parameters
dirsupport direction.
hintused to initialize the search when shape is a ConvexBase object.
Template Parameters
<tt>SupportOptions</tt>see set(const ShapeBase*, const ShapeBase*) for more details.

Definition at line 142 of file coal/narrowphase/minkowski_difference.h.

◆ support1()

template<int _SupportOptions = SupportOptions::NoSweptSphere>
Vec3s coal::details::MinkowskiDiff::support1 ( const Vec3s dir,
int &  hint 
) const
inline

support function for shape1. The output vector is expressed in the local frame of shape0. This is mandatory because in the end we are interested in support points of the Minkowski difference; hence the supports of shape0 and shape1 must live in the same frame.

Returns
a point which belongs to the set {tf * argmax_{v in shape1} v.dot(R^T * dir)}, i.e. the support of shape1 in direction dir (tf is the tranform from shape1 to shape0).
Parameters
dirsupport direction.
hintused to initialize the search when shape is a ConvexBase.
Template Parameters
<tt>SupportOptions</tt>see set(const ShapeBase*, const ShapeBase*) for more details.

Definition at line 159 of file coal/narrowphase/minkowski_difference.h.

Member Data Documentation

◆ data

ShapeSupportData coal::details::MinkowskiDiff::data[2]

Store temporary data for the computation of the support point for each shape.

Definition at line 61 of file coal/narrowphase/minkowski_difference.h.

◆ getSupportFunc

GetSupportFunction coal::details::MinkowskiDiff::getSupportFunc

Definition at line 86 of file coal/narrowphase/minkowski_difference.h.

◆ normalize_support_direction

bool coal::details::MinkowskiDiff::normalize_support_direction

Wether or not to use the normalize heuristic in the GJK Nesterov acceleration. This setting is only applied if the Nesterov acceleration in the GJK class is active.

Definition at line 79 of file coal/narrowphase/minkowski_difference.h.

◆ oR1

Matrix3s coal::details::MinkowskiDiff::oR1

rotation from shape1 to shape0 such that $ p_in_0 = oR1 * p_in_1 + ot1 $.

Definition at line 65 of file coal/narrowphase/minkowski_difference.h.

◆ ot1

Vec3s coal::details::MinkowskiDiff::ot1

translation from shape1 to shape0 such that $ p_in_0 = oR1 * p_in_1 + ot1 $.

Definition at line 69 of file coal/narrowphase/minkowski_difference.h.

◆ shapes

const ShapeBase* coal::details::MinkowskiDiff::shapes[2]

points to two shapes

Definition at line 57 of file coal/narrowphase/minkowski_difference.h.

◆ swept_sphere_radius

Array2d coal::details::MinkowskiDiff::swept_sphere_radius

The radii of the sphere swepted around each shape of the Minkowski difference. The 2 values correspond to the swept-sphere radius of shape 0 and shape 1.

Definition at line 74 of file coal/narrowphase/minkowski_difference.h.


The documentation for this struct was generated from the following files:


hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:45:00