diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-29 14:44:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-29 14:44:00 +0400 |
commit | 41a5e731a2e13a18110f3f1919c340425f32f452 (patch) | |
tree | d01fb6155d5cdebd114eb5a06a3b3f5c884cb50a /source/blender/blenlib/intern/math_vector.c | |
parent | 3d1349609c955cd2e326904dbc48c7277e7d99ff (diff) |
bmesh: new wireframe tool
- makes wireframe from faces.
- options similar to inset (even offset, relative scale)
- copies face settings and loops (uvs, vcolors)
- optionally replaces the existing geometry.
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index f734e01943f..90e6a4cb945 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -217,6 +217,25 @@ float angle_normalized_v2v2(const float v1[2], const float v2[2]) return 2.0f * (float)saasin(len_v2v2(v2, v1) / 2.0f); } +/** + * angle between 2 vectors defined by 3 coords, about an axis. */ +float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) +{ + float v1_proj[3], v2_proj[3], tproj[3]; + + sub_v3_v3v3(v1_proj, v1, v2); + sub_v3_v3v3(v2_proj, v3, v2); + + /* project the vectors onto the axis */ + project_v3_v3v3(tproj, v1_proj, axis); + sub_v3_v3(v1_proj, tproj); + + project_v3_v3v3(tproj, v2_proj, axis); + sub_v3_v3(v2_proj, tproj); + + return angle_v3v3(v1_proj, v2_proj); +} + void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3]) { float ed1[3], ed2[3], ed3[3]; |