Jump to content

  • Log In with Google      Sign In   
  • Create Account


Random point on and in a conical frustum


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 me_12   Members   -  Reputation: 196

Like
0Likes
Like

Posted 25 October 2013 - 10:49 AM

Hey guys,

 

I am looking for two formulas to pick evenly distributed random points ON and IN a conical frustum. (I mean the first formula should find a random point ON the frustum and the second formula should give me random points IN that frustum.)

 

conicalfrustum.gif

 

I had no success with Google so far. Does anyone have any useful links or knowledge about this?

 

 



Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 11723

Like
1Likes
Like

Posted 26 October 2013 - 07:09 AM

In both cases, I would pick the height first and then pick a point in the slice at that height.

If you want a point in the frustum, pick a number v between 0 and the volume of the frustum (Pi*(R2^2*+R1*R2+R1^2)*h/3, I believe). You then need to find the height z at which the volume below z is v; you can do that by using the formula for the volume above, where z plays the role of h and one of the radii is linked to it by a simple relationship, and then solving for z. You then pick a random point in the disk at height z (this should be easy to find).

If you want a point on the frustum, I assume you need to generate a random point on the curvy side of the truncated cone. For that, you reason similarly but picking a random breakpoint for area, not volume. You then pick a random point on the circle at the desired height, which is trivial. If you need to generate points on the limiting disks as well, roll a die at the beginning to pick which of the three pieces the point will come from (of course the probability of each piece should be proportional to its area).

#3 me_12   Members   -  Reputation: 196

Like
0Likes
Like

Posted 26 October 2013 - 10:15 AM

Thank you for your answer!

 

After taking your suggestion into consideration, I figured out that those are more operations that I am willing to sacrifice. 

 

Actually it is not that bad if it is not evenly distributed. Even in Unity it isn't either. Guess they also figured, that it is too expensive.

 

Either way, I implemented a not evenly distributed version now which is sufficient for my needs.

 

Thank you in any way!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS