diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-27 04:32:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-27 04:32:58 +0300 |
commit | fde4686d77dd72ccfa88febdea360136bfd17a36 (patch) | |
tree | 52a715e72488c70457f5c29a74e24c0e3977e470 /source/blender/blenlib/BLI_math_vector.h | |
parent | 9c82e1efc32bdff04c3136ef5a2959ed73711ca7 (diff) |
barycentric transform utility geometry function.
From 2 triangles and 1 point, the relative position between the point and the first triangle is applied to the second triangle to find the target point.
the barycentric weights are calculated in 2D space with a signed area so values outside the triangle bounds are supported.
wrapped by python:
pt_to = Geometry.BarycentricTransform(pt_from, t1a, t1b, t1c, t2a, t1b, t1c)
NOTE:
- moved some barycentric weight functions out of projection painting into the math lib.
- ended up making some of the math functions use const args.
TODO:
- support exceptional cases. zero area tries and similar.
Diffstat (limited to 'source/blender/blenlib/BLI_math_vector.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index e915a9a85f3..26e7ff5abe9 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -51,8 +51,8 @@ extern "C" { MINLINE void zero_v2(float r[2]); MINLINE void zero_v3(float r[3]); -MINLINE void copy_v2_v2(float r[2], float a[2]); -MINLINE void copy_v3_v3(float r[3], float a[3]); +MINLINE void copy_v2_v2(float r[2], const float a[2]); +MINLINE void copy_v3_v3(float r[3], const float a[3]); MINLINE void swap_v2_v2(float a[2], float b[2]); MINLINE void swap_v3_v3(float a[3], float b[3]); @@ -67,7 +67,7 @@ MINLINE void add_v3_v3v3(float r[3], float a[3], float b[3]); MINLINE void sub_v2_v2(float r[2], float a[2]); MINLINE void sub_v2_v2v2(float r[2], float a[2], float b[2]); MINLINE void sub_v3_v3(float r[3], float a[3]); -MINLINE void sub_v3_v3v3(float r[3], float a[3], float b[3]); +MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void mul_v2_fl(float r[2], float f); MINLINE void mul_v3_fl(float r[3], float f); @@ -87,7 +87,7 @@ MINLINE float dot_v2v2(float a[2], float b[2]); MINLINE float dot_v3v3(float a[3], float b[3]); MINLINE float cross_v2v2(float a[2], float b[2]); -MINLINE void cross_v3_v3v3(float r[3], float a[3], float b[3]); +MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void star_m3_v3(float R[3][3],float a[3]); @@ -103,11 +103,11 @@ MINLINE float normalize_v3(float r[3]); /******************************* Interpolation *******************************/ -void interp_v2_v2v2(float r[2], float a[2], float b[2], float t); -void interp_v2_v2v2v2(float r[2], float a[2], float b[2], float c[3], float t[3]); -void interp_v3_v3v3(float r[3], float a[3], float b[3], float t); -void interp_v3_v3v3v3(float p[3], float v1[3], float v2[3], float v3[3], float w[3]); -void interp_v3_v3v3v3v3(float p[3], float v1[3], float v2[3], float v3[3], float v4[3], float w[4]); +void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t); +void interp_v2_v2v2v2(float r[2], const float a[2], const float b[2], const float c[3], const float t[3]); +void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t); +void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]); +void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4]); void mid_v3_v3v3(float r[3], float a[3], float b[3]); @@ -130,7 +130,7 @@ float angle_v2v2v2(float a[2], float b[2], float c[2]); float angle_normalized_v2v2(float a[2], float b[2]); float angle_v3v3(float a[2], float b[2]); float angle_v3v3v3(float a[2], float b[2], float c[2]); -float angle_normalized_v3v3(float a[3], float b[3]); +float angle_normalized_v3v3(const float v1[3], const float v2[3]); void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3]); void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3]); |