VRML : Chemistry in VRML
Source code for example 6 : A dz2 orbital
#VRML V1.0 ascii
#An atom with the dz squared orbital
Separator {
#Setup lights, camera, and materials as always
DirectionalLight { direction 0 0 -1 }
DirectionalLight { direction 0 -1 0 }
PerspectiveCamera {
position 8 3 8
orientation 0 1 0 0.7853
}
Material {
diffuseColor 0 1 0
ambientColor 0 0.2 0
}
#Create the axes as before
DEF gaxis Cylinder {
height 10
radius 0.1
}
Separator {
Rotation { rotation 0 0 1 1.570796 }
USE gaxis
Rotation { rotation 1 0 0 1.570796 }
USE gaxis
}
#Create new material
Material {
diffuseColor 0 0 1
ambientColor 0 0 0.2
}
#As VRML V1.0 has no build in function to create a
#toroid, we have to approximate by using a "squashed"
#sphere. This is relatively simple.
Separator {
Scale { scaleFactor 1 0.3 1 }
Sphere { radius 1 }
}
#Draw p style dumbbell as in example 4
DEF mytrans Translation { translation 0 -1.2 0 }
DEF mycone Cone {
parts SIDES
height 2
bottomRadius 1
}
USE mytrans
DEF atom Sphere { radius 1 }
Rotation { rotation 1 0 0 3.151692 }
USE mytrans
USE mytrans
USE mytrans
USE mycone
USE mytrans
USE atom
}
#End of file
Previous Topic (Chemistry in VRML)
Back to the VRML Reference
Back to the Main Page
©Tom Thurston, 1997
Please feel free to use and redistribute this NONcommercially!