diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-09-12 19:28:53 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-09-12 19:32:44 +0300 |
commit | ca5e1615a10fd8c31bb0367332cd5f3a1e8bd9aa (patch) | |
tree | db7cb0ad2a5cc6fe9650db18d933ef7d94fe136e /source/blender/blenlib/intern/math_geom.c | |
parent | f9ef59ccc80d5bd3e0ad3aad74e535fc08747e5c (diff) |
BMesh: New tool `BM_mesh_intersect_edges`
Along with the new utility `BM_vert_weld_linked_wire_edges_into_linked_faces`
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index a81dc018ed0..6d8193e7675 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3057,19 +3057,21 @@ bool isect_line_line_strict_v3(const float v1[3], * * \note Neither directions need to be normalized. */ -bool isect_ray_ray_v3(const float ray_origin_a[3], - const float ray_direction_a[3], - const float ray_origin_b[3], - const float ray_direction_b[3], - float *r_lambda_a, - float *r_lambda_b) +bool isect_ray_ray_epsilon_v3(const float ray_origin_a[3], + const float ray_direction_a[3], + const float ray_origin_b[3], + const float ray_direction_b[3], + const float epsilon, + float *r_lambda_a, + float *r_lambda_b) { BLI_assert(r_lambda_a || r_lambda_b); float n[3]; cross_v3_v3v3(n, ray_direction_b, ray_direction_a); const float nlen = len_squared_v3(n); - if (UNLIKELY(nlen == 0.0f)) { + /* `nlen` is the the square of the area formed by the two vectors. */ + if (UNLIKELY(nlen < epsilon)) { /* The lines are parallel. */ return false; } @@ -3091,6 +3093,22 @@ bool isect_ray_ray_v3(const float ray_origin_a[3], return true; } +bool isect_ray_ray_v3(const float ray_origin_a[3], + const float ray_direction_a[3], + const float ray_origin_b[3], + const float ray_direction_b[3], + float *r_lambda_a, + float *r_lambda_b) +{ + return isect_ray_ray_epsilon_v3(ray_origin_a, + ray_direction_a, + ray_origin_b, + ray_direction_b, + FLT_MIN, + r_lambda_a, + r_lambda_b); +} + bool isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], |