Fix for NaN values resulting from curve editing with collision #105499

Merged
Lukas Tönne merged 2 commits from LukasTonne/blender:fix_curve_collision_nans into main 2023-03-07 11:05:17 +01:00

2 Commits

Author SHA1 Message Date
Lukas Tönne 4c8424eb1f _sq suffix for squared length 2023-03-07 11:03:20 +01:00
Lukas Tönne f70123e81e Fix for NaN values resulting from curve editing with collision
This was caused by an incorrect assumption in the solver:
It tries to solve both collision and length constraints simultaneously,
using the projected movement of a point as a slide direction along the surface.
This only works if the distance of the previous curve point to the surface
is less than the allowed segment length. Otherwise the segment will
exceed the allowed length even with zero slide and NaN values are computed.

The case of larger surface distance can occur if the previous segment
solve was already stretching the current segment and then the point
moves further away. In this case we can simply clamp the segment length
without violating the contact constraint.
2023-03-06 17:33:54 +01:00