About the rotation in Fig
1. Orientation of Viewpoint
Orientation X Y Z DETA
The first three values are coordinates (x, y, z), which are connected to (0, 0, 0,
Is a vector M pointing from (0, 0, 0) to (x, y, z), that is, it
Only direction, no position.
At the position point, take the vector m as the center axis and rotate the angle DETA to determine
The direction of this viewpoint is now.
If the value of DETA is greater than 0, the angle of view is converted counterclockwise;
DETA <0, the clockwise angle of view.
# Fig
Viewpoint
{
Position 0 0 20 # coordinates of the viewpoint
Orientation 0 1 0 0.78 # determine a positive y vector, turning 45 degrees counter-clockwise, watching the ball
# Orientation 0 1 0 0 # normal view, facing the square
# Orientation 0 1 0-0.78 # Turn right 45 degrees, view the cylinder
}
Transform # the ball on the negative axis of the Origin
{
Translation-10 0 0
Children
[
Shape
{
Appearance appearance {}# gray
Geometry sphere
{
Radius 1
}
}
]
}
Transform # square on the origin, green
{
Translation 0 0 0
Children
[
Shape
{
Appearance appearance
{
Material material
{
Diffusecolor 0 1 0
}
}
Geometry box
{
Size 2 2 2
}
}
]
}
Transform # the column on the X axis, blue
{
Translation 10 0 0
Children
[
Shape
{
Appearance appearance
{
Material material
{
Diffusecolor 0 0 1
}
}
Geometry Cylinder
{
Radius 1
Height 2
}
}
]
}
2. Rotation in the shape. Example: Transform
Rotation X Y Z DETA
The shape rotates the DETA radians around the (0, 0)-> (x, y, z) vector at its position.
DETA> 0, counterclockwise;
DETA <0, clockwise.
# Fig
Transform
{
Translation 8 0 0 # first translate, then rotaion.
Rotation 0 0 1-0.78 # view the left-leaning Column
# Rotation 0 0 1 0.78 # right tilt
Children
[
Shape
{
Appearance appearance
{
Material material
{
Diffusecolor 0 0 1
}
}
Geometry Cylinder
{
Radius 1
Height 2
}
}
]
}