[Bf-blender-cvs] [439ccd27e6a] blender2.8: BLI_math: Added isect_point_planes_v3_negated function.
Germano
noreply at git.blender.org
Tue May 15 19:10:52 CEST 2018
Commit: 439ccd27e6a454c716404efa55b4c750c13f2549
Author: Germano
Date: Tue May 15 14:10:41 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB439ccd27e6a454c716404efa55b4c750c13f2549
BLI_math: Added isect_point_planes_v3_negated function.
===================================================================
M source/blender/blenlib/BLI_math_geom.h
M source/blender/blenlib/intern/math_geom.c
===================================================================
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 940e22b144a..111450b6402 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -244,6 +244,9 @@ bool isect_ray_plane_v3(
float *r_lambda, const bool clip);
bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]);
+bool isect_point_planes_v3_negated(
+ const float (*planes)[4], const int totplane, const float p[3]);
+
bool isect_line_plane_v3(
float r_isect_co[3], const float l1[3], const float l2[3],
const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 34c8b9fabe6..0e7358aa426 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -2002,6 +2002,23 @@ bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3])
return true;
}
+/**
+ * Check if a point is in front all planes.
+ * Same as isect_point_planes_v3 but with planes facing the opposite direction.
+ */
+bool isect_point_planes_v3_negated(
+ const float(*planes)[4], const int totplane, const float p[3])
+{
+ for (int i = 0; i < totplane; i++) {
+ if (plane_point_side_v3(planes[i], p) <= 0.0f) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
/**
* Intersect line/plane.
*
More information about the Bf-blender-cvs
mailing list