From 605b189ff0d104ebe5c6da96fbfabebb3cfcf7bf Mon Sep 17 00:00:00 2001 From: lamriaimen Date: Tue, 23 Apr 2024 14:03:08 +0200 Subject: [PATCH 1/9] [Collision.Detection.Intersection] Rename Data --- .../BaseProximityIntersection.cpp | 11 +-- .../intersection/BaseProximityIntersection.h | 19 ++++-- .../intersection/LocalMinDistance.cpp | 68 ++++++++++--------- .../detection/intersection/LocalMinDistance.h | 21 ++++-- .../MeshMinProximityIntersection.cpp | 8 +-- .../MeshNewProximityIntersection.cpp | 4 +- .../intersection/MinProximityIntersection.cpp | 18 +++-- .../intersection/MinProximityIntersection.h | 43 ++++++++---- .../intersection/NewProximityIntersection.cpp | 3 +- .../intersection/NewProximityIntersection.h | 4 +- .../detection/intersection/config.h.in | 8 +++ 11 files changed, 135 insertions(+), 72 deletions(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp index bb648d71fed..efc48d04a1e 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp @@ -27,11 +27,14 @@ namespace sofa::component::collision::detection::intersection using namespace sofa::component::collision::geometry; BaseProximityIntersection::BaseProximityIntersection() - : alarmDistance(initData(&alarmDistance, 1.0_sreal, "alarmDistance","Proximity detection distance")) - , contactDistance(initData(&contactDistance, 0.5_sreal, "contactDistance","Distance below which a contact is created")) + : d_alarmDistance(initData(&d_alarmDistance, 1.0_sreal, "alarmDistance", "Proximity detection distance")) + , d_contactDistance(initData(&d_contactDistance, 0.5_sreal, "contactDistance", "Distance below which a contact is created")) { - alarmDistance.setRequired(true); - contactDistance.setRequired(true); + d_alarmDistance.setRequired(true); + d_contactDistance.setRequired(true); + + alarmDistance.setParent(&d_alarmDistance); + contactDistance.setParent(&d_contactDistance); } diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.h index 1e0c84317b3..7ab93bbc6c9 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.h @@ -37,8 +37,15 @@ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API BaseProximityIntersect { public: SOFA_ABSTRACT_CLASS(BaseProximityIntersection,DiscreteIntersection); - Data alarmDistance; ///< Proximity detection distance - Data contactDistance; ///< Distance below which a contact is created + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data alarmDistance; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data contactDistance; + + + Data d_alarmDistance; ///< Proximity detection distance + Data d_contactDistance; ///< Distance below which a contact is created protected: BaseProximityIntersection(); ~BaseProximityIntersection() override { } @@ -47,16 +54,16 @@ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API BaseProximityIntersect bool useProximity() const override { return true; } /// Returns the alarm distance (must returns 0 if useProximity() is false) - SReal getAlarmDistance() const override { return alarmDistance.getValue(); } + SReal getAlarmDistance() const override { return d_alarmDistance.getValue(); } /// Returns the contact distance (must returns 0 if useProximity() is false) - SReal getContactDistance() const override { return contactDistance.getValue(); } + SReal getContactDistance() const override { return d_contactDistance.getValue(); } /// Sets the alarm distance (if useProximity() is false, the alarm distance is equal to 0) - void setAlarmDistance(SReal v) override { alarmDistance.setValue(v); } + void setAlarmDistance(SReal v) override { d_alarmDistance.setValue(v); } /// Sets the contact distance (if useProximity() is false, the contact distance is equal to 0) - void setContactDistance(SReal v) override { contactDistance.setValue(v); } + void setContactDistance(SReal v) override { d_contactDistance.setValue(v); } /// Intersectors for cubes using proximities bool testIntersection(collision::geometry::Cube& cube1, collision::geometry::Cube& cube2, const core::collision::Intersection* currentIntersection) override; diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.cpp index a02b1a9926a..d17d4c0f095 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.cpp @@ -52,11 +52,17 @@ int LocalMinDistanceClass = core::RegisterObject("A set of methods to compute (f LocalMinDistance::LocalMinDistance() : BaseProximityIntersection() - , filterIntersection(initData(&filterIntersection, true, "filterIntersection","Activate LMD filter")) - , angleCone(initData(&angleCone, 0.0, "angleCone","Filtering cone extension angle")) - , coneFactor(initData(&coneFactor, 0.5, "coneFactor", "Factor for filtering cone angle computation")) - , useLMDFilters(initData(&useLMDFilters, false, "useLMDFilters", "Use external cone computation (Work in Progress)")) + , d_filterIntersection(initData(&d_filterIntersection, true, "filterIntersection", "Activate LMD filter")) + , d_angleCone(initData(&d_angleCone, 0.0, "angleCone", "Filtering cone extension angle")) + , d_coneFactor(initData(&d_coneFactor, 0.5, "coneFactor", "Factor for filtering cone angle computation")) + , d_useLMDFilters(initData(&d_useLMDFilters, false, "useLMDFilters", "Use external cone computation (Work in Progress)")) { + filterIntersection.setParent(&d_filterIntersection); + angleCone.setParent(&d_angleCone); + coneFactor.setParent(&d_coneFactor); + useLMDFilters.setParent(&d_useLMDFilters); + + } void LocalMinDistance::init() @@ -142,7 +148,7 @@ bool LocalMinDistance::testIntersection(Line& e1, Line& e2, const core::collisio { // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -221,7 +227,7 @@ int LocalMinDistance::computeIntersection(Line& e1, Line& e2, OutputVector* cont // filter for LMD // - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) { @@ -321,7 +327,7 @@ bool LocalMinDistance::testIntersection(Triangle& e2, Point& e1, const core::col if (PQ.norm2() < alarmDist*alarmDist) { //filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -382,7 +388,7 @@ int LocalMinDistance::computeIntersection(Triangle& e2, Point& e1, OutputVector* // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -475,7 +481,7 @@ bool LocalMinDistance::testIntersection(Triangle& e2, Sphere& e1, const core::co //filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -536,7 +542,7 @@ int LocalMinDistance::computeIntersection(Triangle& e2, Sphere& e1, OutputVector // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -605,7 +611,7 @@ bool LocalMinDistance::testIntersection(Line& e2, Point& e1, const core::collisi { // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -658,7 +664,7 @@ int LocalMinDistance::computeIntersection(Line& e2, Point& e1, OutputVector* con const auto QP = -PQ; // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -723,7 +729,7 @@ bool LocalMinDistance::testIntersection(Line& e2, Sphere& e1, const core::collis { // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -772,7 +778,7 @@ int LocalMinDistance::computeIntersection(Line& e2, Sphere& e1, OutputVector* co return 0; // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -826,7 +832,7 @@ bool LocalMinDistance::testIntersection(Point& e1, Point& e2, const core::collis { // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -861,7 +867,7 @@ int LocalMinDistance::computeIntersection(Point& e1, Point& e2, OutputVector* co // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -913,7 +919,7 @@ bool LocalMinDistance::testIntersection(Sphere& e1, Point& e2, const core::colli { // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -946,7 +952,7 @@ int LocalMinDistance::computeIntersection(Sphere& e1, Point& e2, OutputVector* c // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -996,7 +1002,7 @@ bool LocalMinDistance::testIntersection(Sphere& e1, Sphere& e2, const core::coll { // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return false; @@ -1028,7 +1034,7 @@ int LocalMinDistance::computeIntersection(Sphere& e1, Sphere& e2, OutputVector* // filter for LMD - if (!useLMDFilters.getValue()) + if (!d_useLMDFilters.getValue()) { if (!testValidity(e1, PQ)) return 0; @@ -1189,7 +1195,7 @@ int LocalMinDistance::computeIntersection(Ray &ray1, Sphere &sph2, OutputVector* bool LocalMinDistance::testValidity(Point &p, const Vec3 &PQ) const { - if (!filterIntersection.getValue()) + if (!d_filterIntersection.getValue()) return true; const Vec3 pt = p.p(); @@ -1232,7 +1238,7 @@ bool LocalMinDistance::testValidity(Point &p, const Vec3 &PQ) const const PointCollisionModel *pM = p.getCollisionModel(); const bool bothSide_computation = pM->bothSide.getValue(); nMean.normalize(); - if (dot(nMean, PQ) < -angleCone.getValue()*PQ.norm() && !bothSide_computation) + if (dot(nMean, PQ) < -d_angleCone.getValue() * PQ.norm() && !bothSide_computation) { return false; } @@ -1243,10 +1249,10 @@ bool LocalMinDistance::testValidity(Point &p, const Vec3 &PQ) const const auto& ped = topology->getEdge(e); Vec3 l = (pt - x[ped[0]]) + (pt - x[ped[1]]); l.normalize(); - double computedAngleCone = dot(nMean , l) * coneFactor.getValue(); + double computedAngleCone = dot(nMean , l) * d_coneFactor.getValue(); if (computedAngleCone<0) computedAngleCone=0.0; - computedAngleCone+=angleCone.getValue(); + computedAngleCone+=d_angleCone.getValue(); if (dot(l , PQ) < -computedAngleCone*PQ.norm()) { return false; @@ -1258,7 +1264,7 @@ bool LocalMinDistance::testValidity(Point &p, const Vec3 &PQ) const bool LocalMinDistance::testValidity(Line &l, const Vec3 &PQ) const { - if (!filterIntersection.getValue()) + if (!d_filterIntersection.getValue()) return true; const LineCollisionModel *lM = l.getCollisionModel(); @@ -1313,10 +1319,10 @@ bool LocalMinDistance::testValidity(Line &l, const Vec3 &PQ) const } // compute the angle for the cone to filter contacts using the normal of the triangle situated on the right - double computedAngleCone = (nMean * t1) * coneFactor.getValue(); + double computedAngleCone = (nMean * t1) * d_coneFactor.getValue(); if (computedAngleCone<0) computedAngleCone=0.0; - computedAngleCone+=angleCone.getValue(); + computedAngleCone+=d_angleCone.getValue(); if (t1*PQ < -computedAngleCone*PQ.norm()) { @@ -1326,10 +1332,10 @@ bool LocalMinDistance::testValidity(Line &l, const Vec3 &PQ) const } // compute the angle for the cone to filter contacts using the normal of the triangle situated on the left - computedAngleCone = (nMean * t2) * coneFactor.getValue(); + computedAngleCone = (nMean * t2) * d_coneFactor.getValue(); if (computedAngleCone<0) computedAngleCone=0.0; - computedAngleCone+=angleCone.getValue(); + computedAngleCone+=d_angleCone.getValue(); if (t2*PQ < -computedAngleCone*PQ.norm()) { @@ -1344,7 +1350,7 @@ bool LocalMinDistance::testValidity(Line &l, const Vec3 &PQ) const { n1 = PQ; n1.normalize(); - if (fabs(dot(AB,n1)) > angleCone.getValue() + 0.0001 ) // dot(AB,n1) should be equal to 0 + if (fabs(dot(AB,n1)) > d_angleCone.getValue() + 0.0001 ) // dot(AB,n1) should be equal to 0 { // means that proximity was detected with a null determinant // in function computeIntersection @@ -1361,7 +1367,7 @@ bool LocalMinDistance::testValidity(Triangle &t, const Vec3 &PQ) const const TriangleCollisionModel *tM = t.getCollisionModel(); const bool bothSide_computation = tM->d_bothSide.getValue(); - if (!filterIntersection.getValue() || bothSide_computation) + if (!d_filterIntersection.getValue() || bothSide_computation) return true; const Vec3& pt1 = t.p1(); diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h index 662e881b11a..5ac41af026a 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h @@ -61,10 +61,23 @@ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API LocalMinDistance : pub typedef core::collision::IntersectorFactory IntersectorFactory; - Data filterIntersection; ///< Activate LMD filter - Data angleCone; ///< Filtering cone extension angle - Data coneFactor; ///< Factor for filtering cone angle computation - Data useLMDFilters; ///< Use external cone computation (Work in Progress) + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data filterIntersection; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data angleCone; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data coneFactor; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data useLMDFilters; + + + Data d_filterIntersection; ///< Activate LMD filter + Data d_angleCone; ///< Filtering cone extension angle + Data d_coneFactor; ///< Factor for filtering cone angle computation + Data d_useLMDFilters; ///< Use external cone computation (Work in Progress) protected: LocalMinDistance(); diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshMinProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshMinProximityIntersection.cpp index 93656953556..7233534cd80 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshMinProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshMinProximityIntersection.cpp @@ -41,17 +41,17 @@ MeshMinProximityIntersection::MeshMinProximityIntersection(MinProximityIntersect { if (addSelf) { - if (intersection->usePointPoint.getValue()) + if (intersection->d_usePointPoint.getValue()) intersection->intersectors.add, PointCollisionModel, MeshMinProximityIntersection>(this); else intersection->intersectors.ignore, PointCollisionModel>(); - if(intersection->useLinePoint.getValue()) + if(intersection->d_useLinePoint.getValue()) intersection->intersectors.add, PointCollisionModel, MeshMinProximityIntersection>(this); else intersection->intersectors.ignore, PointCollisionModel>(); - if(intersection->useLineLine.getValue()) + if(intersection->d_useLineLine.getValue()) intersection->intersectors.add, LineCollisionModel, MeshMinProximityIntersection>(this); else intersection->intersectors.ignore, LineCollisionModel>(); @@ -60,7 +60,7 @@ MeshMinProximityIntersection::MeshMinProximityIntersection(MinProximityIntersect intersection->intersectors.ignore, LineCollisionModel>(); intersection->intersectors.ignore, TriangleCollisionModel>(); - if (intersection->useSphereTriangle.getValue()) + if (intersection->d_useSphereTriangle.getValue()) { intersection->intersectors.add, PointCollisionModel, MeshMinProximityIntersection>(this); intersection->intersectors.add, MeshMinProximityIntersection>(this); diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshNewProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshNewProximityIntersection.cpp index a915b139ed3..e38be45b6fd 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshNewProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MeshNewProximityIntersection.cpp @@ -208,7 +208,7 @@ int MeshNewProximityIntersection::computeIntersection(Triangle& e1, Line& e2, Ou n += doIntersectionTrianglePoint(dist2, f1, p1, p2, p3, pn, q1, contacts, e2.getIndex(), false); n += doIntersectionTrianglePoint(dist2, f1, p1, p2, p3, pn, q2, contacts, e2.getIndex(), false); - if (intersection->useLineLine.getValue()) + if (intersection->d_useLineLine.getValue()) { if (f1&TriangleCollisionModel::FLAG_E12) n += doIntersectionLineLine(dist2, p1, p2, q1, q2, contacts, e2.getIndex()); @@ -303,7 +303,7 @@ int MeshNewProximityIntersection::computeIntersection(Triangle& e1, Triangle& e2 if (f2&TriangleCollisionModel::FLAG_P3) n += doIntersectionTrianglePoint(dist2, f1, p1, p2, p3, pn, q3, contacts, id2+2, false, useNormal); - if (intersection->useLineLine.getValue()) + if (intersection->d_useLineLine.getValue()) { if (f1&TriangleCollisionModel::FLAG_E12) { diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp index 11423bf2bdc..0c602624b33 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp @@ -45,12 +45,18 @@ int MinProximityIntersectionClass = core::RegisterObject("A set of methods to co MinProximityIntersection::MinProximityIntersection() : BaseProximityIntersection() - , useSphereTriangle(initData(&useSphereTriangle, true, "useSphereTriangle","activate Sphere-Triangle intersection tests")) - , usePointPoint(initData(&usePointPoint, true, "usePointPoint","activate Point-Point intersection tests")) - , useSurfaceNormals(initData(&useSurfaceNormals, false, "useSurfaceNormals", "Compute the norms of the Detection Outputs by considering the normals of the surfaces involved.")) - , useLinePoint(initData(&useLinePoint, true, "useLinePoint", "activate Line-Point intersection tests")) - , useLineLine(initData(&useLineLine, true, "useLineLine", "activate Line-Line intersection tests")) + , d_useSphereTriangle(initData(&d_useSphereTriangle, true, "d_useSphereTriangle", "activate Sphere-Triangle intersection tests")) + , d_usePointPoint(initData(&d_usePointPoint, true, "usePointPoint", "activate Point-Point intersection tests")) + , d_useSurfaceNormals(initData(&d_useSurfaceNormals, false, "useSurfaceNormals", "Compute the norms of the Detection Outputs by considering the normals of the surfaces involved.")) + , d_useLinePoint(initData(&d_useLinePoint, true, "d_useLinePoint", "activate Line-Point intersection tests")) + , d_useLineLine(initData(&d_useLineLine, true, "useLineLine", "activate Line-Line intersection tests")) { + useSphereTriangle.setParent(&d_useSphereTriangle); + usePointPoint.setParent(&d_usePointPoint); + useLinePoint.setParent(&d_useLinePoint); + useLineLine.setParent(&d_useLineLine); + useSurfaceNormals.setParent(&d_useSurfaceNormals); + } void MinProximityIntersection::init() @@ -93,7 +99,7 @@ int MinProximityIntersection::computeIntersection(Cube& cube1, Cube& cube2, Outp bool MinProximityIntersection::getUseSurfaceNormals() const { - return useSurfaceNormals.getValue(); + return d_useSurfaceNormals.getValue(); } } // namespace sofa::component::collision::detection::intersection diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h index aadd49376c5..d5cb1dd1b60 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h @@ -38,27 +38,44 @@ namespace sofa::component::collision::detection::intersection * - Sphere/Sphere (rigid or vec3) * MeshMinProximityIntersection adds support for: * - Point/Point (if usePointPoint is true) - * - Line/Point (if useLinePoint is true) + * - Line/Point (if d_useLinePoint is true) * - Line/Line (if useLineLine is true) * - Triangle/Point - * - Sphere/Point (if useSphereTriangle is true) - * - RigidSphere/Point (if useSphereTriangle is true) - * - Triangle/Sphere (if useSphereTriangle is true) - * - Triangle/RigidSphere (if useSphereTriangle is true) - * - Line/Sphere (if useSphereTriangle is true) - * - Line/RigidSphere (if useSphereTriangle is true) + * - Sphere/Point (if d_useSphereTriangle is true) + * - RigidSphere/Point (if d_useSphereTriangle is true) + * - Triangle/Sphere (if d_useSphereTriangle is true) + * - Triangle/RigidSphere (if d_useSphereTriangle is true) + * - Line/Sphere (if d_useSphereTriangle is true) + * - Line/RigidSphere (if d_useSphereTriangle is true) * Note that MeshMinProximityIntersection ignores Triangle/Line and Triangle/Triangle intersections. - * Datas can be set to ignore some pairs of collision models (useSphereTriangle, usePointPoint, etc). + * Datas can be set to ignore some pairs of collision models (d_useSphereTriangle, usePointPoint, etc). */ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API MinProximityIntersection : public BaseProximityIntersection { public: SOFA_CLASS(MinProximityIntersection,BaseProximityIntersection); - Data useSphereTriangle; ///< activate Sphere-Triangle intersection tests - Data usePointPoint; ///< activate Point-Point intersection tests - Data useSurfaceNormals; ///< Compute the norms of the Detection Outputs by considering the normals of the surfaces involved. - Data useLinePoint; ///< activate Line-Point intersection tests - Data useLineLine; ///< activate Line-Line intersection tests + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data useSphereTriangle; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data usePointPoint; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data useSurfaceNormals; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data useLinePoint; + + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data useLineLine; + + + + Data d_useSphereTriangle; ///< activate Sphere-Triangle intersection tests + Data d_usePointPoint; ///< activate Point-Point intersection tests + Data d_useSurfaceNormals; ///< Compute the norms of the Detection Outputs by considering the normals of the surfaces involved. + Data d_useLinePoint; ///< activate Line-Point intersection tests + Data d_useLineLine; ///< activate Line-Line intersection tests protected: MinProximityIntersection(); diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.cpp index 43b36af6762..df151f25fb8 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.cpp @@ -44,8 +44,9 @@ int NewProximityIntersectionClass = core::RegisterObject("Optimized Proximity In NewProximityIntersection::NewProximityIntersection() : BaseProximityIntersection() - , useLineLine(initData(&useLineLine, false, "useLineLine", "Line-line collision detection enabled")) + , d_useLineLine(initData(&d_useLineLine, false, "useLineLine", "Line-line collision detection enabled")) { + useLineLine.setParent(&d_useLineLine); } void NewProximityIntersection::init() diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.h index 046cd568a58..d2ccb76f1f2 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/NewProximityIntersection.h @@ -55,8 +55,10 @@ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API NewProximityIntersecti { public: SOFA_CLASS(NewProximityIntersection,BaseProximityIntersection); + SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() + Data useLineLine; - Data useLineLine; ///< Line-line collision detection enabled + Data d_useLineLine; ///< Line-line collision detection enabled typedef core::collision::IntersectorFactory IntersectorFactory; diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/config.h.in b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/config.h.in index b9cc1595356..fc8617116fd 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/config.h.in +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/config.h.in @@ -43,3 +43,11 @@ namespace sofa::component::collision::detection::intersection #define SOFA_ATTRIBUTE_DEPRECATED__COLLISION_DETECTION_INTERSECTION_AS_PARAMETER() \ SOFA_ATTRIBUTE_DEPRECATED("v24.06", "v24.12", "Intersection detection methods now needs the Intersection method as a parameter.") #endif + +#ifdef SOFA_BUILD_SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION +#define SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() \ + SOFA_ATTRIBUTE_DEPRECATED("v24.06", "v24.12", \ + "Data renamed according to the guidelines") +#endif From 70e893c26627042eec40646acdbfdf8df5b8201c Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:19:45 +0200 Subject: [PATCH 2/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com> --- .../collision/detection/intersection/MinProximityIntersection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h index d5cb1dd1b60..a0d60f54d26 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h @@ -37,7 +37,7 @@ namespace sofa::component::collision::detection::intersection * - Cube/Cube * - Sphere/Sphere (rigid or vec3) * MeshMinProximityIntersection adds support for: - * - Point/Point (if usePointPoint is true) + * - Point/Point (if d_usePointPoint is true) * - Line/Point (if d_useLinePoint is true) * - Line/Line (if useLineLine is true) * - Triangle/Point From 7818d6bb8047ea71399148d32f2b1527e1acc90f Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:19:54 +0200 Subject: [PATCH 3/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h Co-authored-by: Alex Bilger --- .../collision/detection/intersection/LocalMinDistance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h index 5ac41af026a..bce4d2a52df 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h @@ -65,7 +65,7 @@ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API LocalMinDistance : pub Data filterIntersection; SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() - Data angleCone; + Data angleCone; SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() Data coneFactor; From 85242c8476f6bdc686321f8058333c974c5efe1b Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:20:02 +0200 Subject: [PATCH 4/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h Co-authored-by: Alex Bilger --- .../collision/detection/intersection/LocalMinDistance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h index bce4d2a52df..fb1391cfca3 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.h @@ -68,7 +68,7 @@ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API LocalMinDistance : pub Data angleCone; SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() - Data coneFactor; + Data coneFactor; SOFA_ATTRIBUTE_DEPRECATED__RENAME_DATA() Data useLMDFilters; From c034d645a9bab8af5f9c7e834972baa50e84a198 Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:20:12 +0200 Subject: [PATCH 5/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com> --- .../collision/detection/intersection/MinProximityIntersection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h index a0d60f54d26..3c83f3da4f2 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h @@ -39,7 +39,7 @@ namespace sofa::component::collision::detection::intersection * MeshMinProximityIntersection adds support for: * - Point/Point (if d_usePointPoint is true) * - Line/Point (if d_useLinePoint is true) - * - Line/Line (if useLineLine is true) + * - Line/Line (if d_useLineLine is true) * - Triangle/Point * - Sphere/Point (if d_useSphereTriangle is true) * - RigidSphere/Point (if d_useSphereTriangle is true) From 5d098478c4807c96dcab454b9b3d641eb351c9e6 Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:20:20 +0200 Subject: [PATCH 6/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com> --- .../collision/detection/intersection/MinProximityIntersection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h index 3c83f3da4f2..d36123b968c 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.h @@ -48,7 +48,7 @@ namespace sofa::component::collision::detection::intersection * - Line/Sphere (if d_useSphereTriangle is true) * - Line/RigidSphere (if d_useSphereTriangle is true) * Note that MeshMinProximityIntersection ignores Triangle/Line and Triangle/Triangle intersections. - * Datas can be set to ignore some pairs of collision models (d_useSphereTriangle, usePointPoint, etc). + * Datas can be set to ignore some pairs of collision models (d_useSphereTriangle, d_usePointPoint, etc). */ class SOFA_COMPONENT_COLLISION_DETECTION_INTERSECTION_API MinProximityIntersection : public BaseProximityIntersection { From 4e8d26c2ef8d56214a31dab42e00147aa40953d9 Mon Sep 17 00:00:00 2001 From: lamriaimen Date: Tue, 30 Apr 2024 12:50:58 +0200 Subject: [PATCH 7/9] [Constraint] Fix indentation --- .../detection/intersection/BaseProximityIntersection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp index efc48d04a1e..faad75690a6 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp @@ -30,8 +30,8 @@ BaseProximityIntersection::BaseProximityIntersection() : d_alarmDistance(initData(&d_alarmDistance, 1.0_sreal, "alarmDistance", "Proximity detection distance")) , d_contactDistance(initData(&d_contactDistance, 0.5_sreal, "contactDistance", "Distance below which a contact is created")) { - d_alarmDistance.setRequired(true); - d_contactDistance.setRequired(true); + d_alarmDistance.setRequired(true); + d_contactDistance.setRequired(true); alarmDistance.setParent(&d_alarmDistance); contactDistance.setParent(&d_contactDistance); From b0776795a74fe5d9036b01a890b796a0849dfea8 Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Fri, 3 May 2024 15:52:34 +0200 Subject: [PATCH 8/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp Co-authored-by: Alex Bilger --- .../detection/intersection/MinProximityIntersection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp index 0c602624b33..b0eeb8a9f1f 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp @@ -48,7 +48,7 @@ MinProximityIntersection::MinProximityIntersection() , d_useSphereTriangle(initData(&d_useSphereTriangle, true, "d_useSphereTriangle", "activate Sphere-Triangle intersection tests")) , d_usePointPoint(initData(&d_usePointPoint, true, "usePointPoint", "activate Point-Point intersection tests")) , d_useSurfaceNormals(initData(&d_useSurfaceNormals, false, "useSurfaceNormals", "Compute the norms of the Detection Outputs by considering the normals of the surfaces involved.")) - , d_useLinePoint(initData(&d_useLinePoint, true, "d_useLinePoint", "activate Line-Point intersection tests")) + , d_useLinePoint(initData(&d_useLinePoint, true, "useLinePoint", "activate Line-Point intersection tests")) , d_useLineLine(initData(&d_useLineLine, true, "useLineLine", "activate Line-Line intersection tests")) { useSphereTriangle.setParent(&d_useSphereTriangle); From aa4bd97bd08f732522e11dc9482cb56422b9382e Mon Sep 17 00:00:00 2001 From: MOHAMED SAID AIMEN LAMRI <89317946+lamriaimen@users.noreply.github.com> Date: Fri, 3 May 2024 15:52:48 +0200 Subject: [PATCH 9/9] Update Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp Co-authored-by: Alex Bilger --- .../detection/intersection/MinProximityIntersection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp index b0eeb8a9f1f..60d80ab3fb0 100644 --- a/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp +++ b/Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/MinProximityIntersection.cpp @@ -45,7 +45,7 @@ int MinProximityIntersectionClass = core::RegisterObject("A set of methods to co MinProximityIntersection::MinProximityIntersection() : BaseProximityIntersection() - , d_useSphereTriangle(initData(&d_useSphereTriangle, true, "d_useSphereTriangle", "activate Sphere-Triangle intersection tests")) + , d_useSphereTriangle(initData(&d_useSphereTriangle, true, "useSphereTriangle", "activate Sphere-Triangle intersection tests")) , d_usePointPoint(initData(&d_usePointPoint, true, "usePointPoint", "activate Point-Point intersection tests")) , d_useSurfaceNormals(initData(&d_useSurfaceNormals, false, "useSurfaceNormals", "Compute the norms of the Detection Outputs by considering the normals of the surfaces involved.")) , d_useLinePoint(initData(&d_useLinePoint, true, "useLinePoint", "activate Line-Point intersection tests"))