# Copyright © 2009 by David Bremner <bremner@unb.ca>
# Distributed under the same terms as sketch (http://www.frontiernet.net/~eugene.ressler)

def O (0,0,0)
def up [0,0,1]	
def eye (2,3,4)
def A (-1,-1,1) 
def B (-1,1,-1)
def R  1.73205080757
def C (1,-1,-1)
def D (1,1,1)

def INFINITY 40
def LONGS 40

def J [1,1,0]    
def forward [0,0,1]

special|\tikzstyle{novert} = [draw=white,double=lightgray]|[lay=under]

def circ {
       sweep {INFINITY, rotate(360/INFINITY,(O),[forward])} (0,R,0)
}



put { view((eye),(O),[up]) then scale(3) }{
   polygon[fill=red](A)(D)(B)
#   polygon[fill=lightgray](A)(B)(C)
   polygon[fill=red](B)(D)(C)
#   polygon[fill=lightgray](A)(C)(D)
    polygon[fill=red](A)(C)(B)
#    polygon[fill=lightgray](AB)(BC)(AC)
 #   polygon[fill=lightgray](D)(BC)(AB)
 #   polygon[fill=lightgray](D)(AB)(AC)
 #   polygon[fill=red](D)(AC)(BC)
   repeat {4,rotate(90,(0,0,0),[0,1,0])}
 	polygon[fill=blue!20,fill opacity=0.25,cull=false](-1,-1,-1)(1,-1,-1)(1,1,-1)(-1,1,-1)
   dots(A)(B)(C)(D)

   sweep[line style=novert,fill=none]{LONGS, rotate(360/LONGS,(O),[J])} {circ}
   	
}


global{
	language tikz
#	set [cull=false]

}

