Package org.robwork.sdurw_proximity
Class DistanceCalculator
- java.lang.Object
-
- org.robwork.sdurw_proximity.DistanceCalculator
-
public class DistanceCalculator extends java.lang.Object
The DistanceCalculator implements an efficient way of calculating
different distances between two objects, each represented by a frame
A list of frame pairs is contained within the distance calculater,
that specifies which frames are to be checked against each other.
The method of used for distance calculation relies on the DistanceStrategy
chosen.
The DistanceCalculator supports switching between multiple strategies
-
-
Constructor Summary
Constructors Constructor Description DistanceCalculator(long cPtr, boolean cMemoryOwn)
DistanceCalculator(FramePairVector pairs, DistanceStrategyPtr strategy)
Constructs distance calculator for a selected set of frames
The list pairs specifies which frame-pairs to be used for distance checking.
strategy must be non-NULL.
Ownership of root is not taken.
DistanceCalculator(FramePtr root, WorkCellPtr workcell, DistanceStrategyPtr strategy, State initial_state)
Distance calculations for a given tree, collision setup and
primitive distance calculator.DistanceCalculator(WorkCellPtr workcell, DistanceStrategyPtr strategy)
Construct distance calculator for a WorkCell with an associated
distance calculator strategy.
The DistanceCalculator extracts information about the tree and the
CollisionSetup from workcell.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addDistanceModel(FramePtr frame, Geometry faces)
Adds distance model to frame
The distance model is constructed based on the list of faces given.
void
clearCache()
Clears the cache of the distance modelsvoid
delete()
DistanceStrategy.DistanceStrategyResult
distance(State state)
Calculates the distances between frames in the tree
DistanceStrategy.DistanceStrategyResult
distance(State state, FramePtr frame)
Calculates the distance between frame and the rest of the tree
DistanceStrategy.DistanceStrategyResult
distance(State state, FramePtr frame, DistanceStrategyResultVector result)
Calculates the distance between frame and the rest of the tree
DistanceStrategy.DistanceStrategyResult
distance(State state, DistanceStrategyResultVector result)
Calculates the distances between frames in the tree
DistanceStrategy.DistanceStrategyResult
distanceOMP(State state)
DistanceStrategy.DistanceStrategyResult
distanceOMP(State state, DistanceStrategyResultVector result)
double
getComputationTime()
int
getCount()
static long
getCPtr(DistanceCalculator obj)
void
resetComputationTimeAndCount()
void
setDistanceStrategy(DistanceStrategyPtr strategy)
Set the primitive distance calculator to strategy.
strategy must be non-NULL.
Ownership of the strategy is not taken.
-
-
-
Constructor Detail
-
DistanceCalculator
public DistanceCalculator(long cPtr, boolean cMemoryOwn)
-
DistanceCalculator
public DistanceCalculator(FramePtr root, WorkCellPtr workcell, DistanceStrategyPtr strategy, State initial_state)
Distance calculations for a given tree, collision setup and
primitive distance calculator. Uses proximity strategy given by the workcell.
strategy must be non-NULL.
root must be non-NULL.
Ownership of root is not taken.
- Parameters:
root
- [in] - the root of the Frame tree.
workcell
- [in] - the workcell to do the distance calculations in.
strategy
- [in] - the primitive strategy of distance calculations.
initial_state
- [in] - the work cell state to use for the
initial traversal of the tree.
-
DistanceCalculator
public DistanceCalculator(WorkCellPtr workcell, DistanceStrategyPtr strategy)
Construct distance calculator for a WorkCell with an associated
distance calculator strategy.
The DistanceCalculator extracts information about the tree and the
CollisionSetup from workcell.
- Parameters:
workcell
- [in] the workcell to checkstrategy
- [in] the distance calculation strategy to use
-
DistanceCalculator
public DistanceCalculator(FramePairVector pairs, DistanceStrategyPtr strategy)
Constructs distance calculator for a selected set of frames
The list pairs specifies which frame-pairs to be used for distance checking.
strategy must be non-NULL.
Ownership of root is not taken.
- Parameters:
pairs
- [in] Pairs of frame to checkstrategy
- [in] the distance calculation strategy to use
-
-
Method Detail
-
getCPtr
public static long getCPtr(DistanceCalculator obj)
-
delete
public void delete()
-
distance
public DistanceStrategy.DistanceStrategyResult distance(State state, DistanceStrategyResultVector result)
Calculates the distances between frames in the tree
- Parameters:
state
- [in] The state for which to calculate distances.
result
- [out] If non-NULL, the distance results are written
to result.
- Returns:
- the shortest distance between frame and frame tree
-
distance
public DistanceStrategy.DistanceStrategyResult distance(State state)
Calculates the distances between frames in the tree
- Parameters:
state
- [in] The state for which to calculate distances.
- Returns:
- the shortest distance between frame and frame tree
-
distanceOMP
public DistanceStrategy.DistanceStrategyResult distanceOMP(State state, DistanceStrategyResultVector result)
-
distanceOMP
public DistanceStrategy.DistanceStrategyResult distanceOMP(State state)
-
distance
public DistanceStrategy.DistanceStrategyResult distance(State state, FramePtr frame, DistanceStrategyResultVector result)
Calculates the distance between frame and the rest of the tree
- Parameters:
state
- [in] The state for which to calculate distances.
frame
- [in] The frame for which distances are to be calculated
result
- [out] If non-NULL, the distance results are written
to result.
- Returns:
- the shortest distance between frame and frame tree
-
distance
public DistanceStrategy.DistanceStrategyResult distance(State state, FramePtr frame)
Calculates the distance between frame and the rest of the tree
- Parameters:
state
- [in] The state for which to calculate distances.
frame
- [in] The frame for which distances are to be calculated
- Returns:
- the shortest distance between frame and frame tree
-
setDistanceStrategy
public void setDistanceStrategy(DistanceStrategyPtr strategy)
Set the primitive distance calculator to strategy.
strategy must be non-NULL.
Ownership of the strategy is not taken.
- Parameters:
strategy
- [in] - the primitive distance calculator to use.
-
addDistanceModel
public boolean addDistanceModel(FramePtr frame, Geometry faces)
Adds distance model to frame
The distance model is constructed based on the list of faces given.
- Parameters:
frame
- [in] frame to which the distance model should associatefaces
- [in] list of faces from which to construct the model- Returns:
- true if a distance model was succesfully created and linked
with the frame; false otherwise.
-
clearCache
public void clearCache()
Clears the cache of the distance models
-
getComputationTime
public double getComputationTime()
-
getCount
public int getCount()
-
resetComputationTimeAndCount
public void resetComputationTimeAndCount()
-
-