Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/math_geom.c')
-rw-r--r--source/blender/blenlib/intern/math_geom.c129
1 files changed, 1 insertions, 128 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index a5c84ed7645..d59d7b4fe6a 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -534,21 +534,11 @@ float dist_signed_squared_to_corner_v3v3v3(
cross_v3_v3v3(plane_a, dir_a, axis);
cross_v3_v3v3(plane_b, axis, dir_b);
-#if 0
- plane_from_point_normal_v3(plane_a, v2, plane_a);
- plane_from_point_normal_v3(plane_b, v2, plane_b);
-
- dist_a = dist_signed_squared_to_plane_v3(p, plane_a);
- dist_b = dist_signed_squared_to_plane_v3(p, plane_b);
-#else
/* calculate without the planes 4th component to avoid float precision issues */
sub_v3_v3v3(s_p_v2, p, v2);
dist_a = dist_signed_squared_to_plane3_v3(s_p_v2, plane_a);
dist_b = dist_signed_squared_to_plane3_v3(s_p_v2, plane_b);
-#endif
-
-
if (flip) {
return min_ff(dist_a, dist_b);
@@ -1456,90 +1446,6 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
}
/* point in polygon (keep float and int versions in sync) */
-#if 0
-bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsigned int nr,
- const bool use_holes)
-{
- /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */
- float angletot = 0.0;
- float fp1[2], fp2[2];
- unsigned int i;
- const float *p1, *p2;
-
- p1 = verts[nr - 1];
-
- /* first vector */
- fp1[0] = (float)(p1[0] - pt[0]);
- fp1[1] = (float)(p1[1] - pt[1]);
-
- for (i = 0; i < nr; i++) {
- p2 = verts[i];
-
- /* second vector */
- fp2[0] = (float)(p2[0] - pt[0]);
- fp2[1] = (float)(p2[1] - pt[1]);
-
- /* dot and angle and cross */
- angletot += angle_signed_v2v2(fp1, fp2);
-
- /* circulate */
- copy_v2_v2(fp1, fp2);
- p1 = p2;
- }
-
- angletot = fabsf(angletot);
- if (use_holes) {
- const float nested = floorf((angletot / (float)(M_PI * 2.0)) + 0.00001f);
- angletot -= nested * (float)(M_PI * 2.0);
- return (angletot > 4.0f) != ((int)nested % 2);
- }
- else {
- return (angletot > 4.0f);
- }
-}
-bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], const unsigned int nr,
- const bool use_holes)
-{
- /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */
- float angletot = 0.0;
- float fp1[2], fp2[2];
- unsigned int i;
- const int *p1, *p2;
-
- p1 = verts[nr - 1];
-
- /* first vector */
- fp1[0] = (float)(p1[0] - pt[0]);
- fp1[1] = (float)(p1[1] - pt[1]);
-
- for (i = 0; i < nr; i++) {
- p2 = verts[i];
-
- /* second vector */
- fp2[0] = (float)(p2[0] - pt[0]);
- fp2[1] = (float)(p2[1] - pt[1]);
-
- /* dot and angle and cross */
- angletot += angle_signed_v2v2(fp1, fp2);
-
- /* circulate */
- copy_v2_v2(fp1, fp2);
- p1 = p2;
- }
-
- angletot = fabsf(angletot);
- if (use_holes) {
- const float nested = floorf((angletot / (float)(M_PI * 2.0)) + 0.00001f);
- angletot -= nested * (float)(M_PI * 2.0);
- return (angletot > 4.0f) != ((int)nested % 2);
- }
- else {
- return (angletot > 4.0f);
- }
-}
-
-#else
-
bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsigned int nr,
const bool UNUSED(use_holes))
{
@@ -1569,8 +1475,6 @@ bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], const unsign
return isect;
}
-#endif
-
/* point in tri */
/* only single direction */
@@ -2592,18 +2496,6 @@ bool isect_axial_line_segment_tri_v3(
float u, v, f;
int a0 = axis, a1 = (axis + 1) % 3, a2 = (axis + 2) % 3;
-#if 0
- return isect_line_segment_tri_v3(p1, p2, v0, v1, v2, lambda);
-
- /* first a simple bounding box test */
- if (min_fff(v0[a1], v1[a1], v2[a1]) > p1[a1]) return false;
- if (min_fff(v0[a2], v1[a2], v2[a2]) > p1[a2]) return false;
- if (max_fff(v0[a1], v1[a1], v2[a1]) < p1[a1]) return false;
- if (max_fff(v0[a2], v1[a2], v2[a2]) < p1[a2]) return false;
-
- /* then a full intersection test */
-#endif
-
sub_v3_v3v3(e1, v1, v0);
sub_v3_v3v3(e2, v2, v0);
sub_v3_v3v3(p, v0, p1);
@@ -2920,13 +2812,10 @@ float line_point_factor_v3_ex(
float dot;
sub_v3_v3v3(u, l2, l1);
sub_v3_v3v3(h, p, l1);
-#if 0
- return (dot_v3v3(u, h) / dot_v3v3(u, u));
-#else
+
/* better check for zero */
dot = len_squared_v3(u);
return (dot > epsilon) ? (dot_v3v3(u, h) / dot) : fallback;
-#endif
}
float line_point_factor_v3(
const float p[3], const float l1[3], const float l2[3])
@@ -2942,13 +2831,9 @@ float line_point_factor_v2_ex(
float dot;
sub_v2_v2v2(u, l2, l1);
sub_v2_v2v2(h, p, l1);
-#if 0
- return (dot_v2v2(u, h) / dot_v2v2(u, u));
-#else
/* better check for zero */
dot = len_squared_v2(u);
return (dot > epsilon) ? (dot_v2v2(u, h) / dot) : fallback;
-#endif
}
float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
@@ -3063,18 +2948,6 @@ bool point_in_slice_seg(float p[3], float l1[3], float l2[3])
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)
-{
- float h, rp[3];
- sub_v3_v3v3(rp, p, origin);
- h = dot_v3v3(normal, rp) / lns;
- if (h < 0.0f || h > 1.0f) return 0;
- return 1;
-}
-#endif
-
bool isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3])
{
if (!point_in_slice(p, v1, v2, v3)) return false;