-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2057 from mwoehlke-kitware/split-result-collector
Separate ResultCollector base
- Loading branch information
Showing
5 changed files
with
51 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "drake/systems/plants/collision/ResultCollector.h" | ||
|
||
#include "drake/systems/plants/collision/DrakeCollision.h" | ||
|
||
namespace DrakeCollision { | ||
void ResultCollector::addPointPairResult(const PointPair& result) { | ||
pts.push_back(result); | ||
} | ||
|
||
PointPair ResultCollector::minDistPoint() const { | ||
return *std::min_element(pts.begin(), pts.end()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef DRAKE_SYSTEMS_PLANTS_COLLISION_RESULTCOLLECTOR_H_ | ||
#define DRAKE_SYSTEMS_PLANTS_COLLISION_RESULTCOLLECTOR_H_ | ||
|
||
#include "drake/systems/plants/collision/DrakeCollision.h" | ||
|
||
namespace DrakeCollision { | ||
class ResultCollector { | ||
public: | ||
virtual ~ResultCollector() {} | ||
|
||
virtual void addPointPairResult(const PointPair& result); | ||
|
||
inline void addSingleResult(const ElementId idA, const ElementId idB, | ||
const Eigen::Vector3d& ptA, | ||
const Eigen::Vector3d& ptB, | ||
const Eigen::Vector3d& normal, | ||
const double distance) { | ||
addPointPairResult(PointPair(idA, idB, ptA, ptB, normal, distance)); | ||
} | ||
|
||
std::vector<PointPair> getResults() const { return pts; } | ||
|
||
PointPair minDistPoint() const; | ||
|
||
std::vector<PointPair> pts; | ||
}; | ||
|
||
typedef std::shared_ptr<ResultCollector> ResultCollShPtr; | ||
} | ||
|
||
#endif // DRAKE_SYSTEMS_PLANTS_COLLISION_RESULTCOLLECTOR_H_ |