Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Is there SphericalListPlot3D?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125685] Re: Is there SphericalListPlot3D?
  • From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
  • Date: Thu, 29 Mar 2012 02:56:06 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201203280958.EAA11063@smc.vnet.net>


On Wed, 28 Mar 2012, Ted Sariyski wrote:

> Hi,
> I have two related questions.
>
> 1. I have a discrete set of data, {{n1,rad1},{n2,rad2},...}, where n1,n2
> are unit vectors (directions) and rad1,rad2,... are scalars. How can I
> plot rad on the unit sphere?
>
> 2. I would like to triangulate the sphere based on the solution {rad} so
> that the mesh is denser where the rad is higher.
>
> Any suggestions are highly appreciated.
> Thanks,
> --Ted
>
>
>
>

Ted,

this should get you started:

Needs["TetGenLink`"]

(* generate some points, you have those *)
nn = 1000;
dlong = \[Pi]*(3 - Sqrt[5]);
dz = 2/nn;
long = 0;
z = 1 - dz/2;
pts = Table[r = Sqrt[1 - z*z]; val = {Cos[long]*r, Sin[long]*r, z};
     z = z - dz; long = long + dlong; val, {i, 0, nn - 1}] // N;


inInst = TetGenCreate[]
TetGenSetPoints[inInst, pts]
outInst = TetGenTetrahedralize[inInst, ""]
coords = TetGenGetPoints[outInst];
(* +1 bug in TetGen *)
surface = TetGenGetFaces[outInst] + 1;


cf = ColorData["DarkRainbow"];
(* your rad should be the values *)
values = Rescale[Range[Length[coords]] // N];
vc = Developer`ToPackedArray@(List @@@ (cf[#] & /@ values));

(*visualize*)
Graphics3D[
  GraphicsComplex[coords, Polygon[surface], VertexColors -> vc],
  Boxed -> False]

Graphics3D[{Specularity[1, 50], EdgeForm[],
   GraphicsComplex[coords, Polygon[surface], VertexColors -> vc]},
  Boxed -> False, Lighting -> "Neutral"]


Hope this helps,

Oliver



  • Prev by Date: Re: Is there SphericalListPlot3D?
  • Next by Date: Re: DialogInput in ButtonFunction
  • Previous by thread: Is there SphericalListPlot3D?
  • Next by thread: Re: Is there SphericalListPlot3D?