1

3D 空間で回転する図面 (x 座標と y 座標を持つ点の配列) があります: http://www.motiondraw.com/md/as_samples/Testing/_mindreader/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);

}

私はこれに頭を包むことはできません;-)ポインタは大歓迎です!

アンドレアス・ウェーバー

4

1 に答える 1

2

これを試して:

shape[i].points[j].z  = 
    wid * Math.cos((shape[i].points[j].x / wid) * (0.5 * Math.PI));
于 2011-05-12T04:55:01.133 に答える