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/intern/math_vector_inline.c | |
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/intern/math_vector_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index cb629312712..16f35dbc5fa 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -45,13 +45,13 @@ MINLINE void zero_v3(float r[3]) r[2]= 0.0f; } -MINLINE void copy_v2_v2(float r[2], float a[2]) +MINLINE void copy_v2_v2(float r[2], const float a[2]) { r[0]= a[0]; r[1]= a[1]; } -MINLINE void copy_v3_v3(float r[3], float a[3]) +MINLINE void copy_v3_v3(float r[3], const float a[3]) { r[0]= a[0]; r[1]= a[1]; @@ -118,7 +118,7 @@ MINLINE void sub_v3_v3(float *r, float *a) r[2] -= a[2]; } -MINLINE void sub_v3_v3v3(float *r, float *a, float *b) +MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]) { r[0]= a[0] - b[0]; r[1]= a[1] - b[1]; @@ -216,7 +216,7 @@ MINLINE float cross_v2v2(float a[2], float b[2]) return a[0]*b[1] - a[1]*b[0]; } -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]) { r[0]= a[1]*b[2] - a[2]*b[1]; r[1]= a[2]*b[0] - a[0]*b[2]; |