From 3debcc8b517ece352aa325cfd61adc0b16cf91da Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jan 2015 19:01:40 +1100 Subject: 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(). --- source/blender/blenlib/BLI_math_geom.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/blenlib/BLI_math_geom.h') 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 **********************************/ -- cgit v1.2.3