#VRML V1.0 ascii
Separator {
# Options: ON OFF AUTO
renderCulling AUTO
OUTPUT_TO Helix.wrl
DEF BackgroundColor Info {
string ".9 .9 .9"
}
Material {
diffuseColor =Color("yellow")
}
# This is where we will put the data for the helix
DEF dataSet Coordinate3 {
point [] # MFVec3f
}
# This node connects the helix data points using polylines
DEF lineSet IndexedLineSet {
coordIndex [] # MFLong
materialIndex -1 # MFLong
normalIndex -1 # MFLong
textureCoordIndex -1 # MFLong
}
# This node creates the data for the helix using the parametric equations
# x = r cos t
# y = r sin t
# z = b t
LOOP {
fields [ SFLong start, SFLong end, SFLong step, SFLong position,
SFFloat t, SFFloat r ] # Define r and t
start 0
end 200
step 1
t position*.5 # Define t
r position*.1 # Define r
APPEND dataSet:point (r*cos(t),r*sin(t),t) # We need a vector value here so we use ()
APPEND lineSet:coordIndex position # Be careful to specify an existing point index
}
APPEND lineSet:coordIndex -1 # this is needed to end the polyline
}