Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* New options cbrange, cbtics and logcb for controlling

  colorboxes when enhanced3d is non false.
* Parametric curves in 3d can be colored according to
  the 4th dimension.
* Graphic option enhanced3d is no longer a global graphic
  option.
* Old meshed_surface option is removed, since it is not
  compatible with the above changes.

Thanks to Joan Pau Beltran for these contributions. He has
fixed some bugs too.
  • Loading branch information...
commit 8fb89d2d6e4765b749b2b749ab74fab4e6b42943 1 parent f989444
riotorto authored
Showing with 311 additions and 158 deletions.
  1. +114 −41 doc/info/draw.texi
  2. +107 −50 doc/info/es/draw.texi
  3. +90 −67 share/draw/draw.lisp
155 doc/info/draw.texi
View
@@ -182,6 +182,41 @@ See also @code{xrange} and @code{yrange}.
@end defvr
+@defvr {Graphic option} cbrange
+Default value: @code{auto}
+
+If @code{cbrange} is @code{auto}, the range for the values which are
+colored when @code{enhanced3d} is not @code{false} is computed
+automatically. Values outside of the color range use color of the
+nearest extreme.
+
+When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{cbrange} has
+no effect.
+
+If the user wants a specific interval for the colored values, it must
+be given as a Maxima list, as in @code{cbrange=[-2, 3]}.
+
+Since this is a global graphics option, its position in the scene description
+does not matter.
+
+Example:
+
+@example
+(%i1) load(draw)$
+(%i2) draw3d (
+ enhanced3d = true,
+ color = green,
+ cbrange = [-3,10],
+ explicit(x^2+y^2, x,-2,2,y,-2,2)) $
+@end example
+
+See also @code{enhanced3d}, @code{colorbox} and @code{cbtics}.
+
+@opencatbox
+@category{Package draw}
+@closecatbox
+@end defvr
+
@defvr {Graphic option} logx
Default value: @code{false}
@@ -264,6 +299,41 @@ See also @code{logx} and @code{logy}.
+@defvr {Graphic option} logcb
+Default value: @code{false}
+
+If @code{logcb} is @code{true}, the tics in the colorbox will be drawn in the
+logarithmic scale.
+
+When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{logcb} has
+no effect.
+
+Since this is a global graphics option, its position in the scene description
+does not matter.
+
+Example:
+
+@example
+(%i1) load(draw)$
+(%i2) draw3d (
+ enhanced3d = true,
+ color = green,
+ logcb = true,
+ logz = true,
+ palette = [-15,24,-9],
+ explicit(exp(x^2-y^2), x,-2,2,y,-2,2)) $
+@end example
+
+See also @code{enhanced3d}, @code{colorbox} and @code{cbrange}.
+
+@opencatbox
+@category{Package draw}
+@closecatbox
+
+@end defvr
+
+
+
@defvr {Graphic option} terminal
Default value: @code{screen}
@@ -753,6 +823,40 @@ See @code{xtics} for a complete description.
@end defvr
+
+@defvr {Graphic option} cbtics
+Default value: @code{auto}
+
+This graphic option controls the way tic marks are drawn on the colorbox
+when option @code{enhanced3d} is not @code{false}.
+
+When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{cbtics} has
+no effect.
+
+See @code{xtics} for a complete description.
+
+Example :
+
+@example
+(%i1) load(draw)$
+(%i2) draw3d (
+ enhanced3d = true,
+ color = green,
+ cbtics = @{["High",10],["Medium",05],["Low",0]@},
+ cbrange = [0, 10],
+ explicit(x^2+y^2, x,-2,2,y,-2,2)) $
+@end example
+
+See also @code{enhanced3d}, @code{colorbox} and @code{cbrange}.
+
+@opencatbox
+@category{Package draw}
+@closecatbox
+
+@end defvr
+
+
+
@defvr {Graphic option} xtics_rotate
Default value: @code{false}
@@ -1931,6 +2035,12 @@ Examples:
/* in explicit below: */
enhanced3d = sin(x*y),
explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
+(%i4) draw3d(
+ color = blue,
+ nticks = 60,
+ line_width = 3,
+ enhanced3d = (u-1)^2,
+ parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2))$
@end example
@opencatbox
@@ -1941,43 +2051,6 @@ Examples:
-@defvr {Graphic option} meshed_surface
-Default value: @code{false}
-
-Option @code{meshed_surface} has effect only when option @code{enhanced3d} is
-not @code{false}. In such case, if @code{meshed_surface} is @code{false},
-only the colored surface is plotted. If its value is @code{true}, both the
-colored surface and the mesh lines are plotted.
-
-Only @code{explicit} functions in 3d and @code{parametric_surface} objects are
-affected by this option.
-
-See also @code{enhanced3d}.
-
-Examples:
-
-@example
-(%i1) load(draw)$
-(%i2) draw3d (
- enhanced3d = true,
- color = green,
- meshed_surface = true,
- explicit(x^2+y^2, x,-2,2,y,-2,2)) $
-(%i3) draw3d (
- enhanced3d = true,
- surface_hide = true,
- color = green,
- meshed_surface = true,
- parametric_surface(x^2,y,x+y, x,-2,2,y,-2,2)) $
-@end example
-
-@opencatbox
-@category{Package draw}
-@closecatbox
-@end defvr
-
-
-
@defvr {Graphic option} point_size
Default value: 1
@@ -3578,7 +3651,7 @@ from @var{minval2} to @var{maxval2}.
This object is affected by the following @i{graphic options}: @code{xu_grid},
@code{yv_grid}, @code{line_type}, @code{line_width}, @code{key}, @code{enhanced3d},
-@code{meshed_surface} and @code{color}.
+ and @code{color}.
Example:
@@ -3610,7 +3683,7 @@ the abscissas range from @var{x0} to @math{@var{x0} + @var{width}}
and ordinates from @var{y0} to @math{@var{y0} + @var{height}}.
This object is affected by the following @i{graphic options}: @code{line_type},
-@code{line_width}, @code{key}, @code{enhanced3d}, @code{meshed_surface} and @code{color}.
+@code{line_width}, @code{key}, @code{enhanced3d}, and @code{color}.
This graphic object ignores @code{enhanced3d} values other than @code{true} and @code{false}.
@@ -3786,7 +3859,7 @@ Example:
Draws parametric functions in 2D and 3D.
This object is affected by the following @i{graphic options}: @code{nticks},
-@code{line_width}, @code{line_type}, @code{key} and @code{color}.
+@code{line_width}, @code{line_type}, @code{key}, @code{color} and @code{enhanced3d}.
@b{2D}
@@ -4119,7 +4192,7 @@ taking values from @var{par2min} to @var{par2max}.
This object is affected by the following @i{graphic options}: @code{xu_grid},
@code{yv_grid}, @code{line_type}, @code{line_width}, @code{key}, @code{enhanced3d},
-@code{meshed_surface} and @code{color}.
+ and @code{color}.
Example:
157 doc/info/es/draw.texi
View
@@ -103,7 +103,6 @@ V@'eanse tambi@'en @code{xrange} y @code{zrange}.
@end defvr
-
@defvr {Opci@'on gr@'afica} yrange_secondary
Valor por defecto: @code{auto}
@@ -162,10 +161,43 @@ V@'eanse tambi@'en @code{xrange} y @code{yrange}.
+@defvr {Opci@'on gr@'afica} cbrange
+Valor por defecto: @code{auto}
+
+Cuando @code{cbrange} vale @code{auto}, el rango de los valores que se
+colorean cuando @code{enhanced3d} es diferente de @code{false} se calcula
+autom@'aticamente. Valores fuera del rango utilizan el color del valor
+extremo m@'as cercano.
+
+Cuando @code{enhanced3d} o @code{colorbox} vale @code{false}, la
+opci@'on @code{cbrange} no tiene efecto alguno.
+
+Si el usuario quiere especificar un intervalo para los valores a colorear,
+@'este debe expresarse como una lista de Maxima, como en @code{cbrange=[-2, 3]}.
+
+Puesto que @'esta es una opci@'on global, su posici@'on dentro de la
+descripci@'on de la escena no reviste importancia.
+
+Ejemplo:
+
+@example
+(%i1) load(draw)$
+(%i2) draw3d (
+ enhanced3d = true,
+ color = green,
+ cbrange = [-3,10],
+ explicit(x^2+y^2, x,-2,2,y,-2,2)) $
+@end example
+
+V@'eanse tambi@'en @code{enhanced3d} y @code{cbtics}.
+@end defvr
+
+
+
@defvr {Opci@'on gr@'afica} logx
Valor por defecto: @code{false}
-Cuando @code{logx} vale @code{true}, el eje @var{x} se dibujar@'a
+Cuando @code{logx} vale @code{true}, el eje @var{x} se dibuja
en la escala logar@'{@dotless{i}}tmica.
Puesto que @'esta es una opci@'on global, su posici@'on dentro de la
@@ -187,7 +219,7 @@ V@'eanse tambi@'en @code{logy} y @code{logz}.
@defvr {Opci@'on gr@'afica} logy
Valor por defecto: @code{false}
-Cuando @code{logy} vale @code{true}, el eje @var{y} se dibujar@'a
+Cuando @code{logy} vale @code{true}, el eje @var{y} se dibuja
en la escala logar@'{@dotless{i}}tmica.
Puesto que @'esta es una opci@'on global, su posici@'on dentro de la
@@ -209,7 +241,7 @@ V@'eanse tambi@'en @code{logx} y @code{logz}.
@defvr {Opci@'on gr@'afica} logz
Valor por defecto: @code{false}
-Cuando @code{logz} vale @code{true}, el eje @var{z} se dibujar@'a
+Cuando @code{logz} vale @code{true}, el eje @var{z} se dibuja
en la escala logar@'{@dotless{i}}tmica.
Puesto que @'esta es una opci@'on global, su posici@'on dentro de la
@@ -228,6 +260,36 @@ V@'eanse tambi@'en @code{logx} y @code{logy}.
+@defvr {Opci@'on gr@'afica} logcb
+Valor por defecto: @code{false}
+
+Cuando @code{logcb} vale @code{true}, la escala de colores se dibuja
+logar@'{@dotless{i}}tmicamente.
+
+Cuando @code{enhanced3d} o @code{colorbox} vale @code{false}, la
+opci@'on @code{logcb} no tiene efecto alguno.
+
+Puesto que @'esta es una opci@'on global, su posici@'on dentro de la
+descripci@'on de la escena no reviste importancia.
+
+Ejemplo:
+
+@example
+(%i1) load(draw)$
+(%i2) draw3d (
+ enhanced3d = true,
+ color = green,
+ logcb = true,
+ logz = true,
+ palette = [-15,24,-9],
+ explicit(exp(x^2-y^2), x,-2,2,y,-2,2)) $
+@end example
+
+V@'eanse tambi@'en @code{enhanced3d}, @code{colorbox} y @code{cbrange}.
+@end defvr
+
+
+
@defvr {Opci@'on gr@'afica} terminal
Valor por defecto: @code{screen}
@@ -662,6 +724,35 @@ V@'ease @code{xtics} para una descripci@'on completa.
@end defvr
+
+@defvr {Opci@'on gr@'afica} cbtics
+Valor por defecto: @code{auto}
+
+Esta opci@'on gr@'afica controla la forma en la que se dibujar@'an
+las marcas en la escala de color cuando la opci@'on @code{enhanced3d}
+sea diferente de @code{false}.
+
+Cuando @code{enhanced3d} o @code{colorbox} vale @code{false}, la
+opci@'on @code{cbtics} no tiene efecto alguno.
+
+V@'ease @code{xtics} para una descripci@'on completa.
+
+Ejemplo :
+
+@example
+(%i1) load(draw)$
+(%i2) draw3d (
+ enhanced3d = true,
+ color = green,
+ cbtics = @{["High",10],["Medium",05],["Low",0]@},
+ cbrange = [0, 10],
+ explicit(x^2+y^2, x,-2,2,y,-2,2)) $
+@end example
+
+See also @code{enhanced3d}, @code{colorbox} and @code{cbrange}.
+@end defvr
+
+
@defvr {Opci@'on gr@'afica} xtics_rotate
Valor por defecto: @code{false}
@@ -1635,44 +1726,16 @@ Ejemplos:
/* en explicit mas abajo: */
enhanced3d = sin(x*y),
explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
+(%i4) draw3d(
+ color = blue,
+ nticks = 60,
+ line_width = 3,
+ enhanced3d = (u-1)^2,
+ parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2))$
@end example
@end defvr
-@defvr {Opci@'on gr@'afica} meshed_surface
-Valor por defecto: @code{false}
-
-La opci@'on @code{meshed_surface} s@'olo tiene efecto cuando la opci@'on
-@code{enhanced3d} no es @code{false}. En tal caso, si @code{meshed_surface}
-vale tambi@'en @code{false}, solamente se dibujar@'a la superficie coloreada. Si su
-valor es @code{true}, entonces se dibujar@'an tanto la superficie coloreada
-como las l@'{@dotless{i}}neas de la malla.
-
-Solamente las funciones @code{explicit} en 3d y los objetos @code{parametric_surface}
-se ven afectados por esta opci@'on.
-
-V@'ease tambi@'en @code{enhanced3d}.
-
-Ejemplos:
-
-@example
-(%i1) load(draw)$
-(%i2) draw3d (
- enhanced3d = true,
- color = green,
- meshed_surface = true,
- explicit(x^2+y^2, x,-2,2,y,-2,2)) $
-(%i3) draw3d (
- enhanced3d = true,
- surface_hide = true,
- color = green,
- meshed_surface = true,
- parametric_surface(x^2,y,x+y, x,-2,2,y,-2,2)) $
-@end example
-@end defvr
-
-
-
@defvr {Opci@'on gr@'afica} point_size
Valor por defecto: 1
@@ -3098,8 +3161,8 @@ dibuja la funci@'on expl@'{@dotless{i}}cita @var{fcn}, con la variable
la variable @var{var2} tomando valores desde @var{minval2} hasta @var{maxval2}.
Este objeto se ve afectado por las siguientes @i{opciones gr@'aficas}: @code{xu_grid},
-@code{yv_grid}, @code{line_type}, @code{line_width}, @code{key}, @code{enhanced3d},
-@code{meshed_surface} y @code{color}.
+@code{yv_grid}, @code{line_type}, @code{line_width}, @code{key}, @code{enhanced3d}
+ y @code{color}.
Ejemplo:
@@ -3126,7 +3189,7 @@ las abscisas van desde @var{x0} hasta @math{@var{x0} + @var{width}}
y las ordenadas desde @var{y0} hasta @math{@var{y0} + @var{height}}.
Este objeto se ve afectado por las siguientes @i{opciones gr@'aficas}: @code{line_type},
-@code{line_width}, @code{key}, @code{enhanced3d}, @code{meshed_surface} y @code{color}.
+@code{line_width}, @code{key}, @code{enhanced3d} y @code{color}.
Este objeto gr@'afico ignora valores de @code{enhanced3d} distintos de @code{true} o @code{false}.
@@ -3281,7 +3344,7 @@ Ejemplo:
Dibuja funciones param@'etricas en 2D y 3D.
Este objeto se ve afectado por las siguientes @i{opciones gr@'aficas}: @code{nticks},
-@code{line_width}, @code{line_type}, @code{key} y @code{color}.
+@code{line_width}, @code{line_type}, @code{key}, @code{color} y @code{enhanced3d}.
@b{2D}
@@ -3588,12 +3651,6 @@ hay ejemplos m@'as elaborados.
-
-
-
-
-
-
@deffn {Objeto gr@'afico} parametric_surface (@var{xfun},@var{yfun},@var{zfun},@var{par1},@var{par1min},@var{par1max},@var{par2},@var{par2min},@var{par2max})
Dibuja superficies param@'etricas en 3D.
@@ -3605,8 +3662,8 @@ con el par@'ametro @var{par1} tomando valores desde @var{par1min} hasta @var{par
y el par@'ametro @var{par2} tomando valores desde @var{par2min} hasta @var{par2max}.
Este objeto se ve afectado por las siguientes @i{opciones gr@'aficas}: @code{xu_grid},
-@code{yv_grid}, @code{line_type}, @code{line_width}, @code{key}, @code{enhanced3d},
-@code{meshed_surface} y @code{color}.
+@code{yv_grid}, @code{line_type}, @code{line_width}, @code{key}, @code{enhanced3d}
+y @code{color}.
Ejemplo:
157 share/draw/draw.lisp
View
@@ -104,9 +104,11 @@
(gethash '$yrange *gr-options*) nil ; nil => automatic computation
(gethash '$yrange_secondary *gr-options*) nil ; nil => automatic computation
(gethash '$zrange *gr-options*) nil ; nil => automatic computation
+ (gethash '$cbrange *gr-options*) nil ; nil => automatic computation
(gethash '$logx *gr-options*) nil
(gethash '$logy *gr-options*) nil
(gethash '$logz *gr-options*) nil
+ (gethash '$logcb *gr-options*) nil
(gethash '$title *gr-options*) ""
(gethash '$rot_vertical *gr-options*) 60 ; range: [0,180] (vertical rotation)
(gethash '$rot_horizontal *gr-options*) 30 ; range: [0,360] (horizontal rotation)
@@ -135,6 +137,7 @@
(gethash '$ytics *gr-options*) "autofreq"
(gethash '$ytics_secondary *gr-options*) nil ; no tics in right y-axis
(gethash '$ztics *gr-options*) "autofreq"
+ (gethash '$cbtics *gr-options*) "autofreq"
(gethash '$xtics_rotate *gr-options*) nil
(gethash '$xtics_secondary_rotate *gr-options*) nil
(gethash '$ytics_rotate *gr-options*) nil
@@ -205,7 +208,6 @@
(gethash '$yv_grid *gr-options*) 30
(gethash '$surface_hide *gr-options*) nil
(gethash '$enhanced3d *gr-options*) nil ; false, true (z levels) or an expression
- (gethash '$meshed_surface *gr-options*) nil ; false or true, works together with enhanced3d
(gethash '$contour *gr-options*) '$none ; other options are: $base, $surface, $both and $map
(gethash '$contour_levels *gr-options*) 5 ; 1-50, [lowest_level,step,highest_level] or {z1,z2,...}
(gethash '$colorbox *gr-options*) t ; in pm3d mode, always show colorbox
@@ -334,17 +336,17 @@
(setf (gethash opt *gr-options*) (string-trim '(#\,) str) ) ))
(t
(merror "draw: unknown contour level description: ~M " val))))
- (($transparent $border $logx $logy $logz $head_both $grid $xaxis_secondary $yaxis_secondary
+ (($transparent $border $logx $logy $logz $logcb $head_both $grid $xaxis_secondary $yaxis_secondary
$axis_bottom $axis_left $axis_top $axis_right $axis_3d $surface_hide $colorbox
$xaxis $yaxis $zaxis $unit_vectors $xtics_rotate $ytics_rotate $xtics_secondary_rotate $ytics_secondary_rotate
- $ztics_rotate $xtics_axis $ytics_axis $xtics_secondary_axis $ytics_secondary_axis $ztics_axis $meshed_surface) ; true or false
+ $ztics_rotate $xtics_axis $ytics_axis $xtics_secondary_axis $ytics_secondary_axis $ztics_axis) ; true or false
(if (or (equal val t)
(equal val nil))
(setf (gethash opt *gr-options*) val)
(merror "draw: non boolean value: ~M " val)))
(($filled_func $enhanced3d) ; true, false or an expression
(setf (gethash opt *gr-options*) val))
- (($xtics $ytics $xtics_secondary $ytics_secondary $ztics) ; $auto or t, $none or nil, number, increment, set, set of pairs
+ (($xtics $ytics $xtics_secondary $ytics_secondary $ztics $cbtics) ; $auto or t, $none or nil, number, increment, set, set of pairs
(cond ((member val '($none nil)) ; nil is maintained for back-portability
(setf (gethash opt *gr-options*) nil))
((member val '($auto t)) ; t is maintained for back-portability
@@ -438,7 +440,8 @@
(format nil (if (string= str "") "~a" "~%~a") st)))))
(t (merror "draw: illegal user preamble especification")))
(setf (gethash opt *gr-options*) str)) )
- (($xrange $yrange $xrange_secondary $yrange_secondary $zrange) ; defined as a Maxima list with two numbers in increasing order
+ (($xrange $yrange $xrange_secondary $yrange_secondary
+ $zrange $cbrange) ; defined as a Maxima list with two numbers in increasing order
(cond ((member val '($auto nil)) ; nil is maintained for back-portability
(setf (gethash opt *gr-options*) nil))
((or (not ($listp val))
@@ -458,11 +461,11 @@
(setf (gethash opt *gr-options*) (list fval1 fval2 0)) )) ))) )
(($ip_grid $ip_grid_in)
(if (not ($listp val))
- (merror "draw: illegal value for grid")
- (if (not (and (integerp ($first val))
- (integerp ($second val))))
- (merror "draw: illegal value for grid")
- (setf (gethash opt *gr-options*) val))))
+ (merror "draw: illegal value for grid")
+ (if (not (and (integerp ($first val))
+ (integerp ($second val))))
+ (merror "draw: illegal value for grid")
+ (setf (gethash opt *gr-options*) val))))
($palette ; defined as $color, $gray or [f1,f2,f3], with -36<=fi<=36
(cond ((member val '($color $gray))
(setf (gethash opt *gr-options*) val))
@@ -1621,18 +1624,18 @@
(defun implicit (expr x xmin xmax y ymin ymax)
(let* (($numer t) ($plot_options $plot_options)
- (pts ())
- (expr (m- ($rhs expr) ($lhs expr)))
- (ip-grid (gethash '$ip_grid *gr-options*))
- (ip-grid-in (gethash '$ip_grid_in *gr-options*))
- e pltcmd
+ (pts ())
+ (expr (m- ($rhs expr) ($lhs expr)))
+ (ip-grid (gethash '$ip_grid *gr-options*))
+ (ip-grid-in (gethash '$ip_grid_in *gr-options*))
+ e pltcmd
(xmin (convert-to-float xmin))
(xmax (convert-to-float xmax))
(ymin (convert-to-float ymin))
(ymax (convert-to-float ymax))
- (xdelta (/ (- xmax xmin) ($first ip-grid)))
- (ydelta (/ (- ymax ymin) ($second ip-grid)))
- (sample (make-array `(,(1+ ($first ip-grid))
+ (xdelta (/ (- xmax xmin) ($first ip-grid)))
+ (ydelta (/ (- ymax ymin) ($second ip-grid)))
+ (sample (make-array `(,(1+ ($first ip-grid))
,(1+ ($second ip-grid)))))
(ssample (make-array `(,(1+ ($first ip-grid-in))
,(1+ ($second ip-grid-in))))) )
@@ -1866,7 +1869,7 @@
;; color
;; key
;; enhanced3d
-;; meshed_surface
+;; surface_hide
;; Note: implements a clon of draw3d (plot.lisp) with some
;; mutations to fit the draw environment.
;; Read source in plot.lisp for more information
@@ -1916,10 +1919,7 @@
:name 'explicit
:command (format nil " ~a w ~a lw ~a lt ~a lc rgb '~a'"
(make-obj-title (get-option '$key))
- (if (and (get-option '$enhanced3d)
- (not (get-option '$meshed_surface)))
- "pm3d"
- "l")
+ (if (get-option '$enhanced3d) "pm3d" "l")
(get-option '$line_width)
(get-option '$line_type)
(get-option '$color))
@@ -1942,7 +1942,7 @@
;; color
;; key
;; enhanced3d
-;; meshed_surface
+
(defun mesh (mat x0 y0 width height)
(let ( (fx0 (convert-to-float x0))
(fy0 (convert-to-float y0))
@@ -1950,7 +1950,7 @@
(fheight (convert-to-float height))
(zmin 1.75555970201398e+305)
(zmax -1.75555970201398e+305)
- result nrows ncols dx dy n)
+ result nrows ncols )
(cond (($matrixp mat)
(let ((xi 0.0)
(yi (+ fy0 fheight))
@@ -1974,16 +1974,13 @@
(setf xi (+ xi dx)))
(setf yi (- yi dy)))))
(t
- (merror "draw2d (mesh): Argument not recognized")))
+ (merror "draw3d (mesh): Argument not recognized")))
(update-ranges-3d fx0 (+ fx0 fwidth) fy0 (+ fy0 fheight) zmin zmax)
(make-gr-object
:name 'mesh
:command (format nil " ~a w ~a lw ~a lt ~a lc rgb '~a'"
(make-obj-title (get-option '$key))
- (if (and (get-option '$enhanced3d)
- (not (get-option '$meshed_surface)))
- "pm3d"
- "l")
+ (if (get-option '$enhanced3d) "pm3d" "l")
(get-option '$line_width)
(get-option '$line_type)
(get-option '$color))
@@ -2152,6 +2149,8 @@
;; line_type
;; color
;; key
+;; enhanced3d
+;; surface_hide
(defun parametric3d (xfun yfun zfun par parmin parmax)
(let* ((nticks (gethash '$nticks *gr-options*))
($numer t)
@@ -2165,39 +2164,45 @@
(zmax -1.75555970201398e+305)
(tt parmin)
(eps (/ (- tmax tmin) (- nticks 1)))
- result f1 f2 f3 x y z)
+ (enhanced4d (not (member (get-option '$enhanced3d) '(nil t))))
+ (ncols (if enhanced4d 4 3))
+ result f1 f2 f3 x y z fcn4d)
(if (< tmax tmin)
(merror "draw3d (parametric): illegal range"))
- (setq f1 (coerce-float-fun (convert-to-float xfun) `((mlist), par)))
- (setq f2 (coerce-float-fun (convert-to-float yfun) `((mlist), par)))
- (setq f3 (coerce-float-fun (convert-to-float zfun) `((mlist), par)))
- (setf result
- (loop
- do (setf x (funcall f1 tt))
- (if (> x xmax) (setf xmax x))
- (if (< x xmin) (setf xmin x))
- (setf y (funcall f2 tt))
- (if (> y ymax) (setf ymax y))
- (if (< y ymin) (setf ymin y))
- (setf z (funcall f3 tt))
- (if (> z zmax) (setf zmax z))
- (if (< z zmin) (setf zmin z))
- collect x
- collect y
- collect z
+ (setq f1 (coerce-float-fun (convert-to-float xfun) `((mlist) ,par)))
+ (setq f2 (coerce-float-fun (convert-to-float yfun) `((mlist) ,par)))
+ (setq f3 (coerce-float-fun (convert-to-float zfun) `((mlist) ,par)))
+ (if enhanced4d
+ (setq fcn4d (coerce-float-fun (convert-to-float (get-option '$enhanced3d)) `((mlist) ,par))))
+ (loop
+ do (setf x (funcall f1 tt))
+ (if (> x xmax) (setf xmax x))
+ (if (< x xmin) (setf xmin x))
+ (setf y (funcall f2 tt))
+ (if (> y ymax) (setf ymax y))
+ (if (< y ymin) (setf ymin y))
+ (setf z (funcall f3 tt))
+ (if (> z zmax) (setf zmax z))
+ (if (< z zmin) (setf zmin z))
+ (if enhanced4d
+ (setf result (append result (list x y z (funcall fcn4d tt))))
+ (setf result (append result (list x y z))) )
when (>= tt tmax) do (loop-finish)
do (setq tt (+ tt eps))
- (if (>= tt tmax) (setq tt tmax)) ))
+ (if (>= tt tmax) (setq tt tmax)) )
; update x-y ranges if necessary
(update-ranges-3d xmin xmax ymin ymax zmin zmax)
(make-gr-object
:name 'parametric
- :command (format nil " ~a w l lw ~a lt ~a lc rgb '~a'"
+ :command (format nil " ~a w l lw ~a lt ~a lc ~a"
(make-obj-title (get-option '$key))
(get-option '$line_width)
(get-option '$line_type)
- (get-option '$color))
- :groups '((3 0)) ; numbers are sent to gnuplot in groups of 3, without blank lines
+ (if (get-option '$enhanced3d)
+ "palette"
+ (format nil "rgb '~a'" (get-option '$color))))
+ :groups `((,ncols 0)) ; numbers are sent to gnuplot in groups of 4 or 3
+ ; (depending on colored 4th dimension or not), without blank lines
:points `(,(make-array (length result) :element-type 'flonum
:initial-contents result)) )) )
@@ -2217,10 +2222,9 @@
;; line_type
;; line_width
;; color
-;; enhanced3d
;; key
+;; enhanced3d
;; surface_hide
-;; meshed_surface
(defun parametric_surface (xfun yfun zfun par1 par1min par1max par2 par2min par2max)
(let* ((ugrid (gethash '$xu_grid *gr-options*))
(vgrid (gethash '$yv_grid *gr-options*))
@@ -2245,9 +2249,9 @@
(if (or (< umax umin)
(< vmax vmin))
(merror "draw3d (parametric_surface): illegal range"))
- (setq f1 (coerce-float-fun (convert-to-float xfun) `((mlist), par1 ,par2)))
- (setq f2 (coerce-float-fun (convert-to-float yfun) `((mlist), par1 ,par2)))
- (setq f3 (coerce-float-fun (convert-to-float zfun) `((mlist), par1 ,par2)))
+ (setq f1 (coerce-float-fun (convert-to-float xfun) `((mlist) ,par1 ,par2)))
+ (setq f2 (coerce-float-fun (convert-to-float yfun) `((mlist) ,par1 ,par2)))
+ (setq f3 (coerce-float-fun (convert-to-float zfun) `((mlist) ,par1 ,par2)))
(if enhanced4d
(setq fcn4d (coerce-float-fun (convert-to-float (get-option '$enhanced3d))
`((mlist) ,par1 ,par2))))
@@ -2278,10 +2282,7 @@
:name 'parametric_surface
:command (format nil " ~a w ~a lw ~a lt ~a lc rgb '~a'"
(make-obj-title (get-option '$key))
- (if (and (get-option '$enhanced3d)
- (not (get-option '$meshed_surface)))
- "pm3d"
- "l")
+ (if (get-option '$enhanced3d) "pm3d" "l")
(get-option '$line_width)
(get-option '$line_type)
(get-option '$color))
@@ -2825,12 +2826,20 @@
(if (get-option '$yrange_secondary)
(format nil "set y2range [~a:~a]~%" y2i y2f)
"") ) )
+ (if (get-option '$cbrange)
+ (format nil "set cbrange [~a:~a]~%"
+ (first (get-option '$cbrange))
+ (second (get-option '$cbrange)))
+ (format nil "set cbrange [*:*]~%") )
(if (get-option '$logx)
(format nil "set logscale x~%")
(format nil "unset logscale x~%"))
(if (get-option '$logy)
(format nil "set logscale y~%")
(format nil "unset logscale y~%"))
+ (if (get-option '$logcb)
+ (format nil "set logscale cb~%")
+ (format nil "unset logscale cb~%") )
(if (get-option '$grid)
(format nil "set grid~%")
(format nil "unset grid~%"))
@@ -2879,6 +2888,9 @@
(if (get-option '$ytics_secondary_rotate) "rotate" "norotate")
(if (get-option '$ytics_secondary_axis) "axis" "border")
(get-option '$ytics_secondary)))
+ (if (null (get-option '$cbtics))
+ (format nil "unset cbtics~%")
+ (format nil "set cbtics ~a~%" (get-option '$cbtics) ))
(if (get-option '$colorbox)
(format nil "set colorbox~%")
(format nil "unset colorbox~%"))
@@ -2952,6 +2964,11 @@
zf (+ zf 0.01)))
(format nil "set xrange [~a:~a]~%set yrange [~a:~a]~%set zrange [~a:~a]~%"
xi xf yi yf zi zf))
+ (if (get-option '$cbrange)
+ (format nil "set cbrange [~a:~a]~%"
+ (first (get-option '$cbrange))
+ (second (get-option '$cbrange) ))
+ (format nil "set cbrange [*:*]~%") )
(case (get-option '$contour)
($surface (format nil "set contour surface;set cntrparam levels ~a~%"
(get-option '$contour_levels) ))
@@ -2974,6 +2991,9 @@
(if (get-option '$logz)
(format nil "set logscale z~%")
(format nil "unset logscale z~%"))
+ (if (get-option '$logcb)
+ (format nil "set logscale cb~%")
+ (format nil "unset logscale cb~%") )
(if (get-option '$grid)
(format nil "set grid~%")
(format nil "unset grid~%"))
@@ -3013,6 +3033,10 @@
(if (get-option '$ztics_rotate) "rotate" "norotate")
(if (get-option '$ztics_axis) "axis" "border")
(get-option '$ztics)))
+ (if (null (get-option '$cbtics))
+ (format nil "unset cbtics~%")
+ (format nil "set cbtics ~a~%"
+ (get-option '$cbtics)) )
(if (eql (get-option '$contour) '$map) ; if contour = map
(format nil "set view map~%")
(format nil "set view ~a, ~a, 1, 1~%"
@@ -3020,10 +3044,9 @@
(get-option '$rot_horizontal)) )
(if (not (get-option '$axis_3d))
(format nil "set border 0~%"))
- (if (get-option '$enhanced3d)
- (format nil "set pm3d at s depthorder~%")
- (if (get-option '$surface_hide)
- (format nil "set hidden3d~%")))
+ (format nil "set pm3d at s depthorder explicit~%")
+ (if (get-option '$surface_hide)
+ (format nil "set hidden3d nooffset~%"))
(if (get-option '$xyplane)
(format nil "set xyplane at ~a~%" (get-option '$xyplane)))
(if (get-option '$colorbox)
@@ -3320,8 +3343,8 @@
(if (atom expr)
(list expr)
(if ($get (caar expr) transform)
- (cdr (mfuncall ($get (caar expr) transform) expr))
- (list expr))))
+ (cdr (mfuncall ($get (caar expr) transform) expr))
+ (list expr))))
(defun draw-transform (expr transform)
(if (null expr) ()
Please sign in to comment.
Something went wrong with that request. Please try again.