比如,球面的效果在地图学里面应该常用:
原理是利用特定的3D曲面绘图函数中的"图像纹理填充"效果实现;
纹理填充可展曲面圆柱面无须坐标变换; 纹理填充非可展曲面球面则需要作坐标转换;
代码如下:
ClearAll["`*"];
map = Import["http://jan.ucc.nau.edu/~rcb7/400marect.jpg"]
pic1 = SphericalPlot3D[1, {u, 0, Pi}, {v, 0, 2 Pi}, Mesh -> None,
TextureCoordinateFunction -> ({#5, 1 - #4} &),
PerformanceGoal -> "Quality", PlotStyle -> Directive[Texture[map]],
Lighting -> "Neutral", Axes -> False, RotationAction -> "Clip",
Boxed -> False]
pic2 = RevolutionPlot3D[{Cos[t], Sin[t], \[Theta]}, {t, 0,
2 Pi}, {\[Theta], 0, 2},
Mesh -> None,
PerformanceGoal -> "Quality", PlotStyle -> Directive[Texture[map]],
Lighting -> "Neutral", Axes -> False, RotationAction -> "Clip",
Boxed -> False]
效果如下:
更正: 上面贴圆柱面的代码是有问题的; 改用下面方式演示:
pic = Import["http://i.stack.imgur.com/5JpK4.jpg"]
{width, height} = ImageDimensions[pic];
w = 40; h = 45;
pic = ImageTake[pic, {h, height - h}, {w, width - w}]
ParametricPlot3D[{Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]}, {u, 0,
2 Pi}, {v, 0, Pi}, Mesh -> None, PlotPoints -> 100,
TextureCoordinateFunction -> ({#4, 1 - #5} &), Boxed -> False,
PlotStyle -> Texture[Show[pic, ImageSize -> 1000]],
Lighting -> "Neutral", Axes -> False, RotationAction -> "Clip",
ViewPoint -> {-2.026774, 2.07922, 1.73753418}, ImageSize -> 600]
ParametricPlot3D[{Cos[t], Sin[t], \[Theta]}, {t, 0, 2 Pi}, {\[Theta],
0, 2}, Mesh -> None, PerformanceGoal -> "Quality",
PlotStyle -> Directive[Texture[map]], Lighting -> "Neutral",
Axes -> False, RotationAction -> "Clip", Boxed -> False]
原始图片来自:
http://i.stack.imgur.com/5JpK4.jpg
![](http://i.stack.imgur.com/5JpK4.jpg)
边缘裁剪并改色调:
用参数曲面方式贴图:
深入学习参考:
http://mathematica.stackexchange.com/questions/27493/how-can-i-put-an-image-on-a-surface
http://mathematica.stackexchange.com/questions/60427/how-to-make-a-3d-topographic-globe
http://mathematica.stackexchange.com/questions/3646/how-to-make-a-3d-globe