Transforming shapes
arches.wrl

	

#VRML V2.0 utf8
#
#  arches.wrl
#  Gazebo made of arches
#        by David R. Nadeau
#
#  This example illustrates the use of Transform grouping nodes and their
#  translation, rotation, and scale features.
#
#  First, an Arch is created in a group.  The Arch includes of
#  left and right columns, each positioned using a Transform group and
#  its translation field.
#
#  Next, each Arch group includes a horizontal box spanning the two
#  columns.  The box is translated up to the top of the columns using a
#  Transform group node.
#
#  The angled top of each Arch is created using two boxes, each rotated
#  about the Z axis to tilt them.  A translation then positions the tilted
#  boxes at the top of the archway.
#
#  Next, the entire Arch group is instanced multiple times, rotating
#  each instance to create a circle of archs forming a gazeebo-like
#  structure.
#
#  Finally a base for the structure is added.
#

DEF Arch Transform {
    children [
    # Left and right columns
        Transform {
            translation -2.0 -1.0 0.0
            children [
                DEF Column Shape {
                    appearance DEF White Appearance {
                        material Material { }
                    }
                    geometry Cylinder {
                        radius 0.3
                        height 6.0
                        top FALSE
                        bottom FALSE
                    }
                }
            ]
        }
        Transform {
            translation 2.0 -1.0 0.0
            children [ USE Column ]
        }

    # Cross-piece
        Transform {
            translation 0.0 2.05 0.0
            children [
                Shape {
                    appearance USE White
                    geometry Box { size 4.6 0.4 0.6 }
                }
            ]
        }

    # Roof pieces
        Transform {
            translation -1.15 3.12 0.0
            rotation 0.0 0.0 1.0  0.524
            children [
                DEF Roof Shape {
                    appearance USE White
                    geometry Box { size 2.86 0.4 0.6 }
                }
            ]
        }
        Transform {
            translation 1.15 3.12 0.0
            rotation 0.0 0.0 1.0  -0.524
            children [ USE Roof ]
        }
    ]
}
Transform {
    rotation 0.0 1.0 0.0 0.785
    children [ USE Arch ]
}
Transform {
    rotation 0.0 1.0 0.0 -0.785
    children [ USE Arch ]
}
Transform {
    rotation 0.0 1.0 0.0 1.571
    children [ USE Arch ]
}

# Floor
Transform {
    translation 0.0 -4.125 0.0
    children [
        Shape {
            appearance USE White
            geometry Cylinder {
                radius 3.0
                height 0.25
                bottom FALSE
            }
        }
    ]
}
Transform {
    translation 0.0 -4.375 0.0
    children [
        Shape {
            appearance USE White
            geometry Cylinder {
                radius 4.0
                height 0.25
            }
        }
    ]
}