#VRML V2.0 utf8 #
# ex-tran3.wrl # Example : Transformation Node # Draw 3 cones at different locations and a box # 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) box located at (0,0,0) Shape{ appearance Appearance { material Material { specularColor .0 1. .0 } } geometry Box{} } #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 #rotation : 0 0 1 0 (default) #scale : 1 1 1 (default) #scaleOrientation : 0 0 1 0 (default) #translation : translated on x -> 3 0 0 #children : cone #bboxCenter: 0 0 0 (default) #bboxSize : -1 -1 -1 (default) #example : Transform{ #center works together with rotation. It defines # an offset : in that case x will move +1 more the rotation (clockwise) center 1 0 0 #we are rotating on z, 45 degree (counterclockwise) rotation 0 0 1 1 scale 1. 1. 1. scaleOrientation 0 0 1 0 translation 0 0 0 children [ # Now draw a red (specular) cone Shape{ appearance Appearance { material Material { specularColor 1. 0. .0 } } geometry Cone{} } ] } # a new object (not a child of the first one) Transform{ center 0 0 0 #we are rotating on z, 45 degree (clockwise) rotation 0 0 -1 1 scale 1. 1. 1. scaleOrientation 0 0 1 0 #translation of (4,0,0) translation 4 0 0 children [ # Now draw a blue (specular) cone Shape{ appearance Appearance { material Material { specularColor 0. 0. 1. } } geometry Cone{} } ] } # a new object (not a child of the first or second ones) Transform{ center 0 0 0 rotation 0 0 -1 0 #scale and scale orientation work together to specify scaling in #arbitrary directions ( e.g. scaling in x and rotating in z) scale 1.5 1. 1. scaleOrientation 0 0 1 1 # translating just to a better visualization translation 0 2.3 0 children [ # Now draw a magenta (specular) cone located at (4,0,0) Shape{ appearance Appearance { material Material { specularColor 1. 0. 1. } } geometry Cone{} } ] } #