@@ -634,9 +634,10 @@ struct HPP_FCL_DLLAPI GJKSolver {
634
634
// TODO: On degenerated case, the closest points may be non-unique.
635
635
// (i.e. an object face normal is colinear to `gjk.ray`)
636
636
gjk.getWitnessPointsAndNormal (this ->minkowski_difference , p1, p2, normal );
637
- p1 = tf1.transform (p1);
638
- p2 = tf1.transform (p2);
637
+ Vec3f p = tf1.transform (0.5 * (p1 + p2));
639
638
normal = tf1.getRotation () * normal ;
639
+ p1.noalias () = p - 0.5 * distance * normal ;
640
+ p2.noalias () = p + 0.5 * distance * normal ;
640
641
}
641
642
642
643
void GJKCollisionExtractWitnessPointsAndNormal (const Transform3f& tf1,
@@ -702,9 +703,10 @@ struct HPP_FCL_DLLAPI GJKSolver {
702
703
// We compute the middle points of the current $p_1$ and $p_2$ and we use
703
704
// the normal and the distance given by EPA to compute the new $p_1$ and
704
705
// $p_2$.
705
- p1 = tf1.transform (p1);
706
- p2 = tf1.transform (p2);
706
+ Vec3f p = tf1.transform (0.5 * (p1 + p2));
707
707
normal = tf1.getRotation () * normal ;
708
+ p1.noalias () = p - 0.5 * distance * normal ;
709
+ p2.noalias () = p + 0.5 * distance * normal ;
708
710
}
709
711
710
712
void EPAFailedExtractWitnessPointsAndNormal (const Transform3f& tf1,
0 commit comments