Metropoli BBS
VIEWER: helix1.vxr MODE: TEXT (ASCII)
#VRML V1.0 ascii

Separator {
	# Options: ON OFF AUTO
	renderCulling AUTO
	
	OUTPUT_TO Helix1.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 creates the data for the helix using the parametric equations
	# 	x = r cos t
	# 	y = r sin t
	# 	z = t   
	
	LOOP {
		fields [ SFLong start, SFLong end, SFLong step, SFLong position,
			SFFloat t, SFFloat r ] # Define r and t
		start 0
		end 50
		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 ()
	}
	
	# Next, connect the helix data points using polygons
	
	DEF faceSet IndexedFaceSet {
		coordIndex [] # MFLong
		materialIndex -1 # MFLong
		normalIndex -1 # MFLong
		textureCoordIndex -1 # MFLong
	}

	LOOP {
		fields [ SFLong start, SFLong end, SFLong step, SFLong position ]
		start 0
		end 45
		step 2
		
		# To make sure that the polygon is visible from both sides
		# We define a "separate" polygon for each side
		
		# Clock wise definition of polygon
		APPEND faceSet:coordIndex position
		APPEND faceSet:coordIndex position+1  
		APPEND faceSet:coordIndex position+2  
		APPEND faceSet:coordIndex -1  
		
		# Counter clockwise definition of polygon
		APPEND faceSet:coordIndex position+2  
		APPEND faceSet:coordIndex position+1  
		APPEND faceSet:coordIndex position
		APPEND faceSet:coordIndex -1  
	}
}
[ RETURN TO DIRECTORY ]