From 40ad1cf0b1203848508cf6389e4337eb5071edf6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 14 Nov 2017 16:10:48 +1100 Subject: BLI: sync changes from 2.8 --- source/blender/blenlib/intern/math_vector.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/blenlib/intern/math_vector.c') diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 5f44c93e169..05562502278 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -849,6 +849,20 @@ void ortho_v2_v2(float out[2], const float v[2]) out[1] = v[0]; } +/** + * Rotate a point \a p by \a angle around origin (0, 0) + */ +void rotate_v2_v2fl(float r[2], const float p[2], const float angle) +{ + const float co = cosf(angle); + const float si = sinf(angle); + + BLI_assert(r != p); + + r[0] = co * p[0] - si * p[1]; + r[1] = si * p[0] + co * p[1]; +} + /** * Rotate a point \a p by \a angle around an arbitrary unit length \a axis. * http://local.wasp.uwa.edu.au/~pbourke/geometry/ -- cgit v1.2.3