Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::DistanceResults Class Reference

#include <DistanceResults.hpp>

List of all members.

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 Vector3WitnessPoint (InnerMapIterator iter) const
bool GetWitnessPoint (const Primitive *const locatedOn, const Primitive *const closestTo, Vector3 &wit) const
const Vector3vecDhat () 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)
MatrixcontainsHFunction (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


Member Typedef Documentation

typedef std::map<const Primitive*, vector<double> > OSCAR::DistanceResults::InnerGMap
 

typedef std::map<const Primitive*, Matrix*> OSCAR::DistanceResults::InnerHMap
 

typedef std::map<const Primitive*, std::pair<Vector3, int> > OSCAR::DistanceResults::InnerMap
 

typedef InnerMap::const_iterator OSCAR::DistanceResults::InnerMapIterator
 

typedef std::map<const Primitive*, InnerGMap> OSCAR::DistanceResults::OuterGMap
 

typedef std::map<const Primitive*, InnerHMap> OSCAR::DistanceResults::OuterHMap
 

typedef std::map<const Primitive*, InnerMap> OSCAR::DistanceResults::OuterMap
 


Constructor & Destructor Documentation

OSCAR::DistanceResults::DistanceResults  
 

OSCAR::DistanceResults::~DistanceResults  
 

Destructor for the DistanceResults object.


Member Function Documentation

bool OSCAR::DistanceResults::CalculateForce const Primitive *const    p0,
const Primitive *const    p1,
const ArtificialPotentialF   func
 

Calculate the artificial force between two primitives.

Parameters:
p0 The first object in the pair
p1 The second object in the pair
func The function which will map the distance between the primitives to a force
Returns:
true if successful, false otherwise (i.e. a distance between p0 and p1 doesn't exist

bool OSCAR::DistanceResults::CalculateForceD1 const Primitive *const    p0,
const Primitive *const    p1,
const ArtificialPotentialF   func
 

Calculate the first derivative of the artificial force between two primitives.

Parameters:
p0 The first object in the pair
p1 The second object in the pair
func The function which will map the distance between the primitives to a force
Returns:
true if successful, false otherwise (i.e. a distance between p0 and p1 doesn't exist

void OSCAR::DistanceResults::Clear  
 

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);
        

bool OSCAR::DistanceResults::contains const Primitive   prim1,
const Primitive   prim2,
int &    index
[private]
 

bool OSCAR::DistanceResults::Contains const Primitive *const    thisObject const
 

Reports whether or not distances have been calculated for an object.

Parameters:
thisPrimitive The primitive whose membership is to be tested
Returns:
bool True if the Primitive has distances computed for it, false otherwise

Matrix* OSCAR::DistanceResults::containsHFunction const Primitive   from,
const Primitive   to
[private]
 

const Vector3vec& OSCAR::DistanceResults::Dhat   const
 

Returns a const reference to the std::vector<Vector3> containing the minimum distance vectors for read only access.

Returns:
Const reference to the std::vector<Vector3> containing the minimum distance vectors

Vector3 OSCAR::DistanceResults::Dhat InnerMapIterator    iter const
 

Returns the minimum distance unit vector between the pair of objects located by the iterator returned by LocatePair method.

Parameters:
iter The iterator returned by LocatePair method used to return the distance.
Returns:
The minimum distance unit vector between the pair of objects located by iter.

double OSCAR::DistanceResults::Distance InnerMapIterator    iter const
 

Returns the calculated distance between the pair of objects located by the iterator returned by LocatePair method.

Parameters:
iter The iterator returned by LocatePair method used to return the distance.
Returns:
The distance between the pair of objects located by iter.

bool OSCAR::DistanceResults::Distance const Primitive *const    p0,
const Primitive *const    p1,
double &    distance
const
 

Returns the calculated distance betwee two objects.

Parameters:
p0 The first object in the pair.
p1 The second object in the pair.
distance The distance between the pair of objects.
Returns:
true if successful (i.e. both p0 and p1 are contained within this DistanceResults) or false otherwise.

bool OSCAR::DistanceResults::GetForce const Primitive *const    p0,
const Primitive *const    p1,
double &    force
const
 

Retrieve the calculated artificial force between two primitives.

Parameters:
p0 The first object in the pair
p1 The second object in the pair
force Where the force will be stored
Returns:
true if successful, false otherwise (i.e. entries between p0 and p1 don't exist

bool OSCAR::DistanceResults::GetForceD1 const Primitive *const    p0,
const Primitive *const    p1,
double &    forceD1
const
 

Retrieve the calculated derivative of the artificial force between two primitives.

Parameters:
p0 The first object in the pair
p1 The second object in the pair
forceD1 Where the force derivative will be stored
Returns:
true if successful, false otherwise (i.e. entries between p0 and p1 don't exist

bool OSCAR::DistanceResults::GetGFunctions const Primitive   from,
const Primitive   to,
const vector< double > *&    gFunctions
const
 

Retrieve the vector of g functions for the distance between two primitives.

Parameters:
const Primitive* from The primitive in the maniuplator for which to get the g functions.
const Primitive* to The primitive in the environment for which to get the g functions.
const vector<double>*& A pointer to a vector of doubles. When the function is done the pointer will point to the g functions.
Returns:
True upon completion, false if there is an error (no g function information stored for the two primitives, etc.)

bool OSCAR::DistanceResults::GetHFunctions const Primitive   from,
const Primitive   to,
const Matrix   hFunctions
 

Retrieve the vector of h functions for the distance between two primitives.

Parameters:
const Primitive* from The primitive in the maniuplator for which to get the h functions.
const Primitive* to The primitive in the environment for which to get the h functions.
const Matrix* A pointer to a matrix. When the function is done the pointer will point to the h functions.
Returns:
True upon completion, false if there is an error (no h function information stored for the two primitives, etc.)

bool OSCAR::DistanceResults::GetWitnessPoint const Primitive *const    locatedOn,
const Primitive *const    closestTo,
Vector3   wit
const
 

Returns the winess point on an object.

Parameters:
locatedOn Requesting the location of the witness point on this object
closestTo The witness point is the closest point to the object 'closestTo'
wit The witness point on the surface of locatedOn
Returns:
true if successful (i.e. both locatedOn and closestTo are contained within this DistanceResults) or false otherwise.

bool OSCAR::DistanceResults::LocateDHat const Primitive *const    from,
const Primitive *const    to,
int &    index
const
 

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;                        }               
.

Parameters:
from The object from which the vector points.
to The object to which the vector points.
index Upon function return, index will contain the index of minimum distance unit vector. Negative if stored vector is opposite the desired direction.
Returns:
true if successful (i.e. both from and to are contained within this DistanceResults) or false otherwise.

bool OSCAR::DistanceResults::LocatePair const Primitive *const    from,
const Primitive *const    to,
InnerMapIterator   iter
const
 

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);                       }               
.

Parameters:
from The object from which the unit vector points or the object on which the witness point is located
to The object to which the unit vector points.
iter Upon function return, iter will contain the iterator that can be used to access the distance, the minimum distance unit vector, and the witness point between the two primitives.
Returns:
true if successful (i.e. both from and to are contained within this DistanceResults) or false otherwise.

bool OSCAR::DistanceResults::setHFunctions const Primitive   to,
const Primitive   from,
Matrix   hFunctions
[private]
 

const Vector3& OSCAR::DistanceResults::WitnessPoint InnerMapIterator    iter const
 

Returns the witness point between the pair of objects located by the iterator returned by LocatePair method.

Parameters:
iter The iterator returned by LocatePair method used to return the distance.
Returns:
The witness point between the pair of objects located by iter.


Friends And Related Function Documentation

friend class DistanceCalculator [friend]
 


Member Data Documentation

Vector3vec OSCAR::DistanceResults::dHats [private]
 

std::vector<double> OSCAR::DistanceResults::distances [private]
 

std::vector<double> OSCAR::DistanceResults::forces [private]
 

std::vector<double> OSCAR::DistanceResults::forcesD1 [private]
 

OuterGMap OSCAR::DistanceResults::gFuncs [private]
 

OuterHMap OSCAR::DistanceResults::hFuncs [private]
 

OuterMap OSCAR::DistanceResults::results [private]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations