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/blenlib/BLI_math_geom.h | |
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/blenlib/BLI_math_geom.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 4c98c4be897..51b89df0e4e 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -61,6 +61,14 @@ float area_quad_v3(const float a[3], const float b[3], const float c[3], const f float area_poly_v3(int nr, float verts[][3], const float normal[3]); float area_poly_v2(int nr, float verts[][2]); +/********************************* Planes **********************************/ + +void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3]); +void plane_to_point_normal_v3(const float plane[4], float r_plane_co[3], float r_plane_no[3]); +MINLINE float plane_point_side_v3(const float plane[4], const float co[3]); + +/********************************* Volume **********************************/ + float volume_tetrahedron_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); @@ -120,6 +128,7 @@ bool isect_ray_plane_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, const int clip); +bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]); bool isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3], const bool no_flip); |