Math, circles, interior points and densities [modified]
-
What about using
rand()
for radius and angle and not discarding any? :)I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
But that would just give a uniform distribution along a specific line through the center, which would give a higher density closer to the center. Right?
-- Time you enjoy wasting is not wasted time - Bertrand Russel
-
How about using a Sobol sequence[^] to generate the points?
I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
Thanks - I'll read up a bit on that!
-- Time you enjoy wasting is not wasted time - Bertrand Russel
-
What about using
rand()
for radius and angle and not discarding any? :)I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
That'd cause a skewed density with bias to the center. Found a link: http://mathworld.wolfram.com/DiskPointPicking.html[^]
-- Time you enjoy wasting is not wasted time - Bertrand Russel
-
What about using
rand()
for radius and angle and not discarding any? :)I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
that results in an entirely different distribution, as now the cartesian density is higher near the center. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.
-
that results in an entirely different distribution, as now the cartesian density is higher near the center. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.
Yep. http://mathworld.wolfram.com/DiskPointPicking.html[^]
-- Time you enjoy wasting is not wasted time - Bertrand Russel
-
Yep. http://mathworld.wolfram.com/DiskPointPicking.html[^]
-- Time you enjoy wasting is not wasted time - Bertrand Russel
darts players would like it though, they'd hit bull's eye much oftener[*]. :laugh: [*] trying to keep it a loungy thread.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.
-
What about using
rand()
for radius and angle and not discarding any? :)I hope you realise that hamsters are very creative when it comes to revenge. - Elaine
Because it is plainly wrong. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Yes, I thought about that a bit, but it felt as it would skew the density and give a wrong bias to the points with x/y values inside the circle. I cannot put words on that feeling, so it's probably plain wrong.
-- Time you enjoy wasting is not wasted time - Bertrand Russel
I don't see the problem, namely: Assumed that
X
andY
are independent coordinates.rand()
gives (pseudo)random numbers with uniform distribution.
extracting
N
numbers (withN
big enough) will fill uniformly a square area. Finally cutting a circle from this area, gives you the requested uniformly populated circular area. Of course this is going on my arrogant assumptions... :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I don't see the problem, namely: Assumed that
X
andY
are independent coordinates.rand()
gives (pseudo)random numbers with uniform distribution.
extracting
N
numbers (withN
big enough) will fill uniformly a square area. Finally cutting a circle from this area, gives you the requested uniformly populated circular area. Of course this is going on my arrogant assumptions... :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Maybe you're right - who am I to say? After all, I only have this "feeling" which makes me feel like my wife; she's full of them. Anyway, I'm following http://mathworld.wolfram.com/DiskPointPicking.html[^] now.
-- Time you enjoy wasting is not wasted time - Bertrand Russel
-
Well, it is winter - it makes sense to use polar coordinates :-D
Well, you need to see the question from the right angle... :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Maybe you're right - who am I to say? After all, I only have this "feeling" which makes me feel like my wife; she's full of them. Anyway, I'm following http://mathworld.wolfram.com/DiskPointPicking.html[^] now.
-- Time you enjoy wasting is not wasted time - Bertrand Russel
That way you haven't to discard anything (that would make me feel like my wife... :rolleyes: ). I'm curious about performance, though: you may try both methods, compare them (for correctness and performance) and eventually write an article... :laugh:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]