#VRML V2.0 utf8 #
## ex-tran1.wrl # Example : Transformation Node # Draw 3 cones at different locations # Observer in (0,0,6) looking at (0,0,1) Viewpoint { position 0 0 10 orientation 0 0 1 0 } # First draw a green (specular) cone located at (0,0,0) Shape{ appearance Appearance { material Material { specularColor .0 1. .0 } } geometry Cone{} } #Transform defines a coordinate system for its children that is relative # to the coordinate system of its parents #EventIn addChildren : used to add new nodes (defined elsewhere) to be transformed #EventIn removeChildren : used to avoid transforming defined nodes #center : 0 0 0 (default) ; defines a translation offset (related to rotation) #rotation : 0 0 1 0 (default) #scale : 1 1 1 (default) #scaleOrientation : 0 0 1 0 (default) (related to scale) #translation : translated on x -> 3 0 0 #children : cone #bboxCenter: 0 0 0 (default) #bboxSize : -1 -1 -1 (default) #example : translation to 3,0,0 draw red cone Transform{ center 0 0 0 rotation 0 0 1 0 scale 1 1 1 scaleOrientation 0 0 1 0 #translation to (3,0,0) translation 3 0 0 children [ # Now draw a red (specular) cone Shape{ appearance Appearance { material Material { specularColor 1. 0. .0 } } geometry Cone{} } # add a new transformation to the last transformation # and draw another cone now at (3,0,0) + (0,3,0) # note that this transformation is inside the first child (inside # of the first node Transform) Transform{ center 0 0 0 scale 1 1 1 scaleOrientation 0 0 1 0 #cone is in (3,0,0) add translation (0 3 0) => (3,3,0) translation 0 3 0 children [ # Now draw a blue (specular) cone Shape{ appearance Appearance { material Material { specularColor 0. 0. 1. } } geometry Cone{} } ] } ] } #