distributing points over the surface

Started by
8 comments, last by LilBudyWizer 18 years, 3 months ago
I have a model loaded in a directx app and generating poinsts randomly over the model surface. I want to arrange these points as to be placed uniformly over the surface not as most points in one triange and none in other. How can this be acheived? Thanks
Advertisement
First randomly pick the triangle, weighted by the area of each triangle. Then uniformly sample a random point within the triangle. Tell me if you need help with either of these steps.
You can get better results with that method if you stratify points in the rectangle containing the triangle, then fold them back over.

The best way to do a uniform point distribution on the surface of a mesh is to use point repulsion.

First, randomly distribute points on your mesh, then have each point be repelled by its neighbours with a force inversely proportional to the distance between the points. Do this repulsion process in a number of iterative steps, say 5-10, taking care to keep the points constrained to the mesh, and you will end up with something close to a poission distribution (i.e. all points are roughly equidistant from each other).
Quote:Original post by playmesumch00ns
You can get better results with that method if you stratify points in the rectangle containing the triangle, then fold them back over.

Well, the parallelogram containing the triangle, not the rectangle containing the triangle. But yeah, that's the standard method for uniform sampling within a triangle. As for the iterative relaxation you suggest... TriML, do you want points randomly distributed but overall uniformly distributed, or do you want them in as uniform a manner (think geodesic spheres) as possible?
Thanks for the replies

Sneftel:
What i m currently doing is picking a triangle randomly from the list of all triangles of the mesh, dont know about area-weighted...and then generating a point randomly in this triangle. This is fine, points are being generated on the surface of the model but they are not enenly distributed.

playmesumch00ns:
So for point repulsion, i have to calculate the force between points. Can u explain it a little?
Quote:Original post by Sneftel
do you want points randomly distributed but overall uniformly distributed


yes that's the case

Quote:Original post by TriML
What i m currently doing is picking a triangle randomly from the list of all triangles of the mesh, dont know about area-weighted.


Area weighting is important. Otherwise, most points are going to end up in high-poly regions like faces.
Quote:Original post by Sneftel
Area weighting is important. Otherwise, most points are going to end up in high-poly regions like faces.


hmm... and how can i do that? and will it produce points uniform on the surface?
say you got three triangles (t1,t2,t3) the first two of which are 1 square meter and the third is 3 square meter. so you pick a triangle based on these probability

p(t1) = 1/(3+1+1) = 1/5
p(t2) = 1/5
p(t3) = 3/5

there are many ways to do this. the most straightforward way is when you know how many samples you want to take. say I know I want to take 10,000 samples. I just simply do this.

sample t1 10000*1/5 times
sample t3 10000*3/5 times
etc etc.

Tim
Look at it like throwing darts at a dartboard. You have a smaller chance of hitting the bullseye because it is smaller. Throwing darts doesn't result in a uniform distribution but it serves to show intuitively that your chance depends upon the area.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement