You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix test for intersectionWithPlane (if zero with tolerance)
if (denominator < EQUALITY_THRESHOLD) the denominator is a signed dot product. When negative (edge crosses plane from the "back"), this is always true,
so the function rejects ~half of all valid intersections.
* fix two bugs with 2d case for Edge::intersectionWithEdge
1-The 2D path computes alpha (parameter on edge AB) and checks 0 <= alpha <= 1, but never computes or checks beta (parameter on edge CD). Reports false
intersections when the infinite line CD crosses segment AB but outside segment CD.
2-if (alphaDenom < std::numeric_limits<T>::epsilon()) same pattern as Bug 1. The cross product alphaDenom is signed. When negative (non-collinear edges in
one orientation), incorrectly reports them as collinear.
* fix equality for 2d case of ispointonedge
* Mat_solve_LCP: fix when reaching max nb loop
solveLCP returns true when solver fails to converge (max iterations reached)
* fix get bary coord for triangle
While isPointInTriangle still works (it only checks sign pattern),
any code that uses the returned coordinates for interpolation, projection to the nearest point on the triangle, or distance computation gets wrong values.
This is a public utility function likely consumed by many parts of the codebase.
* isPointInTriangle(3d) was not checking the plane, and add a boolean to bypass the plane check (as before)
* add more unit tests
* Update Sofa/framework/Geometry/src/sofa/geometry/Edge.h (fix sign error for beta)
Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com>
* add isPointOnPlane function and add its unit tests
* compute coeffs only if in plane; set -1,-1,-1 if not
* update unit tests
---------
Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com>
if (normalNorm2 > std::numeric_limits<T>::epsilon())
200
+
{
201
+
constauto d = sofa::type::dot(p0 - n0, normal);
202
+
if (d * d / normalNorm2 > std::numeric_limits<T>::epsilon())
203
+
returnfalse;
204
+
}
205
+
206
+
returntrue;
207
+
}
208
+
else
209
+
{
210
+
// all points are trivially in the same plane
211
+
returntrue;
212
+
}
213
+
}
214
+
153
215
/**
154
216
* @brief Test if input point is inside Triangle (n0, n1, n2) using Triangle @sa getBarycentricCoordinates . The point is inside the Triangle if and only if Those coordinates are all positive.
155
217
* @tparam Node iterable container
156
218
* @tparam T scalar
157
219
* @param p0: position of the point to test
158
220
* @param n0, n1, n2: nodes of the triangle
159
221
* @param output parameter: sofa::type::Vec<3, T> barycentric coordinates of the input point in Triangle
222
+
* @param assumePointIsOnPlane: optional bool to avoid testing if the point is on the plane defined by the triangle
160
223
* @return bool result if point is inside Triangle.
161
224
*/
162
225
template<typename Node,
163
226
typename T = std::decay_t<decltype(*std::begin(std::declval<Node>()))>,
0 commit comments