#VRML V2.0 utf8					
# Axes view-controller prototype a component in a 3D data plotting application 
#   for polar grids 
#     - a 30 deg long by 30 deg lat version 
#   Overwrite lib_Axes_ctrl_polar_sp_proto.wrl to implement this version
# Kurt A. Fisher fisherka@csolutions.net  beginner level VRML coder
# 1/2004

#     The limits of this graph box are set dynamically in the prototype.  
#     The axes, the axes labels and the viewpoints are scaled to a 1 unit size. 
#     A transformation resizes the axes to fit the needed size for the world.  
#
#     VRML normally plots with "z" pointing up out of the screen 
#       and the x-y axis plotting on the flat screen. 
#       The positive x-axis is to the right.
#       The positive y-axis is to the top. 
#
#     For display in normal galactic plane (z at top with positive x 
#       pointing out of the screen and towards the galactic center), 
#       A two-fold rotation is used to rotate the axis and world to the 
#       desired normal orientation. 

#       This rotation into normal galactic display is accomplished with 
#       two fold 90 degree rotations - once around the z axis and once around 
#       the x-axis.  Once these rotations are applied, x, y, z in a standard 
#       VRML rotation, if reference from outside the rotated object, are: 
#		Before		x	y	z
#		After		y	z	x

#       Tickmarks are at scaled 0.10 * scaleAxis[0] / scaleData[0] objects
#       E.g. - 0.10 & 6x axis scale up / 2x object scale up = .3 scale 

#  This application was developed for use in triaxial position modeling 
#   of astronomical objects.  Occassional coding references may reflect this bias. 

#  Objects used: 
#	None -  Axes_Ctrl is a root object 

#   Objects outline
#	Controller 		->Control_Panel -> Views 	
#			-> Axes_ctrl_polar view (this file)	
#			-> Data views (Data_Sets) ->
#				Model ->
#				DataSet (external file) -> Plotting object types (lib directory) 

