From: Mario R. R. <rio...@us...> - 2013-10-13 09:32:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Maxima CAS". The branch, master has been updated via 9053972165888e501a291252815ef7bbeda88d57 (commit) from 9c0d3c30682115c20a47081ed4b40a1e20ae3917 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9053972165888e501a291252815ef7bbeda88d57 Author: Mario Rodriguez <rio...@us...> Date: Sun Oct 13 11:31:34 2013 +0200 * Avoid adaptive plot when function is constant * Define draw version via defvar, instead of the get-put mechanism diff --git a/share/draw/draw_gnuplot.dem b/share/draw/draw_gnuplot.dem index 9907ce6..c34c4cc 100644 --- a/share/draw/draw_gnuplot.dem +++ b/share/draw/draw_gnuplot.dem @@ -5,7 +5,7 @@ * */ -if not get('draw,'version) then load("draw") $ +load("draw") $ ("Axes with different styles")$ diff --git a/share/draw/drawutils.mac b/share/draw/drawutils.mac index bd5573a..3a1699b 100644 --- a/share/draw/drawutils.mac +++ b/share/draw/drawutils.mac @@ -24,11 +24,9 @@ based on package draw. See documentation in drawutils.texi */ +?defvar(drawutils_version, 1) $ - -put('drawutils, 1, 'version) $ - -if not get('draw,'version) then load("draw") $ +if not $draw_version then load("draw") $ diff --git a/share/draw/gnuplot.lisp b/share/draw/gnuplot.lisp index b116ff9..2d9c851 100644 --- a/share/draw/gnuplot.lisp +++ b/share/draw/gnuplot.lisp @@ -26,12 +26,12 @@ ;;; mario @@@ edu DOT xunta DOT es -($put '$gnuplot 1 '$version) +;; use $draw_version to save package version +;; and to know whether the package was loaded +($put '$gnuplot 1 '$version); to be removed in the future +(defvar $draw_version 2) -;; the following variable will be removed in the future, -;; since some packages are still using it. -(defvar $draw_loaded t) (defvar *windows-OS* (string= *autoconf-win32* "true")) @@ -1198,35 +1198,40 @@ (*plot-realpart* *plot-realpart*) x-samples y-samples yy result pltcmd result-array) (setq *plot-realpart* (get-option '$draw_realpart)) - (setq fcn (coerce-float-fun fcn `((mlist) ,var))) (if (< xmax xmin) (merror "draw2d (explicit): illegal range")) - (flet ((fun (x) (funcall fcn x))) - (dotimes (k (1+ (* 2 nticks))) - (let ((x (+ xmin (* k x-step)))) - (push x x-samples) - (push (fun x) y-samples))) - (setf x-samples (nreverse x-samples)) - (setf y-samples (nreverse y-samples)) - - ;; For each region, adaptively plot it. - (do ((x-start x-samples (cddr x-start)) - (x-mid (cdr x-samples) (cddr x-mid)) - (x-end (cddr x-samples) (cddr x-end)) - (y-start y-samples (cddr y-start)) - (y-mid (cdr y-samples) (cddr y-mid)) - (y-end (cddr y-samples) (cddr y-end))) - ((null x-end)) - - ;; The region is x-start to x-end, with mid-point x-mid. - (let ((sublst (adaptive-plot #'fun (car x-start) (car x-mid) (car x-end) - (car y-start) (car y-mid) (car y-end) - depth 1e-5))) - (when (not (null result)) - (setf sublst (cddr sublst))) - (do ((lst sublst (cddr lst))) - ((null lst) 'done) - (setf result (append result (list (first lst) (second lst)))))))) + (setf fcn ($float fcn)) + (cond + ((floatp fcn) ; if function is a constant, we only need the end points + (setf result (list xmin fcn xmax fcn))) + (t ; if not a constant, call adaptive-plot + (setq fcn (coerce-float-fun fcn `((mlist) ,var))) + (flet ((fun (x) (funcall fcn x))) + (dotimes (k (1+ (* 2 nticks))) + (let ((x (+ xmin (* k x-step)))) + (push x x-samples) + (push (fun x) y-samples))) + (setf x-samples (nreverse x-samples)) + (setf y-samples (nreverse y-samples)) + + ;; For each region, adaptively plot it. + (do ((x-start x-samples (cddr x-start)) + (x-mid (cdr x-samples) (cddr x-mid)) + (x-end (cddr x-samples) (cddr x-end)) + (y-start y-samples (cddr y-start)) + (y-mid (cdr y-samples) (cddr y-mid)) + (y-end (cddr y-samples) (cddr y-end))) + ((null x-end)) + + ;; The region is x-start to x-end, with mid-point x-mid. + (let ((sublst (adaptive-plot #'fun (car x-start) (car x-mid) (car x-end) + (car y-start) (car y-mid) (car y-end) + depth 1e-5))) + (when (not (null result)) + (setf sublst (cddr sublst))) + (do ((lst sublst (cddr lst))) + ((null lst) 'done) + (setf result (append result (list (first lst) (second lst))))))))) ) (cond ((null (get-option '$filled_func)) (cond ((> *draw-transform-dimensions* 0) diff --git a/share/draw/grcommon.lisp b/share/draw/grcommon.lisp index ed1536e..0218e48 100644 --- a/share/draw/grcommon.lisp +++ b/share/draw/grcommon.lisp @@ -33,9 +33,6 @@ ;;; mario @@@ edu DOT xunta DOT es -($put '$draw 2 '$version) - - ;; Possible draw renderers: ;; gnuplot_pipes (default) ;; gnuplot diff --git a/share/draw/vtk.lisp b/share/draw/vtk.lisp index 4136787..d4b6d05 100644 --- a/share/draw/vtk.lisp +++ b/share/draw/vtk.lisp @@ -26,9 +26,6 @@ ;;; mario @@@ edu DOT xunta DOT es -($put '$vtk 1 '$version) - - ;;; AUXILIARY FUNCTIONS ;; Global variables diff --git a/share/draw/worldmap.mac b/share/draw/worldmap.mac index 4959f9f..00ace8b 100644 --- a/share/draw/worldmap.mac +++ b/share/draw/worldmap.mac @@ -43,9 +43,9 @@ to contact me at mario AT edu DOT xunta DOT es */ -put('worldmap, 1, 'version) $ +?defvar(worldmap_version, 1) $ -if not get('draw,'version) then load("draw") $ +load("draw") $ load("wbd.lisp")$ ----------------------------------------------------------------------- Summary of changes: share/draw/draw_gnuplot.dem | 2 +- share/draw/drawutils.mac | 6 +-- share/draw/gnuplot.lisp | 67 +++++++++++++++++++++++-------------------- share/draw/grcommon.lisp | 3 -- share/draw/vtk.lisp | 3 -- share/draw/worldmap.mac | 4 +- 6 files changed, 41 insertions(+), 44 deletions(-) hooks/post-receive -- Maxima CAS |