
(* Geodesic flow on X = C-{equilateral lattice} *)
(* CTM 12/97 *)

(* DiG[p,d]   (or DiH[p,d])

   Draws geodesic (or horocycle) of length d from p+I towards p. 
   Here p is a real number on the boundary 
   of the upper half-plane H, and X=H/G where 
   G is the commutator subgroup of Gamma(2). 
*)


(* F : I -> T *)
(* Groups of reflections *)
<<src/f.m
<<src/refl.m

(* Path routine:
	PathG[{z,p,g},dist,speed]: (or PathH)
	z in H
	p in R-infinity
	g in GL_2(R)
Representing the geodesic (or horocycle) from z to p *)
<<src/path.m

(* Plotting *)
SetOptions[Graphics, AspectRatio->Automatic]

DiG[p_,dist_]:=DiG[p,dist,"/tmp/classflow"]

DiG[p_,dist_,name_]:=Di[dist,name,PathG[p,dist]]

DiH[p_,dist_]:=DiH[p,dist,1]

DiH[p_,dist_,r_]:=DiH[p,dist,r,"/tmp/classflow"]

DiH[p_,dist_,r_,name_]:=Di[dist,name,PathH[p,dist,r]]

Di[dist_,name_,pathin_]:= 
	Block[{g,tiles,path=pathin},
	Print[name <> ":  Path Computed"];
	tiles=Map[#[[3]]&,path];
	tiles=10.0^-10*Union[Round[10^10 tiles]];
	path=GPath[path];
	Print["Image Path Computed"];
	tiles=GTile[tiles];
	g= Graphics[{
		Thickness[0.002],
		path,
		Thickness[0.0005],
		Dashing[{0.002,.006}],
		tiles}];
	DiSave[g,name,dist]
	]

DiSave[g_,name_,dist_]:=
	Block[{h,n},
	h=Show[g,
		Frame->True,
		FrameTicks->None,
		FrameLabel->{"","",
		name <> " : " <> ToString[dist],
		""}];
	n = name <> ".ps";	
	Print["Saved to ",n];
	Display["!psfix > " <> n,h]
	]

Print["Classflow Loaded"]
