Commit 3cb26847 authored by panjia1983's avatar panjia1983
Browse files

Update src/intersect.cpp

change the normal direction returned for triangle-triangle intersection, now it is from object 1 to object 2, consistent with shape intersection returned by libccd and gjk.
parent 4d930564
...@@ -787,7 +787,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f ...@@ -787,7 +787,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f
contact_points[i] = deepest_points2[i]; contact_points[i] = deepest_points2[i];
} }
*normal = -n1; *normal = n1;
*penetration_depth = penetration_depth2; *penetration_depth = penetration_depth2;
} }
else else
...@@ -798,7 +798,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f ...@@ -798,7 +798,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f
contact_points[i] = deepest_points1[i]; contact_points[i] = deepest_points1[i];
} }
*normal = n2; *normal = -n2;
*penetration_depth = penetration_depth1; *penetration_depth = penetration_depth1;
} }
} }
...@@ -905,7 +905,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f ...@@ -905,7 +905,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f
contact_points[i] = deepest_points2[i]; contact_points[i] = deepest_points2[i];
} }
*normal = -n1; *normal = n1;
*penetration_depth = penetration_depth2; *penetration_depth = penetration_depth2;
} }
else else
...@@ -916,7 +916,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f ...@@ -916,7 +916,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f
contact_points[i] = deepest_points1[i]; contact_points[i] = deepest_points1[i];
} }
*normal = n2; *normal = -n2;
*penetration_depth = penetration_depth1; *penetration_depth = penetration_depth1;
} }
} }
......
Supports Markdown
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