1
$\begingroup$

Let's define a three-dimensional surface

Clear["Global`*"];
Φcl = (-G*Mcl)/Sqrt[x^2 + y^2 + z^2 + a^2];
Φeff = Φcl + 1/2*(κ2 - 4*ω^2)*x^2 + 1/2*v2*z^2;

G = 1; Mcl = 2.2; a = 0.182;
κ2 = 1.8; ω = 1; v2 = 7.6;

E0 = -3.2;

and create the corresponding contour plot

rm = 1;
P0 = ContourPlot3D[Φeff == E0, {x, -rm, rm}, {y, -rm, rm}, {z, -rm, rm},
     Mesh -> None]

enter image description here

Now I want the following: Define $N$ $(x,y,z)$ points, let's say $N = 10000$, equally placed on this 3D surface. In other words, I want to recreate this surface using $N$ points to cover the surface fully. Of course, the inside of this surface will be hollow again.

I am using version 9.0 of Mathematica.

Any suggestions?

$\endgroup$
  • $\begingroup$ What do you mean by equally placed? The distance between the points have to be equal or what? $\endgroup$ – RunnyKine Apr 30 '16 at 9:03
  • $\begingroup$ @RunnyKine I mean that there must be so many points $(N)$ so that there no holes in the outer shell. The interior should not be visible. $\endgroup$ – Vaggelis_Z Apr 30 '16 at 9:07
6
$\begingroup$

Well, you can use DiscretizeGraphics and RandomPoint to achieve what you want:

P0 = ContourPlot3D[Φeff == E0, {x, -rm, rm}, {y, -rm, rm}, {z, -rm, rm}, 
                   Mesh -> None, Lighting -> None];

Note the Lighting -> None option, this is to circumvent a bug in DiscretizeGraphics that the good people at Wolfram refuse to fix.

gg = DiscretizeGraphics[P0];
pts = RandomPoint[gg, 30000]; (* increase the number of points if you like *)

Mathematica graphics

$\endgroup$
  • $\begingroup$ Well, I'm using v9 and DiscretizeGraphics as well as RandomPoint are not recognized. $\endgroup$ – Vaggelis_Z Apr 30 '16 at 9:16
  • 3
    $\begingroup$ @Vaggelis_Z. How was I supposed to know your version of Mathematica? $\endgroup$ – RunnyKine Apr 30 '16 at 9:17
  • $\begingroup$ I'm really sorry. I will edit my post, including the version. $\endgroup$ – Vaggelis_Z Apr 30 '16 at 9:18
3
$\begingroup$
Clear["Global`*"];
Φcl = (-G*Mcl)/Sqrt[x^2 + y^2 + z^2 + a^2];
Φeff = Φcl + 1/2*(κ2 - 4*ω^2)*x^2 + 1/2*v2*z^2;

G = 1; Mcl = 2.2; a = 0.182;
κ2 = 1.8; ω = 1; v2 = 7.6;

E0 = -3.2;

rm = 1;
P0 = ContourPlot3D[Φeff == E0, {x, -rm, rm}, {y, -rm, rm}, {z, -rm, rm},
     Mesh -> None]

Now extract the points from the surface

pts = First@Cases[P0, GraphicsComplex[points_, ___] :> points, Infinity]
Length[pts]

26684

Graphics3D[{Opacity[0.1], Point[pts]}]

enter image description here

You can use Interpolation to generate a function for the surface as well using the data as a whole or segmentwise.

$\endgroup$

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.