Mathematica中如何把图片贴到球面或圆柱面上?

比如,球面的效果在地图学里面应该常用:


原理是利用特定的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://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

http://www.faqoverflow.com/mathematica/52.html

https://www.wolfram.com/mathematica/new-in-8/new-and-improved-scientific-and-information-visualization/apply-textures-to-surfaces-and-regions.html

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值