2013-02-03 65 views
0

我有3D中的点云。用Mathematica和ListPlot3D函数绘制它们很容易。着色对我来说有点困难。我想得到如下结果:使用Mathematica在3D中着色表面

SphericalPlot3D[ 
1 + Sin[-5 \[Phi]] Sin[-5 \[Theta]]/10, {\[Theta], 
    0, \[Pi]}, {\[Phi], 0, 2 \[Pi]}, 
ColorFunction -> (ColorData["Rainbow"][#6] &), Mesh -> None, 
PlotPoints -> 30, Boxed -> False, Axes -> False] 

这样,颜色就会显示距中心的径向距离。可以做到吗?我也有非常接近球形的云层数据,更确切地说是球形的凸起。

回答

0

你可以这样做:

nPoints = 10^3; 
SeedRandom[7]; 
data = CoordinateTransformData["Spherical" -> "Cartesian", "Mapping", #] & /@ 
    Transpose[{1 + RandomReal[{-0.15, 0.15}, nPoints], RandomReal[{0, Pi}, nPoints], RandomReal[{-Pi, Pi}, nPoints]}]; 

ListSurfacePlot3D[data, 
ColorFunction -> (ColorData["Rainbow"][EuclideanDistance[{0, 0, 0},{#1, #2, #3}]] &), 
ColorFunctionScaling -> False, Mesh -> None, Boxed -> False, Axes -> False] 

plot