﻿OUTPUT SCREEN print "start" pi = acos(-1) !numbers of pyramid walls (n=2 for roof prism) n=2 !height of pyramid z=1.0 !radius of the circle described base of the pyramid / prism r=22.6274 PATH\$ = \$OBJECTPATH() D\$ = "\Polygon Objects\" name\$="pyramid_test" ext\$ = ".POB" file\$ = PATH\$ + D\$ + name\$ + ext\$ OUTPUT file\$ !OUTPUT SCREEN DECLARE X,DOUBLE,1,n DECLARE Y,DOUBLE,1,n IF n<2 THEN PRINT "Bad value" #*************PRISM**************** IF n==2 #PRISM a=sqrt(2)/2 ! front face vertices PRINT "V ", 1," ", -a*r," ", -a*r," ",0 PRINT "V ", 2," ", a*r," ", -a*r," ",0 PRINT "V ", 3," ", a*r," ", a*r," ",0 PRINT "V ", 4," ", -a*r," ", a*r," ",0 ! back face vertices PRINT "V ", 5," ", -a*r," ", 0," ",z PRINT "V ", 6," ", a*r," ", 0," ",z ! Front face rectangle PRINT "R ",1," ",2," ",3," ",4," ",0," ",1 ! Top face rectangle PRINT "R ",4," ",3," ",6," ",5," ",0," ",0 ! Bottom rectangle PRINT "R ",1," ",2," ",6," ",5," ",0," ",0 ! left side triangle PRINT "T ",1," ",4," ",5," ",0," ",0 ! right side triangle PRINT "T ",3," ",2," ",6," ",0," ",0 ENDIF #*************PYRAMID**************** IF n>2 FOR i,1,n,1 X(i)=r*COSI(((i-1)*2*pi)/n) Y(i)=r*SINE(((i-1)*2*pi)/n) PRINT "V ", INTE(i)," ", X(i)," ", Y(i)," ",0 NEXT !top of pyramid PRINT "V ", INTE(i)," ", 0," ", 0," ",z !point (0,0) PRINT "V ", INTE(i+1)," ", 0," ", 0," ",0 !connecting points in triangle FOR i,1,n,1 IF i