#include <DistanceResults.hpp>
Public Types | |
| typedef std::map< const Primitive *, std::pair< Vector3, int > > | InnerMap |
| typedef std::map< const Primitive *, InnerMap > | OuterMap |
| typedef std::map< const Primitive *, vector< double > > | InnerGMap |
| typedef std::map< const Primitive *, InnerGMap > | OuterGMap |
| typedef std::map< const Primitive *, Matrix * > | InnerHMap |
| typedef std::map< const Primitive *, InnerHMap > | OuterHMap |
| typedef InnerMap::const_iterator | InnerMapIterator |
Public Methods | |
| DistanceResults () | |
| bool | LocateDHat (const Primitive *const from, const Primitive *const to, int &index) const |
| bool | LocatePair (const Primitive *const from, const Primitive *const to, InnerMapIterator &iter) const |
| bool | Distance (const Primitive *const p0, const Primitive *const p1, double &distance) const |
| bool | CalculateForce (const Primitive *const p0, const Primitive *const p1, const ArtificialPotentialF &func) |
| bool | GetForce (const Primitive *const p0, const Primitive *const p1, double &force) const |
| double | Distance (InnerMapIterator iter) const |
| bool | CalculateForceD1 (const Primitive *const p0, const Primitive *const p1, const ArtificialPotentialF &func) |
| bool | GetForceD1 (const Primitive *const p0, const Primitive *const p1, double &forceD1) const |
| Vector3 | Dhat (InnerMapIterator iter) const |
| const Vector3 & | WitnessPoint (InnerMapIterator iter) const |
| bool | GetWitnessPoint (const Primitive *const locatedOn, const Primitive *const closestTo, Vector3 &wit) const |
| const Vector3vec & | Dhat () const |
| bool | Contains (const Primitive *const thisObject) const |
| ~DistanceResults () | |
| void | Clear () |
| bool | GetGFunctions (const Primitive *from, const Primitive *to, const vector< double > *&gFunctions) const |
| bool | GetHFunctions (const Primitive *from, const Primitive *to, const Matrix *hFunctions) |
Private Methods | |
| bool | contains (const Primitive *prim1, const Primitive *prim2, int &index) |
| bool | setHFunctions (const Primitive *to, const Primitive *from, Matrix *hFunctions) |
| Matrix * | containsHFunction (const Primitive *from, const Primitive *to) |
Private Attributes | |
| Vector3vec | dHats |
| std::vector< double > | distances |
| std::vector< double > | forces |
| std::vector< double > | forcesD1 |
| OuterMap | results |
| OuterGMap | gFuncs |
| OuterHMap | hFuncs |
Friends | |
| class | DistanceCalculator |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Destructor for the DistanceResults object.
|
|
||||||||||||||||
|
Calculate the artificial force between two primitives.
|
|
||||||||||||||||
|
Calculate the first derivative of the artificial force between two primitives.
|
|
|
Clear the distance results. Must be called before reusing this DistanceResults in DistanceCalculator::CalcDist() function. Example:
Sphere *sphere = new Sphere(Vector3(0,-5,10),1);
Cylisphere *cyl = new Cylisphere(Vector3(0,0,20),Vector3(0,0,10),1);
Plane *plane = new Plane(Vector3(5,5,0),Vector3(-5,5,0),Vector3(5,-5,0),1);
Node node1, node2, node3;
node1.Add(sphere);
node2.Add(cyl);
node3.Add(plane);
Primitive *p_sphere, *p_cyl, *p_plane;
p_sphere = *(node1.GetPrimitives().begin());
p_cyl = *(node2.GetPrimitives().begin());
p_plane = *(node3.GetPrimitives().begin());
double distance;
Vector3 wit1;
DistanceResults results;
// distance between sphere and cylisphere
calculator.CalcDist(node1, node2, results);
results.Distance(p_sphere, p_cyl, distance);
// distance between sphere and cylisphere
results.Clear(); // clear the distance results
calculator.CalcDist(node1, node3, results);
results.Distance(p_sphere, p_plane, distance);
|
|
||||||||||||||||
|
|
|
|
Reports whether or not distances have been calculated for an object.
|
|
||||||||||||
|
|
|
|
Returns a const reference to the std::vector<Vector3> containing the minimum distance vectors for read only access.
|
|
|
Returns the minimum distance unit vector between the pair of objects located by the iterator returned by LocatePair method.
|
|
|
Returns the calculated distance between the pair of objects located by the iterator returned by LocatePair method.
|
|
||||||||||||||||
|
Returns the calculated distance betwee two objects.
|
|
||||||||||||||||
|
Retrieve the calculated artificial force between two primitives.
|
|
||||||||||||||||
|
Retrieve the calculated derivative of the artificial force between two primitives.
|
|
||||||||||||||||
|
Retrieve the vector of g functions for the distance between two primitives.
|
|
||||||||||||||||
|
Retrieve the vector of h functions for the distance between two primitives.
|
|
||||||||||||||||
|
Returns the winess point on an object.
|
|
||||||||||||||||
|
Finds the index of the minimum distance unit vector Use this function to find the index of the minimum distance unit vector which points from 'from' to 'to'. Only one vector is stored for (a,b) and (b,a) for efficiency. If the index is negative, the min. dist. vector stored here must be multiplied by -1. Use the absolute value of the return value to index into Dhat(). Example: int tempIndex; if(results.LocateDHat(robot0,sphereInRoom, tempIndex)) { Vector3 myDhat; myDhat = results.Dhat[abs(tempIndex)]; double distance = results.Distance(abs(tempIndex)); if (tempIndex < 0) myDhat *= -1; }
|
|
||||||||||||||||
|
Finds the iterator in the data structure of DistanceResults that relate two primitives. The iterator can then be used to access the distance, the unit vector, and the witness point between these two primitives. Example: InnerMapIterator iter if(results.LocatePair(robot0,sphereInRoom, iter)) { Vector3 dHat = results.Dhat(iter); double distance = results.Distance(iter); Vector3 wit = results.WitnessPoint(iter); }
|
|
||||||||||||||||
|
|
|
|
Returns the witness point between the pair of objects located by the iterator returned by LocatePair method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| RRG Homepage | OSCAR Overview | OSCAR Tutorials | Simulations |