diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-06-14 12:12:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-14 12:12:19 +0400 |
commit | 8d96ea832247e4c457bb0f080c079e639a11c405 (patch) | |
tree | 630d72badbeddc80a2a2b1292ff8d1f9f9cbca36 /source/blender/blenlib/intern | |
parent | b54793ef0265e5a93678e0f900948a17669185a9 (diff) |
BLI_rand: add BLI_rng_get_float_unit_v2
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/rand.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c index a5d6e2f7c1e..410f98897ce 100644 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@ -117,6 +117,13 @@ float BLI_rng_get_float(RNG *rng) return (float) BLI_rng_get_int(rng) / 0x80000000; } +void BLI_rng_get_float_unit_v2(RNG *rng, float v[2]) +{ + float a = (float)(M_PI * 2.0) * BLI_rng_get_float(rng); + v[0] = cosf(a); + v[1] = sinf(a); +} + void BLI_rng_get_float_unit_v3(RNG *rng, float v[3]) { float r; |