Marc-B-Reynolds / Marc-B-Reynolds.github.io

My ramblin' blog
https://marc-b-reynolds.github.io/
The Unlicense
5 stars 0 forks source link

Comment re: distribution/2017/01/27/UniformRot.html #3

Open dubois opened 5 years ago

dubois commented 5 years ago

Hi; I wasn't sure how to leave a comment, so I'm (ab)using issues ;-)

This page was a great source of reference material; thanks for also including links to primary sources like Marsaglia's paper!

While implementing Marsaglia's random-quat, I noticed that his formula includes p1 / sqrt(d1), which normalizes a random point in the unit circle. This is a roundabout way of generating a random point on the unit circle. An improvement is to generate a point on the unit circle directly:

IOW, you can do this and still be correct:

  // instead of float d1 = uniform_disc(&p1);
  uniform_circle(&p1);  
  float d1 = 1;
Marc-B-Reynolds commented 5 years ago

Thanks! Yeah, I nuked comments since I was previously using Disqus.

Yes, you're correct and I should clarify that at some point. My assumption when writing was: on CPU and using the rejection method for disc.