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

Separator {
	# Options: ON OFF AUTO
	renderCulling AUTO
	
	OUTPUT_TO HalfCylinder.wrl
	
	# Approximate a half cylinder using two half circle planes, a face, and 6 sides
	
	# Data for a half cyclinder
	DEF shapeData Coordinate3 {
		point [ ]
	}
	
	# Define the data for the top half a circle
	LOOP {
		fields [ SFFloat start, SFFloat end, SFFloat step, SFFloat position]
		start 0
		end 181'deg
		step 180'deg/6
		
		APPEND shapeData:point (cos(position),1,sin(position))
	}
	
	# Define the data for the bottom half a circle
	LOOP {
		fields [ SFFloat start, SFFloat end, SFFloat step, SFFloat position]
		start 0
		end 181'deg
		step 180'deg/6
		
		APPEND shapeData:point (cos(position),-1,sin(position))
	}

	DEF shapeIndex IndexedFaceSet {
		coordIndex [ ]
	}

	# Connect the points to make a half cylinder

	APPEND shapeIndex:coordIndex (0,1,2,3,4,5,6,-1) # Top half
	APPEND shapeIndex:coordIndex (7,8,9,10,11,12,13,-1) # Bottom half
	APPEND shapeIndex:coordIndex (0,7,13,6,-1) # The slice

	APPEND shapeIndex:coordIndex (0,7,8,1,-1) # The sides
	APPEND shapeIndex:coordIndex (1,8,9,2,-1) # The sides
	APPEND shapeIndex:coordIndex (2,9,10,3,-1) # The sides
	APPEND shapeIndex:coordIndex (3,10,11,4,-1) # The sides
	APPEND shapeIndex:coordIndex (4,11,12,5,-1) # The sides
	APPEND shapeIndex:coordIndex (5,12,13,6,-1) # The sides
}
[ RETURN TO DIRECTORY ]