Commit 13d85602 authored by Akseppal's avatar Akseppal
Browse files

remove useless function and add neighbouringTriangleMargin as member of OperationBase class

parent 5935307c
......@@ -173,10 +173,7 @@ namespace hpp {
std::vector<CollisionObjects_t> getAffordanceObjects
(const SemanticsDataPtr_t& sData);
/// Free helper function that creates a vector of operation objects.
OperationBases_t createOperations ();
/// \}
/// \}
} // namespace affordance
} // namespace hpp
......
......@@ -36,16 +36,19 @@ namespace hpp {
/// affordance type called "noAffordance" is created as default,
/// with certain default values for its member variables. This
/// constructor should not be used..!
OperationBase (): zWorld_(0,0,1), margin_(0.3), minArea_(0.05),
affordance_("noAffordance") {}
OperationBase (): zWorld_(0,0,1), margin_(0.3), neighbouringTriangleMargin_(0.3),
minArea_(0.05), affordance_("noAffordance") {}
/// Constructor that allows for user-defined parameters. Default values are given for
/// parameters that are not defined by the user.
/// \param margin Margin needed for the evaluation of the requirement function
/// \param minArea Minimum area needed for the formation of an affordance object
/// \param affordanceName The name of the affordance type
explicit OperationBase (const double margin = 0.3, const double minArea = 0.05,
const char* affordanceName = "noAffordance"): zWorld_(0,0,1),
margin_(margin), minArea_(minArea), affordance_(affordanceName) {}
explicit OperationBase (const double margin = 0.3, const double nbTriMargin = 0.3,
const double minArea = 0.05,
const char* affordanceName = "noAffordance"):
zWorld_(0,0,1), margin_(margin),
neighbouringTriangleMargin_(nbTriMargin),
minArea_(minArea), affordance_(affordanceName) {}
/// Fully virtual function that will determine whether or not a given
/// triangle normal fullfils the requirement of a child class. If yes,
/// the tested triangle forms part of a potential affordance.
......@@ -55,6 +58,9 @@ namespace hpp {
const fcl::Vec3f zWorld_;
/// The error margin within which the requirement function must be fullfilled.
const double margin_;
/// The margin for the deviation of the normal of neighbouring triangles.
/// Used to determine affordance objects comprising more than one triangle.
const double neighbouringTriangleMargin_;
/// The minimum area required for an affordance object. The total area may
/// comprise multiple triangles.
const double minArea_;
......@@ -70,9 +76,10 @@ namespace hpp {
/// \param margin Margin needed for the evaluation of the requirement function
/// \param minArea Minimum area needed for the formation of an affordance object
/// \param affordanceName The name of the affordance type
explicit SupportOperation (const double margin = 0.3, const double minArea = 0.05,
explicit SupportOperation (const double margin = 0.3, const double nbTriMargin = 0.3,
const double minArea = 0.05,
const char* affordanceName = "Support"):
OperationBase(margin, minArea, affordanceName) {}
OperationBase(margin, nbTriMargin, minArea, affordanceName) {}
/// The implementation of the requirement function for Support affordances
/// overrides the virtual function in class OperationBase.
/// \param nromal Normal vector of the tested triangle.
......@@ -90,9 +97,10 @@ namespace hpp {
/// \param margin Margin needed for the evaluation of the requirement function
/// \param minArea Minimum area needed for the formation of an affordance object
/// \param affordanceName The name of the affordance type
explicit LeanOperation (const double margin = 0.3, const double minArea = 0.05,
explicit LeanOperation (const double margin = 0.3, const double nbTriMargin = 0.3,
const double minArea = 0.05,
const char* affordanceName = "Lean"):
OperationBase(margin, minArea, affordanceName) {}
OperationBase(margin, nbTriMargin, minArea, affordanceName) {}
/// The implementation of the requirement function for Lean affordances
/// overrides the virtual function in class OperationBase.
/// \param nromal Normal vector of the tested triangle.
......
......@@ -62,7 +62,7 @@ namespace hpp {
|| (refPoints[vertIdx] - searchTri.points.p2).sqrLength () < margin
|| (refPoints[vertIdx] - searchTri.points.p3).sqrLength () < margin) {
if (refOp->requirement (searchTri.normal)) {
if ((searchTri.normal - refTri.normal).sqrLength () < marginRad) {
if ((searchTri.normal - refTri.normal).sqrLength () < refOp->neighbouringTriangleMargin_) {
area += searchTri.area;
listPotential.push_back (searchIdx);
searchLinkedTriangles (listPotential, refOp, allTris,
......@@ -203,18 +203,6 @@ namespace hpp {
return affObjs;
}
OperationBases_t createOperations ()
{
affordance::SupportOperationPtr_t support (new affordance::SupportOperation());
affordance::LeanOperationPtr_t lean (new affordance::LeanOperation(0.1));
affordance::OperationBases_t operations;
operations.push_back(support);
operations.push_back(lean);
return operations;
}
} // namespace affordance
} // namespace hpp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment