// Persistence of Vision Ray Tracer Include File
// File: pyr_cube.inc
// Vers: 3.01e Watcom Win32
// Desc: Creates a pyrimidal or "conical" type of cube
// Date: March 8, 1997
// Auth: Sonya Roberts
// Note: Bottom and top must be flat (i.e., parallel)

// -- Define Defaults if Necessary
#ifndef (bflc)	#declare bflc = <-1,-1,-1>	#end	// Bottom Front Left Corner
#ifndef (bbrc)	#declare bbrc = <1,-1,1>	#end	// Bottom Back Right Corner
#ifndef (tflc)	#declare tflc = <-.5,1,-.5>	#end	// Top Front Left Corner
#ifndef (tbrc)	#declare tbrc = <.5,1,.5>	#end	// Top Back Right Corner

// -- Test Values
#if (bflc.y != bbrc.y)
	#error "The bottom of your cube is not flat.  The y-values of bflc and bbrc must be identical."
#end
#if (tflc.y != tbrc.y)
	#error "The top of your cube is not flat.  The y-values of tflc and tbrc must be identical."
#end

// -- define remaining corners based on these four
#declare bblc = <bflc.x, bflc.y, bbrc.z>	// Bottom Back Left Corner
#declare bfrc = <bbrc.x, bbrc.y, bflc.z>	// Bottom Front Right Corner
#declare tblc = <tflc.x, tflc.y, tbrc.z>	// Top Back Left Corner
#declare tfrc = <tbrc.x, tbrc.y, tflc.z>	// Top Front Right Corner

#debug "Creating pyrimidal cube object...\n"

mesh {
	// TOP
	triangle {tflc, tfrc, tbrc}
	triangle {tbrc, tblc, tflc}

	// BOTTOM
	triangle {bflc, bfrc, bbrc}
	triangle {bbrc, bblc, bflc}

	// LEFT
	triangle {bflc, tflc, tblc}
	triangle {tblc, bblc, bflc}

	// RIGHT
	triangle {bfrc, tfrc, tbrc}
	triangle {tbrc, bbrc, bfrc}

	// FRONT
	triangle {bflc, bfrc, tfrc}
	triangle {tfrc, tflc, bflc}

	// BACK
	triangle {bblc, bbrc, tbrc}
	triangle {tbrc, tblc, bblc}
}
