2d 到 3d - 如何将绘图包裹在圆柱体上
我有在3D空间中旋转的图纸(带有X和Y坐标的点的阵列): http://www.motiondraw.com/mtdraw.com/mddraw.com/md/as_samples/tesmples/testesmples/testesting/testing/testing/_mindreadreadreadreder /main.html
现在,图纸看起来好像包裹在一个立方体上,角落里的90°程度。相反,它看起来好像被缠绕在圆柱体上。 在启动旋转之前,我称为函数(在ActionScript)“ benddrawing”,每个点都设置了一个初始z值:
for(var j = 0; j< numpoints; j ++){
//绘图是集中的 - 中心的左点为< 0 var distfromcenter = math.abs(shape [i] .points [j] .x);
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);
}
我只是无法缠绕我的头;-) 任何指针都非常感谢!
安德烈亚斯·韦伯
I have drawings (arrays of points with x and y coordinates) that are rotated in 3d space:
http://www.motiondraw.com/md/as_samples/Testing/_mindreader/main.html
As it is now, the drawing looks as if wrapped around a cube, with a nasty 90° degree in the corner. Instead it should look as if it were wrapped around a cylinder.
Before starting the rotation I call a function (in ActionScript) 'bendDrawing' that for each point sets an initial z-value:
for (var j = 0; j < numPoints; j++ ) {
// drawings are centered – points left of center are < 0
var distFromCenter = Math.abs(shape[i].points[j].x);
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);
}
I just can't wrap my head around this ;-)
Any pointers much appreciated!
Andreas Weber
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
try this: