// polyfilm.cmd
// command to produce Polycut format file
// usage: polyfilm | "cat >filename"

// command to print OFF format part (the vertices and facets)
verlist::=foreach vertex vv do { printf "%f %f %f \n",x,y,z }
facelist::=foreach facet ff do { printf "3 ";\
       foreach ff.vertex do printf "%g ",id-1; printf "\n"}
do_off::= {printf "OFF\n%g %g %g\n",vertex_count,facet_count,edge_count;
	   verlist;facelist}

// vect-like file command for triple lines
traa ::= { trcount ::= sum(edges where valence==3,1)}
trbb ::= { foreach edge ee where ee.valence==3 do \
              { foreach ee.vertex vv do printf "%f %f %f  ",x,y,z ;\
		printf "\n" } }
trips ::= { printf "TRIPLE\n"; traa; printf "%g\n",trcount; trbb }

polyfilm ::= {do_off; trips}

