diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-22 19:30:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-22 19:30:24 +0400 |
commit | 2ee6c0ac6b774817d760e1e756e97eea476d412e (patch) | |
tree | a7b0807f16ae5838c981d224d5774f81de8a8e54 /source/blender/editors | |
parent | 29c8d3e20de92577d9067b70c6745bf1f0654e9c (diff) |
add utility functions for dealing with planes
- plane_point_side_v3(), a bit like line_point_side_v2()
- isect_point_planes_v3(), moved from paint_hide.c
functions to convert between point/normal pairs.
- plane_from_point_normal_v3()
- plane_to_point_normal_v3()
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_hide.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 8 |
2 files changed, 5 insertions, 17 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index db6380e920f..fc31aacffcf 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -71,18 +71,6 @@ #include <assert.h> -static int planes_contain_v3(float (*planes)[4], int totplane, const float p[3]) -{ - int i; - - for (i = 0; i < totplane; i++) { - if (dot_v3v3(planes[i], p) + planes[i][3] > 0) - return 0; - } - - return 1; -} - /* return true if the element should be hidden/shown */ static int is_effected(PartialVisArea area, float planes[4][4], @@ -95,7 +83,7 @@ static int is_effected(PartialVisArea area, return mask > 0.5f; } else { - int inside = planes_contain_v3(planes, 4, co); + bool inside = isect_point_planes_v3(planes, 4, co); return ((inside && area == PARTIALVIS_INSIDE) || (!inside && area == PARTIALVIS_OUTSIDE)); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 9f6ad4a2d39..ccb53468ca9 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -220,10 +220,10 @@ void ED_view3d_clipping_enable(void) static bool view3d_clipping_test(const float co[3], float clip[6][4]) { - if (0.0f < clip[0][3] + dot_v3v3(co, clip[0])) - if (0.0f < clip[1][3] + dot_v3v3(co, clip[1])) - if (0.0f < clip[2][3] + dot_v3v3(co, clip[2])) - if (0.0f < clip[3][3] + dot_v3v3(co, clip[3])) + if (plane_point_side_v3(clip[0], co) > 0.0f) + if (plane_point_side_v3(clip[1], co) > 0.0f) + if (plane_point_side_v3(clip[2], co) > 0.0f) + if (plane_point_side_v3(clip[3], co) > 0.0f) return false; return true; |