From 8de3b8a6a820ba65fe85f0cb83700b6282e61d71 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 10 Jan 2003 00:00:00 +0100 Subject: stable 2003.01.10 --- metapost/context/mp-grid.mp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'metapost') diff --git a/metapost/context/mp-grid.mp b/metapost/context/mp-grid.mp index c684963d8..cfcc6bc15 100644 --- a/metapost/context/mp-grid.mp +++ b/metapost/context/mp-grid.mp @@ -32,13 +32,13 @@ def do_mformat = if fmt_pictures : Mformat else : Mformatstr fi enddef ; def hlingrid (expr Min, Max, Step, Length, Width) text t = image ( for i=Min step Step until Max : - draw (origin--(Width,0)) shifted (0,i*Length/Max) t ; + draw (origin--(Width,0)) shifted (0,i*(Length/Max)) t ; endfor ; ) ; enddef ; def vlingrid (expr Min, Max, Step, Length, Height) text t = image ( for i=Min step Step until Max : - draw (origin--(0,Height)) shifted (i*Length/Max,0) t ; + draw (origin--(0,Height)) shifted (i*(Length/Max),0) t ; endfor ; ) ; enddef ; @@ -57,14 +57,14 @@ enddef ; vardef hlintext@#(expr Min, Max, Step, Length, Format) text t = image ( do_initialize_numbers ; for i=Min step Step until Max : - draw textext@#(do_format(Format,i)) shifted (0,i*Length/Max) t ; + draw textext@#(do_format(Format,i)) shifted (0,i*(Length/Max)) t ; endfor ; ) enddef ; vardef vlintext@#(expr Min, Max, Step, Length, Format) text t = image ( do_initialize_numbers ; for i=Min step Step until Max : - draw textext@#(do_format(Format,i)) shifted (i*Length/Max,0) t ; + draw textext@#(do_format(Format,i)) shifted (i*(Length/Max),0) t ; endfor ; ) enddef ; @@ -82,6 +82,20 @@ vardef vlogtext@#(expr Min, Max, Step, Length, Format) text t = endfor ; ) enddef ; +vardef hlinlabel@#(expr Min, Max, Step, Length) text t = + image ( + for i=Min step Step until Max : + draw thelabel@#(decimal i,(0,i*(Length/Max))) t ; + endfor ; ) +enddef ; + +vardef vlinlabel@#(expr Min, Max, Step, Length) text t = + image ( + for i=Min step Step until Max : + draw thelabel@#(decimal i,(i*(Length/Max),0)) t ; + endfor ; ) +enddef ; + boolean numbers_initialized ; numbers_initialized := false ; def do_initialize_numbers = -- cgit v1.2.3