PROTO AXES_CTRL [ 
	exposedField SFVec3f 	scaleAxis			2.0 2.0 2.0 				# Tickmarks are at scaled 0.10 * scaleAxis[0] / scaleData[0] objects 
	exposedField SFColor	axisColor			0.0 0.0 0.0				#  color for the fonts and axes 
	exposedField SFRotation	convertCoordinateSys	0.000 0.000 0.000 0.000		#  Rotate the entire axes object to a new coordinate system; usually leave as 0 0 0 0.00
#							#      E.g. convert frame between galactic, equatorial and horizon systems 
] # end PROTO Fields
# Begin PROTO OBJECT
{

Transform  { 		# rotate the entire object to new coordinate system 
#			x	y	z	rot
	rotation IS convertCoordinateSys
	children [

# BEGIN AXES OBJECT 
# Two-fold rotation of world to normal galactic presentation - looking down postive x axis l=0 to Orion at l=180 
DEF firstWorldRotationX Transform { 
	rotation 1.0 0.0 0.0 -1.571 # first rotation of world around x-axis
	children [

DEF secondWorldRotationZ Transform { 
	rotation 0.0 0.0 1.0 -1.571 # second rotation of world around z-axis
	children [

# SPHERICAL GRID WITH AUTOMATIC SCALING 
DEF XYZaxis Transform {	
			center 0.0 0.0 0.0 
			translation 0.0 0.0 0.0
			scale IS scaleAxis
	children [

# Adjust the inline object scale to a unity size 
DEF setObjSizeOne Transform { 
			center 0.0 0.0 0.0 
			translation 0.0 0.0 0.0
			scale 1.0 1.0 1.0 

	children [

Shape {
	appearance Appearance {					
		material Material {	
#  Syntax - Color is emissive, not diffuse for lineSet object 			
			emissiveColor IS axisColor
		} # end Material 				
	} # end Appearance 		
	geometry IndexedLineSet {
		coord Coordinate {
			point [
0.000,0.000,1.000, # Index 1 Long 0 Lat 90	Zenith point
0.500,0.000,0.866, # Index 2 Long 0 Lat 60	First ring +60 deg
0.433,-0.250,0.866, # Index 3 Long 330 Lat 60					
0.250,-0.433,0.866, # Index 4 Long 300 Lat 60					
0.000,-0.500,0.866, # Index 5 Long 270 Lat 60					
-0.250,-0.433,0.866, # Index 6 Long 240 Lat 60					
-0.433,-0.250,0.866, # Index 7 Long 210 Lat 60					
-0.500,0.000,0.866, # Index 8 Long 180 Lat 60					
-0.433,0.250,0.866, # Index 9 Long 150 Lat 60					
-0.250,0.433,0.866, # Index 10 Long 120 Lat 60					
0.000,0.500,0.866, # Index 11 Long 90 Lat 60					
0.250,0.433,0.866, # Index 12 Long 60 Lat 60					
0.433,0.250,0.866, # Index 13 Long 30 Lat 60					
0.866,0.000,0.500, # Index 14 Long 0 Lat 30	Second ring +30 deg
0.750,-0.433,0.500, # Index 15 Long 330 Lat 30					
0.433,-0.750,0.500, # Index 16 Long 300 Lat 30					
0.000,-0.866,0.500, # Index 17 Long 270 Lat 30					
-0.433,-0.750,0.500, # Index 18 Long 240 Lat 30					
-0.750,-0.433,0.500, # Index 19 Long 210 Lat 30					
-0.866,0.000,0.500, # Index 20 Long 180 Lat 30					
-0.750,0.433,0.500, # Index 21 Long 150 Lat 30					
-0.433,0.750,0.500, # Index 22 Long 120 Lat 30					
0.000,0.866,0.500, # Index 23 Long 90 Lat 30					
0.433,0.750,0.500, # Index 24 Long 60 Lat 30					
0.750,0.433,0.500, # Index 25 Long 30 Lat 30					
1.000,0.000,0.000, # Index 26 Long 0 Lat 0	Third ring +0 deg
0.866,-0.500,0.000, # Index 27 Long 330 Lat 0					
0.500,-0.866,0.000, # Index 28 Long 300 Lat 0					
0.000,-1.000,0.000, # Index 29 Long 270 Lat 0					
-0.500,-0.866,0.000, # Index 30 Long 240 Lat 0					
-0.866,-0.500,0.000, # Index 31 Long 210 Lat 0					
-1.000,0.000,0.000, # Index 32 Long 180 Lat 0					
-0.866,0.500,0.000, # Index 33 Long 150 Lat 0					
-0.500,0.866,0.000, # Index 34 Long 120 Lat 0					
0.000,1.000,0.000, # Index 35 Long 90 Lat 0					
0.500,0.866,0.000, # Index 36 Long 60 Lat 0					
0.866,0.500,0.000, # Index 37 Long 30 Lat 0					
0.866,0.000,-0.500, # Index 38 Long 0 Lat -30	Fourth ring -30 deg
0.750,-0.433,-0.500, # Index 39 Long 330 Lat -30					
0.433,-0.750,-0.500, # Index 40 Long 300 Lat -30					
0.000,-0.866,-0.500, # Index 41 Long 270 Lat -30					
-0.433,-0.750,-0.500, # Index 42 Long 240 Lat -30					
-0.750,-0.433,-0.500, # Index 43 Long 210 Lat -30					
-0.866,0.000,-0.500, # Index 44 Long 180 Lat -30					
-0.750,0.433,-0.500, # Index 45 Long 150 Lat -30					
-0.433,0.750,-0.500, # Index 46 Long 120 Lat -30					
0.000,0.866,-0.500, # Index 47 Long 90 Lat -30					
0.433,0.750,-0.500, # Index 48 Long 60 Lat -30					
0.750,0.433,-0.500, # Index 49 Long 30 Lat -30					
0.500,0.000,-0.866, # Index 50 Long 0 Lat -60	Fifth ring -60 deg
0.433,-0.250,-0.866, # Index 51 Long 330 Lat -60					
0.250,-0.433,-0.866, # Index 52 Long 300 Lat -60					
0.000,-0.500,-0.866, # Index 53 Long 270 Lat -60					
-0.250,-0.433,-0.866, # Index 54 Long 240 Lat -60					
-0.433,-0.250,-0.866, # Index 55 Long 210 Lat -60					
-0.500,0.000,-0.866, # Index 56 Long 180 Lat -60					
-0.433,0.250,-0.866, # Index 57 Long 150 Lat -60					
-0.250,0.433,-0.866, # Index 58 Long 120 Lat -60					
0.000,0.500,-0.866, # Index 59 Long 90 Lat -60					
0.250,0.433,-0.866, # Index 60 Long 60 Lat -60					
0.433,0.250,-0.866, # Index 61 Long 30 Lat -60					
0.000,0.000,-1.000, # Index 62 Long 0 Lat -90	Anti-zenith -90 deg
				] # end point
			} # end Coordinate 
			coordIndex [
# Latitude circles 
	# First Ring +60 deg
		1,2,3,4,5,6,7,8,9,10,11,12,1,-1, 
	# Second Ring +30 deg
		13,14,15,16,17,18,19,20,21,22,23,24,13,-1, 
	# Third Ring +0 deg
		25,26,27,28,29,30,31,32,33,34,35,36,25,-1, 
	# Fourth Ring -30 deg
		37,38,39,40,41,42,43,44,45,46,47,48,37,-1, 
	# Fifth Ring -60 deg
		49,50,51,52,53,54,55,56,57,58,59,60,49,-1, 		
# Longitude lines 
	# 0 deg Zenith to anti-zenith
		0,1,13,25,37,49,61,-1, 
	# 30 deg Zenith to anti-zenith
		0,2,14,26,38,50,61,-1, 
	# 60 deg Zenith to anti-zenith
		0,3,15,27,39,51,61,-1, 
	# 90 deg Zenith to anti-zenith
		0,4,16,28,40,52,61,-1, 
	# 120 deg Zenith to anti-zenith
		0,5,17,29,41,53,61,-1, 
	# 150 deg Zenith to anti-zenith
		0,6,18,30,42,54,61,-1, 
	# 180 deg Zenith to anti-zenith
		0,7,19,31,43,55,61,-1, 
	# 210 deg Zenith to anti-zenith
		0,8,20,32,44,56,61,-1, 
	# 240 deg Zenith to anti-zenith
		0,9,21,33,45,57,61,-1, 
	# 270 deg Zenith to anti-zenith
		0,10,22,34,46,58,61,-1, 
	# 300 deg Zenith to anti-zenith
		0,11,23,35,47,59,61,-1, 
	# 310 deg Zenith to anti-zenith
		0,12,24,36,48,60,61,-1, 
			]  # end coordinate Index 
		}  # end indexedLineSet
	} # end Shape 

	] # end children Transform Scale Object to Unity Size 
} # end Transform Scale Object to Unity Size 

	] # end children Transform Group Axes with scaling 
} # end Transform Group Axes with scaling 

	] # end children secondWorldRotationZ - around Z axis 
} # end Transform secondWorldRotationZ around Z axis 

	] # end children firstWorldRotationX - around X axis 
} # end Transform firstWorldRotationX around X axis 
# END OF AXES AND LABELS OBJECT 

	] # children Transform Convert to new coordinate system
} # end Transform Convert to new coordinate system 

 } # end PROTO OBJECT

