diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-01-13 11:01:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-01-13 11:10:15 +0300 |
commit | 3debcc8b517ece352aa325cfd61adc0b16cf91da (patch) | |
tree | 2a490701226a73493c8d73e3a6ceeb3efe2e908b /source/blender/blenlib/BLI_math_geom.h | |
parent | 00ef77c1a241aaf3d7c6307411e97938b87c3096 (diff) |
Math Lib: improve area calculation
- area_quad_v3 now works correctly with concave quads.
- add area_squared_*** functions, to use when comparing to avoid a sqrt().
Diffstat (limited to 'source/blender/blenlib/BLI_math_geom.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index ee99f860a97..495aa6b2465 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -52,16 +52,23 @@ float normal_quad_v3(float r[3], const float a[3], const float b[3], const float float normal_poly_v3(float r[3], const float verts[][3], unsigned int nr); MINLINE float area_tri_v2(const float a[2], const float b[2], const float c[2]); +MINLINE float area_squared_tri_v2(const float a[2], const float b[2], const float c[2]); MINLINE float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2]); float area_tri_v3(const float a[3], const float b[3], const float c[3]); +float area_squared_tri_v3(const float a[3], const float b[3], const float c[3]); float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3]); float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]); +float area_squared_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]); float area_poly_v3(const float verts[][3], unsigned int nr); float area_poly_v2(const float verts[][2], unsigned int nr); +float area_squared_poly_v3(const float verts[][3], unsigned int nr); +float area_squared_poly_v2(const float verts[][2], unsigned int nr); +float area_poly_signed_v2(const float verts[][2], unsigned int nr); float cotangent_tri_weight_v3(const float v1[3], const float v2[3], const float v3[3]); void cross_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3]); MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2]); +void cross_poly_v3(float n[3], const float verts[][3], unsigned int nr); float cross_poly_v2(const float verts[][2], unsigned int nr); /********************************* Planes **********************************/ |