【问题标题】:2d to 3d - how to wrap a drawing around a cylinder2d 到 3d - 如何将绘图包裹在圆柱体周围
【发布时间】:2011-08-23 19:36:52
【问题描述】:

我有在 3d 空间中旋转的图形(具有 x 和 y 坐标的点数组): http://www.motiondraw.com/md/as_samples/Testing/_mindreader/main.html

现在,这幅画看起来好像被一个立方体包裹着,角落里有一个令人讨厌的 90° 度。相反,它应该看起来好像被包裹在一个圆柱体上。 在开始旋转之前,我调用了一个函数(在 ActionScript 中)“bendDrawing”,它为每个点设置一个初始 z 值:

for (var j = 0; j // 绘图居中 - 中心左侧的点

var wid = 350;// this could be the radius of the cylinder

// NOTE: suboptimal, as the image gets a 90° corner in the center, at its highest point
// what it should look like: as if the image was wrapped around a cylinder, i.e. in a circular shape
// is that pythagoras? draw triangle, calc distance from base, add to this to c?
var z = wid - distFromCenter;

shape[i].points[j].z =  Math.abs( z);

}

我就是无法理解这个 ;-) 任何指针都非常感谢!

安德烈亚斯·韦伯

【问题讨论】:

  • 您可能想查找圆柱坐标系及其投影。

标签: actionscript-3 3d projective-geometry


【解决方案1】:

试试这个:

shape[i].points[j].z  = 
    wid * Math.cos((shape[i].points[j].x / wid) * (0.5 * Math.PI));

【讨论】:

  • shape[i].points[j].z = wid * Math.cos((shape[i].points[j].x / wid) * (0.5 * Math.PI)); 就像一个咒语 - 这正是我所需要的。非常感谢!
猜你喜欢
  • 2014-12-16
  • 2011-10-01
  • 2017-04-21
  • 1970-01-01
  • 2020-08-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多