VRML 2.0 でいくつかのファイルをプログラムで作成しています。原点に底があり、特定の座標に上がある円柱を作成する必要がありますが、回転を把握するのに問題があります。Google で検索しましたが、VRML 2.0 に関するドキュメントは非常に少ないようです。
私がやろうとしていることに球座標が最適に機能すると仮定したので、目標点 (x、y、z) の球座標 (r、シータ、ファイ) を計算しました。次に、以下のファイルを作成しました。
#VRML V2.0 utf8
DEF v1 Transform {
translation 0 0 0
children Shape {
geometry Sphere {radius .5}
}
}
DEF v2 Transform {
translation x y z
children Shape {
geometry Sphere {radius .5}
}
}
DEF edge Transform {
translation 0 0 0
children Transform {
rotation 0 1 0 theta-pi/2
children Transform {
rotation 0 0 1 phi-pi/2
children Transform {
translation 0 r/2 0
children Shape {
geometry Cylinder {
radius .08
height r
}
}
}
}
}
}
そして、ここにいくつかの値の例を含むバージョンがあります:
#VRML V2.0 utf8
DEF v1 Transform {
translation 0 0 0
children Shape {
geometry Sphere {radius .5}
}
}
DEF v2 Transform {
translation 4 3 3
children Shape {
geometry Sphere {radius .5}
}
}
DEF edge Transform {
translation 0 0 0
children Transform {
rotation 0 1 0 -0.54041949679
children Transform {
rotation 0 0 1 -0.92729521779
children Transform {
translation 0 2.915475947 0
children Shape {
geometry Cylinder {
radius .08
height 5.830951895
}
}
}
}
}
}
この最後のファイルを表示すると、円柱が実際にはかなり近づいていることがわかりますが、まだそこまでではありません。