Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-14 12:12:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-14 12:12:19 +0400
commit8d96ea832247e4c457bb0f080c079e639a11c405 (patch)
tree630d72badbeddc80a2a2b1292ff8d1f9f9cbca36 /source/blender/blenlib/intern/rand.c
parentb54793ef0265e5a93678e0f900948a17669185a9 (diff)
BLI_rand: add BLI_rng_get_float_unit_v2
Diffstat (limited to 'source/blender/blenlib/intern/rand.c')
-rw-r--r--source/blender/blenlib/intern/rand.c7
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;