diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-20 06:24:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-20 06:24:01 +0400 |
commit | fe71f40f889921ea3ab9282b5cbbc42ba19317e2 (patch) | |
tree | c1e1202eaa9da6618c35cfcf11b6443c06efb8d6 /source/blender/blenlib/intern/math_vector.c | |
parent | 62ac943e3108ad5f70cd5349cd5f1cef98138313 (diff) |
misc changes from bmesh, syncing across to trunk, no functional changes
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 590a48e8085..47deb705def 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -239,6 +239,20 @@ void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const angles[3]= (float)M_PI - angle_normalized_v3v3(ed4, ed1); } +void angle_poly_v3(float *angles, const float *verts[3], int len) +{ + int i; + float vec[3][3]; + + sub_v3_v3v3(vec[2], verts[len-1], verts[0]); + normalize_v3(vec[2]); + for (i = 0; i < len; i++) { + sub_v3_v3v3(vec[i%3], verts[i%len], verts[(i+1)%len]); + normalize_v3(vec[i%3]); + angles[i] = (float)M_PI - angle_normalized_v3v3(vec[(i+2)%3], vec[i%3]); + } +} + /********************************* Geometry **********************************/ /* Project v1 on v2 */ |