2

I have an implicitly defined hypersurface in R^3, given by the zero level set of some function F:

F(x,y,z) = 0.

This part may not matter but: I want to plot this surface using the answers given in this or this thread.

Now I want to take a random sample of points from this surface. Does anyone know the best way to do this?

BBB
  • 55
  • 4
  • Is the surface bounded? Can you compute the bounds? Is the surface parametrisable? Do you care about the uniformity of the sampling distribution? Maybe choose random values for 2 out of 3 variables and then solve for the third. – Oscar Benjamin Mar 21 '22 at 14:01

1 Answers1

0

Well, simple way would be:

  1. Triangulate implicit surface. For implicit surface there are variations of marching cubes, I believe, already done.

  2. Given list of triangles, compute total area A=Sum(Ai), and probabilities pi = Ai/A. Probabilities would be normalized, Sum(pi)=1

  3. Sample particular triangle i using probabilities pi. Numpy.random.choice should help.

  4. Given selected triangle, generate uniform point in the triangle using Generate random locations within a triangular domain

Severin Pappadeux
  • 18,636
  • 3
  • 38
  • 64