MathGroup Archive 2011

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

Search the Archive

Re: Coordinates from Graphics3D images

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117854] Re: Coordinates from Graphics3D images
  • From: Howard Fink <howardfink at gmail.com>
  • Date: Sat, 2 Apr 2011 02:39:39 -0500 (EST)

This was just what I was looking for.  I modified the code to create a scale
model.  Initially there was some clipping:  It was the ListPlot3D doing the
clipping, and PlotRange->All fixed it.
http://finkh.wordpress.com/2011/03/31/scaled-and-curved/ has an initial
result.  This is from a 4 pixels per degree file, and the data available is
now up to 1024 pixels per degree.

(*importing data*)
data = ImageData[Import["/Users/finkh/Desktop/ldem_4.tif"]];
data = data *2^15;
(*for periodicity purposes*)(*sector of interest*)
thetaRange = {30 Degree, 60 Degree};
phiRange = {120 Degree, 180 Degree};
sector = Take[data,
   Round[Rescale[thetaRange, {0., Pi}, {1, Dimensions[data][[1]]}]],
   Round[Rescale[phiRange, {0., 2 Pi}, {1, Dimensions[data][[2]]}]]];

r = 1737400;
(*for transforming to cartesian coordinates*)

pt[{ph_, th_, e_}] := {Sin[th] Cos[ph], Sin[th] Sin[ph],
    Cos[th]} (r + e);
rotMat = RotationMatrix[{pt[{Total[phiRange]/2, Total[thetaRange]/2,
     r}], {0, 0,
    1}}];(*rotating the center of the sector*)(*plot in spherical \
coordinates*)plot =
 ListPlot3D[sector, DataRange -> {phiRange, thetaRange}, Mesh -> None,
   NormalsFunction -> None, PlotRange -> All];
(*transformation to cartesian coordinates*)

sphPlot =
  Release[plot /.
    GraphicsComplex[a_, c__] ->
     GraphicsComplex[Hold[rotMat.pt[#] & /@ a], Hold[c]]];
Show[sphPlot, PlotRange -> All, Boxed -> False, Axes -> None]


  • Prev by Date: Root Reduce
  • Next by Date: Re: Trigonometry
  • Previous by thread: Root Reduce
  • Next by thread: bash script in mathematica?