!This program will calculate the divider dimension of a graphic object

!that is in a PICT file format; asks for filename and divider step (circle's radius)

!as inputs, then allows to click on the contour, keeping count of how many steps (N).

!It outputs N and L, log(N) and log (1/L). To get a new output, run it again

!selecting a different box size L.

!

SET MODE "graphics"

ASK PIXELS hpix, vpix

LET ratio=hpix/vpix

SET WINDOW 0,ratio,0,1

!Lets import the picture to analyze its box counting dimension

INPUT PROMPT "PICT FILENAME (Full path please):":filename$

CALL READ_image("PICT",picture$,filename$)

BOX SHOW picture$ AT 0,0

!Ask for step size (L)

INPUT PROMPT "STEP SIZE? (0 to 1) :":L

!Done if clicked at x<.2, to output N vs. L result

PRINT "CLICK ->HERE<- WHEN DONE"

 

LET count=0

DO

GET POINT x,y

IF x<.2 THEN EXIT DO

IF x>=.2 THEN

LET count=count+1

SET COLOR "red"

BOX CIRCLE x-L,x+L,y-L,y+L

END IF

LOOP

!Lets print the N vs L results

PRINT "N =";count;"STEPS OF SIZE L =";L

PRINT "LOG(N) =";LOG10(count)

PRINT "LOG(1/L) =";LOG10(1/L)

 

END