Sign in to follow this  
michaelruecker

Random point on and in a conical frustum

Recommended Posts

michaelruecker    196

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?

 

 

Share this post


Link to post
Share on other sites
alvaro    21266
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).

Share this post


Link to post
Share on other sites
michaelruecker    196

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this