Skip to content

Commit 99596dc

Browse files
authored
[CollisionModel] Rename proximity data to contactDistance (#5518)
* Rename proximity data to contactDistance with compat layer * Modify SOFA scenes * Change methods names * Add compat layer * Modify description
1 parent cd00e5e commit 99596dc

File tree

58 files changed

+225
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+225
-192
lines changed

Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/BaseProximityIntersection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool BaseProximityIntersection::testIntersection(Cube& cube1, Cube& cube2, const
4242
const auto& maxVect1 = cube1.maxVect();
4343
const auto& maxVect2 = cube2.maxVect();
4444

45-
const auto alarmDist = currentIntersection->getAlarmDistance() + cube1.getProximity() + cube2.getProximity();
45+
const auto alarmDist = currentIntersection->getAlarmDistance() + cube1.getContactDistance() + cube2.getContactDistance();
4646

4747
for (int i = 0; i < 3; i++)
4848
{

Sofa/Component/Collision/Detection/Intersection/src/sofa/component/collision/detection/intersection/LocalMinDistance.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ bool LocalMinDistance::testIntersection(Line& e1, Line& e2, const core::collisio
108108
return false;
109109
}
110110

111-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
111+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
112112

113113
const Line::Coord AB = e1.p2()-e1.p1();
114114
const Line::Coord CD = e2.p2()-e2.p1();
@@ -168,7 +168,7 @@ int LocalMinDistance::computeIntersection(Line& e1, Line& e2, OutputVector* cont
168168
return 0;
169169
}
170170

171-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
171+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
172172

173173
// E1 => A-->B
174174
// E2 => C-->D
@@ -259,7 +259,7 @@ int LocalMinDistance::computeIntersection(Line& e1, Line& e2, OutputVector* cont
259259

260260
#endif
261261

262-
const double contactDist = currentIntersection->getContactDistance() + e1.getProximity() + e2.getProximity();
262+
const double contactDist = currentIntersection->getContactDistance() + e1.getContactDistance() + e2.getContactDistance();
263263

264264
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e1, e2);
265265
detection->id = (e1.getCollisionModel()->getSize() > e2.getCollisionModel()->getSize()) ? e1.getIndex() : e2.getIndex();
@@ -278,7 +278,7 @@ bool LocalMinDistance::testIntersection(Triangle& e2, Point& e1, const core::col
278278
if(!e1.isActive(e2.getCollisionModel()))
279279
return false;
280280

281-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
281+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
282282

283283
const Vec3 AB = e2.p2()-e2.p1();
284284
const Vec3 AC = e2.p3()-e2.p1();
@@ -345,7 +345,7 @@ int LocalMinDistance::computeIntersection(Triangle& e2, Point& e1, OutputVector*
345345
if(!e1.isActive(e2.getCollisionModel()))
346346
return 0;
347347

348-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
348+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
349349

350350
static_assert(std::is_same_v<Triangle::Coord, Point::Coord>, "Data mismatch");
351351
using Real = Triangle::Coord::value_type;
@@ -411,7 +411,7 @@ int LocalMinDistance::computeIntersection(Triangle& e2, Point& e1, OutputVector*
411411
}
412412
#endif
413413

414-
const double contactDist = currentIntersection->getContactDistance() + e1.getProximity() + e2.getProximity();
414+
const double contactDist = currentIntersection->getContactDistance() + e1.getContactDistance() + e2.getContactDistance();
415415

416416
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e2, e1);
417417
detection->id = e1.getIndex();
@@ -430,7 +430,7 @@ bool LocalMinDistance::testIntersection(Triangle& e2, Sphere& e1, const core::co
430430
if (!e1.isActive(e2.getCollisionModel()))
431431
return false;
432432

433-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.getProximity();
433+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
434434

435435
static_assert(std::is_same_v<Triangle::Coord, Sphere::Coord>, "Data mismatch");
436436
using Real = Triangle::Coord::value_type;
@@ -500,7 +500,7 @@ int LocalMinDistance::computeIntersection(Triangle& e2, Sphere& e1, OutputVector
500500
if (!e1.isActive(e2.getCollisionModel()))
501501
return false;
502502

503-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.getProximity();
503+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
504504

505505
static_assert(std::is_same_v<Triangle::Coord, Sphere::Coord>, "Data mismatch");
506506
using Real = Triangle::Coord::value_type;
@@ -565,7 +565,7 @@ int LocalMinDistance::computeIntersection(Triangle& e2, Sphere& e1, OutputVector
565565
}
566566
#endif
567567

568-
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getProximity() + e2.getProximity();
568+
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
569569

570570
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e2, e1);
571571
detection->id = e1.getIndex();
@@ -586,7 +586,7 @@ bool LocalMinDistance::testIntersection(Line& e2, Point& e1, const core::collisi
586586
if(!e1.isActive(e2.getCollisionModel()) || !e2.isActive(e1.getCollisionModel()))
587587
return false;
588588

589-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
589+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
590590
const Line::Coord AB = e2.p2()-e2.p1();
591591
const Line::Coord AP = e1.p()-e2.p1();
592592

@@ -633,7 +633,7 @@ int LocalMinDistance::computeIntersection(Line& e2, Point& e1, OutputVector* con
633633
if(!e1.isActive(e2.getCollisionModel()) || !e2.isActive(e1.getCollisionModel()))
634634
return 0;
635635

636-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
636+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
637637
const Line::Coord AB = e2.p2()-e2.p1();
638638
const Line::Coord AP = e1.p()-e2.p1();
639639

@@ -685,7 +685,7 @@ int LocalMinDistance::computeIntersection(Line& e2, Point& e1, OutputVector* con
685685
}
686686
#endif
687687

688-
const double contactDist = currentIntersection->getContactDistance() + e1.getProximity() + e2.getProximity();
688+
const double contactDist = currentIntersection->getContactDistance() + e1.getContactDistance() + e2.getContactDistance();
689689

690690
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e2, e1);
691691
detection->id = e1.getIndex();
@@ -705,7 +705,7 @@ bool LocalMinDistance::testIntersection(Line& e2, Sphere& e1, const core::collis
705705
static_assert(std::is_same_v<Line::Coord, Sphere::Coord>, "Data mismatch");
706706
using Real = Triangle::Coord::value_type;
707707

708-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.getProximity();
708+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
709709
const Line::Coord AB = e2.p2()-e2.p1();
710710
const Line::Coord AP = e1.p()-e2.p1();
711711

@@ -748,7 +748,7 @@ int LocalMinDistance::computeIntersection(Line& e2, Sphere& e1, OutputVector* co
748748
static_assert(std::is_same_v<Line::Coord, Sphere::Coord>, "Data mismatch");
749749
using Real = Triangle::Coord::value_type;
750750

751-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.getProximity();
751+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
752752
const Line::Coord AB = e2.p2()-e2.p1();
753753
const Line::Coord AP = e1.p()-e2.p1();
754754

@@ -800,7 +800,7 @@ int LocalMinDistance::computeIntersection(Line& e2, Sphere& e1, OutputVector* co
800800
}
801801
#endif
802802

803-
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getProximity() + e2.getProximity();
803+
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
804804

805805
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e2, e1);
806806
detection->id = e1.getIndex();
@@ -819,7 +819,7 @@ bool LocalMinDistance::testIntersection(Point& e1, Point& e2, const core::collis
819819
if(!e1.isActive(e2.getCollisionModel()) || !e2.isActive(e1.getCollisionModel()))
820820
return false;
821821

822-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
822+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
823823

824824
const Point::Coord PQ = e2.p()-e1.p();
825825

@@ -851,7 +851,7 @@ int LocalMinDistance::computeIntersection(Point& e1, Point& e2, OutputVector* co
851851
if(!e1.isActive(e2.getCollisionModel()) || !e2.isActive(e1.getCollisionModel()))
852852
return 0;
853853

854-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getProximity() + e2.getProximity();
854+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.getContactDistance() + e2.getContactDistance();
855855

856856
const Point::Coord& P = e1.p();
857857
const Point::Coord& Q = e2.p();
@@ -890,7 +890,7 @@ int LocalMinDistance::computeIntersection(Point& e1, Point& e2, OutputVector* co
890890
}
891891
#endif
892892

893-
const double contactDist = currentIntersection->getContactDistance() + e1.getProximity() + e2.getProximity();
893+
const double contactDist = currentIntersection->getContactDistance() + e1.getContactDistance() + e2.getContactDistance();
894894

895895
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e1, e2);
896896
detection->id = (e1.getCollisionModel()->getSize() > e2.getCollisionModel()->getSize()) ? e1.getIndex() : e2.getIndex();
@@ -905,7 +905,7 @@ int LocalMinDistance::computeIntersection(Point& e1, Point& e2, OutputVector* co
905905

906906
bool LocalMinDistance::testIntersection(Sphere& e1, Point& e2, const core::collision::Intersection* currentIntersection)
907907
{
908-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.getProximity();
908+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
909909

910910
static_assert(std::is_same_v<Sphere::Coord, Point::Coord>, "Data mismatch");
911911
const auto PQ = e2.p()-e1.p();
@@ -935,7 +935,7 @@ bool LocalMinDistance::testIntersection(Sphere& e1, Point& e2, const core::colli
935935

936936
int LocalMinDistance::computeIntersection(Sphere& e1, Point& e2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)
937937
{
938-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.getProximity();
938+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
939939
static_assert(std::is_same_v<Sphere::Coord, Point::Coord>, "Data mismatch");
940940

941941
const Sphere::Coord& P = e1.p();
@@ -975,7 +975,7 @@ int LocalMinDistance::computeIntersection(Sphere& e1, Point& e2, OutputVector* c
975975
}
976976
#endif
977977

978-
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getProximity() + e2.getProximity();
978+
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getContactDistance() + e2.getContactDistance();
979979

980980
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e1, e2);
981981
detection->id = (e1.getCollisionModel()->getSize() > e2.getCollisionModel()->getSize()) ? e1.getIndex() : e2.getIndex();
@@ -990,7 +990,7 @@ int LocalMinDistance::computeIntersection(Sphere& e1, Point& e2, OutputVector* c
990990

991991
bool LocalMinDistance::testIntersection(Sphere& e1, Sphere& e2, const core::collision::Intersection* currentIntersection)
992992
{
993-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.r() + e2.getProximity();
993+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.r() + e2.getContactDistance();
994994

995995
const Sphere::Coord PQ = e2.p()-e1.p();
996996
if (PQ.norm2() < alarmDist*alarmDist)
@@ -1018,7 +1018,7 @@ bool LocalMinDistance::testIntersection(Sphere& e1, Sphere& e2, const core::coll
10181018

10191019
int LocalMinDistance::computeIntersection(Sphere& e1, Sphere& e2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)
10201020
{
1021-
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getProximity() + e2.r() + e2.getProximity();
1021+
const SReal alarmDist = currentIntersection->getAlarmDistance() + e1.r() + e1.getContactDistance() + e2.r() + e2.getContactDistance();
10221022

10231023
const Sphere::Coord& P = e1.p();
10241024
const Sphere::Coord& Q = e2.p();
@@ -1056,7 +1056,7 @@ int LocalMinDistance::computeIntersection(Sphere& e1, Sphere& e2, OutputVector*
10561056
}
10571057
#endif
10581058

1059-
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getProximity() + e2.r() + e2.getProximity();
1059+
const double contactDist = currentIntersection->getContactDistance() + e1.r() + e1.getContactDistance() + e2.r() + e2.getContactDistance();
10601060

10611061
detection->elem = std::pair<core::CollisionElementIterator, core::CollisionElementIterator>(e1, e2);
10621062
detection->id = (e1.getCollisionModel()->getSize() > e2.getCollisionModel()->getSize()) ? e1.getIndex() : e2.getIndex();
@@ -1074,7 +1074,7 @@ bool LocalMinDistance::testIntersection(Ray &t1,Triangle &t2, const core::collis
10741074
{
10751075
type::Vec3 P,Q;
10761076

1077-
const SReal alarmDist = currentIntersection->getAlarmDistance() + t1.getProximity() + t2.getProximity();
1077+
const SReal alarmDist = currentIntersection->getAlarmDistance() + t1.getContactDistance() + t2.getContactDistance();
10781078

10791079
if (fabs(t2.n() * t1.direction()) < 0.000001)
10801080
return false; // no intersection for edges parallel to the triangle
@@ -1098,7 +1098,7 @@ bool LocalMinDistance::testIntersection(Ray &t1,Triangle &t2, const core::collis
10981098

10991099
int LocalMinDistance::computeIntersection(Ray &t1, Triangle &t2, OutputVector* contacts, const core::collision::Intersection* currentIntersection)
11001100
{
1101-
const SReal alarmDist = currentIntersection->getAlarmDistance() + t1.getProximity() + t2.getProximity();
1101+
const SReal alarmDist = currentIntersection->getAlarmDistance() + t1.getContactDistance() + t2.getContactDistance();
11021102

11031103

11041104
if (fabs(t2.n() * t1.direction()) < 0.000001)

0 commit comments

Comments
 (0)