Context: trying to draw a 3d geometry using points only.

Looking for ways (efficiency vs precision) to evenly distribute N amount of 3d points over a 3D plane made of 3 vertices - see image below: enter image description here

So, with given three 3D points (A.xyz, B.xyz, C.xyz), how to generate an array of N 3D points that evenly spread/distribute over the surface.

Put another way, if I had N points to paint a triangle surface, where should I place these points on the plane so that the surface appears fully painted.

Your help would be much appreciated!

  • $\begingroup$ What does "evenly spread" mean? $\endgroup$ – NoChance Aug 26 '16 at 18:42
  • $\begingroup$ Sorry I don't know the right vocabulary for this. I guess I meant the output points ideally should be distributed over the full surface, without concentrations toward corners or center. Which is also what I referred to when comparing efficiency versus precision. $\endgroup$ – mika Aug 26 '16 at 18:54
  • 1
    $\begingroup$ Maybe you mean that the minimal distance between pairs of points should be maximised. Maybe you mean that the average density in some sense should be minimal. There are probably many different ways to formulate this which gives different answers. $\endgroup$ – mathreadler Aug 26 '16 at 19:34
  • $\begingroup$ From which angle? $\endgroup$ – mathreadler Aug 26 '16 at 20:01
  • $\begingroup$ Why not just use a random number generator to generate 3 values for x,y,z and repeat the process 3 times, then test if what you get is a triangle or not. $\endgroup$ – NoChance Aug 26 '16 at 20:01

For an even spreading, I advocate a barycentrical approch. It suffices to use the set of points:


with a double loop "for $u=0..20$, for v=$0..(20-u)$" (take care of this limit $20-u$).

Explanation: points such as the ones described in (1) are of the symbolic form $M=\alpha a+\beta b+\gamma c$ with $\alpha + \beta + \gamma = 1$ (check it...) ; they are inside the triangle defined by points $a,b,c$, and, in a reciprocal way, any point in this triangle is such that it can be written in this way ($\alpha, \beta, \gamma$ are called the "barycentrical coordinates" of $M$).

If you don't want the sides of the triangle to be "painted", use loops beginning at 1 and ending at $19.$

Of course, $20$ is just there as an example ; it can be replaced by any other integer constant.

  • $\begingroup$ This is close to what I'm looking for, but it's renders a 4 sides polygon, not 3 sided - see: i.imgur.com/wdwzWwy.png $\endgroup$ – mika Aug 26 '16 at 23:41
  • $\begingroup$ here is an example render of a sphere geometry using your algorithm: i.imgur.com/r4DZgGP.png It looks kind of nice :) But how could i remove the extra triangles? $\endgroup$ – mika Aug 27 '16 at 0:31
  • $\begingroup$ Adding if ( v>uLength-u ) continue; did the trick, thanks! $\endgroup$ – mika Aug 27 '16 at 3:49
  • $\begingroup$ Sorry for having forgot this restriction... $\endgroup$ – Jean Marie Aug 27 '16 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.