#
# Makefile for running experiments on Hierarchical integration
#
SRT = time ../srt
OPTS = -x 90 -y 90 -N -an

#
# Make sure the model is up-to-date
#
testmodel.sml : testmodel.l
	model testmodel.l > testmodel.sml

aliased.im : testmodel.sml
	$(SRT) $(OPTS) < testmodel.sml > aliased.im
	
#
# Generate a sequence of images showing the effect of varying
# the maximum number of samples.  The filter function is a Gaussian
# truncated at 3sigma with a radius of 1.0 pixels.
#
SAMPLEOPTS = $(OPTS) -ah -at 3.0 -af 1.0
sampletest: testmodel.sml
	$(SRT) $(SAMPLEOPTS) -ar 8 < testmodel.sml > num.8.im
	cp nrays.im nrays.num.8.im

	$(SRT) $(SAMPLEOPTS) -ar 16 < testmodel.sml > num.16.im
	cp nrays.im nrays.num.16.im

	$(SRT) $(SAMPLEOPTS) -ar 32 < testmodel.sml > num.32.im
	cp nrays.im nrays.num.32.im

	$(SRT) $(SAMPLEOPTS) -ar 48 < testmodel.sml > num.48.im
	cp nrays.im nrays.num.48.im

	$(SRT) $(SAMPLEOPTS) -ar 64 < testmodel.sml > num.64.im
	cp nrays.im nrays.num.64.im

	$(SRT) $(SAMPLEOPTS) -ar 80 < testmodel.sml  > num.80.im
	cp nrays.im nrays.num.80.im

	$(SRT) $(SAMPLEOPTS) -ar 96 < testmodel.sml > num.96.im
	cp nrays.im nrays.num.96.im


#
# Compose an image from the results of sampletest
#
sampleimage : 
	fill 120 120 120 1

	ikshow -C 255 100 aliased.im

	iklabel 175 25 "Hierarchical Integration"
	iklabel 20  75 "Gaussian Filter"
	iklabel 325 75 "3s, 1.0pxl"

	ikshow -C 100 225 num.16.im
	ikshow -C 255 225 num.32.im
	ikshow -C 400 225 num.48.im

	ikshow -C 100 375 num.64.im
	ikshow -C 255 375 num.80.im
	ikshow -C 400 375 num.96.im

	iklabel 55  280 "16max,8avg"
	iklabel 210 280 "32max,8avg"
	iklabel 355 280 "48max,8avg"

	iklabel 55  430 "64max,8avg"
	iklabel 210 430 "80max,8avg"
	iklabel 355 430 "96max,8avg"

