For uniform points on a circle or cone of radius R and height / height H:
generate: angle= uniform_random(0,2*pi) value= uniform_random(0,1) in either case, let: r= R * sqrt(value) then (using separate random numbers for each): circle_point= point3d( r*cos(angle), r*sin(angle), H ) or: cone_point= point3d( r*cos(angle), r*sin(angle), r*H )
Please note: if you need a base on your cone, you will need to do this separately from the curved shape. To make sure that the density of points is the same for different parts, a simple way is to calculate the area of ββthe parts and create a proportional number of points for each part.
sqrt (value) is what ensures that the density of your random points is uniform. As mentioned in other issues, this requires a triangular distribution; taking sqrt () turns the uniform distribution on [0,1) into a triangular one.
For the cylinder you do not need sqrt (); curved part:
cylinder_point= point3d( R*cos(angle), R*sin(angle), H*value )
comingstorm
source share