diff options
author | Luca Rood <dev@lucarood.com> | 2018-09-26 18:18:16 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2018-09-26 18:49:40 +0300 |
commit | 0666ece2e2f96571200d693d9d7bee1ca72d026f (patch) | |
tree | d19df74e5f36d4a745dd5ea917ccf840a6e61923 /source/blender/blenlib/intern | |
parent | a27d97d1b737037e7c09d3052ba5c644588024ec (diff) |
Cloth: Collision improvements
This commit includes several performance, stability, and reliability
improvements to cloth collisions.
Most notably:
* The implementation of a new self-collisions system.
* Multithreading of collision detection.
* Implementation of single sided collisions and normal overrides.
* Replacement of the `plNearestPoints` function from Bullet with a
dedicated solution.
Further, this also includes several bug fixes, and algorithmic
improvements.
Reviewed By: brecht
Differential Revision: http://developer.blender.org/D3712
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 12246473523..fb2a1e47895 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2979,19 +2979,27 @@ static bool point_in_slice(const float p[3], const float v1[3], const float l1[3 return (h >= 0.0f && h <= 1.0f); } -#if 0 - /* adult sister defining the slice planes by the origin and the normal * NOTE |normal| may not be 1 but defining the thickness of the slice */ -static int point_in_slice_as(float p[3], float origin[3], float normal[3]) +static bool point_in_slice_as(float p[3], float origin[3], float normal[3]) { float h, rp[3]; sub_v3_v3v3(rp, p, origin); h = dot_v3v3(normal, rp) / dot_v3v3(normal, normal); - if (h < 0.0f || h > 1.0f) return 0; - return 1; + if (h < 0.0f || h > 1.0f) return false; + return true; } +bool point_in_slice_seg(float p[3], float l1[3], float l2[3]) +{ + float normal[3]; + + sub_v3_v3v3(normal, l2, l1); + + return point_in_slice_as(p, l1, normal); +} + +#if 0 /*mama (knowing the squared length of the normal) */ static int point_in_slice_m(float p[3], float origin[3], float normal[3], float lns) { |