Re: 3D surface plotting
- To: mathgroup at smc.vnet.net
- Subject: [mg66310] Re: 3D surface plotting
- From: "Borut Levart" <BoLe79 at gmail.com>
- Date: Tue, 9 May 2006 02:34:59 -0400 (EDT)
- References: <e3mjjm$7lf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Pratham!
My function of choice would probably be ListSurfacePlot3D too, but
"mine" doesn't reside in ExtendGraphics`, but in: Graphics`Graphics3D`.
When a function returns the input data (headed with the function), the
cause can easily lie in a wrong input form. Here is my solution:
First I define a function p2 that generates n random points on a unit
sphere:
p2[n_] :=
With[
{
pts = Table[{2 Pi Random[], ArcCos[2 Random[] - 1]}, {n}]
},
pts /. {f_, t_} -> {Sin[t] Cos[f], Sin[t] Sin[f], Cos[t]}];
This produces a plot of n = 1000 points:
ScatterPlot3D[p2[1000],
Boxed -> False,
Axes -> False]
Now to stretch a surface over these points, one cannot just call
ListSurfacePlot3D, because the input must be in a form of: an array of
3D points that generate vertices in a polygonal mesh. So one must
partition the points: in threes for triangles; in fours for
quadrangles, etc.
Let's try this:
ListSurfacePlot3D[Partition[p2[20], 3]]
This produces some odd overlapping triangles, since the generated
points are random and thus not sorted "polygon-wise." One must sort
them first. But how?
Yes, how. There is an example of sorted sphere points in the Help
Browser under Graphics3D Standard Package (but they are not random).
I don't know anything about the nature of you points. Sort them
polygon-wise, partition this n-couples together, and call the function.
I hope this helps in any way; does it?
Borut Levart
Slovenia