Merge branch 'bug-4308-gfactor-break-coalesced-lists'
[maxima.git] / share / draw / grcommon.lisp
blob5394d44a4acc8423f11b7471046eb91033b517ef
1 ;;; COPYRIGHT NOTICE
2 ;;;
3 ;;; Copyright (C) 2007-2017 Mario Rodriguez Riotorto
4 ;;;
5 ;;; This program is free software; you can redistribute
6 ;;; it and/or modify it under the terms of the
7 ;;; GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 2
9 ;;; of the License, or (at your option) any later version.
10 ;;;
11 ;;; This program is distributed in the hope that it
12 ;;; will be useful, but WITHOUT ANY WARRANTY;
13 ;;; without even the implied warranty of MERCHANTABILITY
14 ;;; or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details at
16 ;;; http://www.gnu.org/copyleft/gpl.html
18 ;;; This is a maxima-gnuplot interface.
20 ;;; Visit
21 ;;; http://tecnostats.net/Maxima/gnuplot
22 ;;; and
23 ;;; http://tecnostats.net/Maxima/vtk
24 ;;; for examples
26 ;;; Some portions of this package were written by
27 ;;; Andrej Vodopivec and Joan Pau Beltran.
28 ;;; Some other people has also helped with bug reports,
29 ;;; comments, complains and feature requests.
30 ;;; Thanks to everybody!!
32 ;;; For questions, suggestions, bugs and the like, feel free
33 ;;; to contact me at
35 ;;; riotorto @@@ yahoo DOT com
38 ;; Possible draw renderers:
39 ;; gnuplot_pipes (default)
40 ;; gnuplot
41 ;; vtk or vtk6
42 ;; vtk7
44 (defvar $draw_renderer '$gnuplot_pipes)
46 (defvar $draw_use_pngcairo nil "If true, use pngcairo terminal when png is requested.")
49 ;; Stores user defaults
50 (defvar *user-gr-default-options* nil)
51 (defun $set_draw_defaults (&rest opts)
52 (setf *user-gr-default-options* opts)
53 (cons '(mlist) opts))
54 (defun user-defaults ()
55 (dolist (x *user-gr-default-options*)
56 (if (equal ($op x) "=")
57 (update-gr-option ($lhs x) ($rhs x))
58 (merror "draw: item ~M is not recognized as an option assignment" x))))
60 ;; Stores user defined allocations of scenes
61 (defvar *allocations* nil)
64 ;; Sets default values of graphics options
65 (defvar *gr-options* (make-hash-table))
66 (defun ini-gr-options ()
67 (setf
68 ; global options to control general aspects of graphics
69 (gethash '$allocation *gr-options*) nil ; or user-defined allocation
70 (gethash '$proportional_axes *gr-options*) '$none ; three possible options: none, xy, xyz
71 (gethash '$xrange *gr-options*) nil ; nil => automatic computation
72 (gethash '$xrange_secondary *gr-options*) nil ; nil => automatic computation
73 (gethash '$yrange *gr-options*) nil ; nil => automatic computation
74 (gethash '$yrange_secondary *gr-options*) nil ; nil => automatic computation
75 (gethash '$zrange *gr-options*) nil ; nil => automatic computation
76 (gethash '$cbrange *gr-options*) nil ; nil => automatic computation
77 (gethash '$logx *gr-options*) nil
78 (gethash '$logx_secondary *gr-options*) nil
79 (gethash '$logy *gr-options*) nil
80 (gethash '$logy_secondary *gr-options*) nil
81 (gethash '$logz *gr-options*) nil
82 (gethash '$logcb *gr-options*) nil
83 (gethash '$title *gr-options*) ""
84 (gethash '$view *gr-options*) '(60 30) ; in [0,180] x [0,360]
85 (gethash '$xy_file *gr-options*) ""
86 (gethash '$user_preamble *gr-options*) ""
87 (gethash '$xyplane *gr-options*) nil
88 (gethash '$font *gr-options*) "";
89 (gethash '$font_size *gr-options*) 10;
90 (gethash '$key_pos *gr-options*) nil
92 ; colors are specified by name
93 (gethash '$background_color *gr-options*) "#ffffff"
94 (gethash '$color *gr-options*) "#0000ff" ; for lines, points, borders and labels
95 (gethash '$fill_color *gr-options*) "#ff0000" ; for filled regions
96 (gethash '$fill_density *gr-options*) nil ; if specified, must be in [0, 1]
98 ; implicit plot options
99 (gethash '$ip_grid *gr-options*) '((mlist simp) 50 50)
100 (gethash '$ip_grid_in *gr-options*) '((mlist simp) 5 5)
101 (gethash '$x_voxel *gr-options*) 10
102 (gethash '$y_voxel *gr-options*) 10
103 (gethash '$z_voxel *gr-options*) 10
105 ; tics
106 (gethash '$grid *gr-options*) (list 0 0)
107 (gethash '$xtics *gr-options*) "autofreq"
108 (gethash '$xtics_secondary *gr-options*) nil ; no tics in top x-axis
109 (gethash '$ytics *gr-options*) "autofreq"
110 (gethash '$ytics_secondary *gr-options*) nil ; no tics in right y-axis
111 (gethash '$ztics *gr-options*) "autofreq"
112 (gethash '$cbtics *gr-options*) "autofreq"
113 (gethash '$xtics_rotate *gr-options*) nil
114 (gethash '$xtics_secondary_rotate *gr-options*) nil
115 (gethash '$ytics_rotate *gr-options*) nil
116 (gethash '$ytics_secondary_rotate *gr-options*) nil
117 (gethash '$ztics_rotate *gr-options*) nil
118 (gethash '$xtics_axis *gr-options*) nil
119 (gethash '$xtics_secondary_axis *gr-options*) nil
120 (gethash '$ytics_axis *gr-options*) nil
121 (gethash '$ytics_secondary_axis *gr-options*) nil
122 (gethash '$ztics_axis *gr-options*) nil
124 ; axes
125 (gethash '$axis_bottom *gr-options*) t
126 (gethash '$axis_left *gr-options*) t
127 (gethash '$axis_top *gr-options*) t
128 (gethash '$axis_right *gr-options*) t
129 (gethash '$axis_3d *gr-options*) t
130 (gethash '$xaxis *gr-options*) nil ; no xaxis by default
131 (gethash '$xaxis_width *gr-options*) 1
132 (gethash '$xaxis_type *gr-options*) 0 ; two options: 1 (solid) and 0 (dots)
133 (gethash '$xaxis_color *gr-options*) "#000000"
134 (gethash '$yaxis *gr-options*) nil ; no yaxis by default
135 (gethash '$yaxis_width *gr-options*) 1
136 (gethash '$yaxis_type *gr-options*) 0 ; two options: 1 (solid) and 0 (dots)
137 (gethash '$yaxis_color *gr-options*) "#000000"
138 (gethash '$zaxis *gr-options*) nil ; no zaxis by default
139 (gethash '$zaxis_width *gr-options*) 1
140 (gethash '$zaxis_type *gr-options*) 0 ; two options: 1 (solid) and 0 (dots)
141 (gethash '$zaxis_color *gr-options*) "#000000"
142 (gethash '$xlabel *gr-options*) ""
143 (gethash '$xlabel_secondary *gr-options*) ""
144 (gethash '$ylabel *gr-options*) ""
145 (gethash '$ylabel_secondary *gr-options*) ""
146 (gethash '$zlabel *gr-options*) ""
147 (gethash '$zlabel_rotate *gr-options*) '$auto
149 ; point options
150 (gethash '$point_size *gr-options*) 1
151 (gethash '$point_type *gr-options*) 1
152 (gethash '$points_joined *gr-options*) nil ; other options are: true and $impulses
154 ; error bars option
155 (gethash '$error_type *gr-options*) '$y
157 ; polygon options
158 (gethash '$transparent *gr-options*) nil
159 (gethash '$opacity *gr-options*) 1
160 (gethash '$border *gr-options*) t
162 ; vector options
163 (gethash '$head_both *gr-options*) nil
164 (gethash '$head_length *gr-options*) 2 ; in x-axis units
165 (gethash '$head_angle *gr-options*) 45 ; with respect to the segment
166 (gethash '$head_type *gr-options*) '$filled ; other options are: $empty and $nofilled
167 (gethash '$unit_vectors *gr-options*) nil
169 ; label options
170 (gethash '$label_alignment *gr-options*) '$center ; other options are: $left and $right
171 (gethash '$label_orientation *gr-options*) '$horizontal ; the other option is $vertical
173 ; line options
174 (gethash '$line_width *gr-options*) 1
175 (gethash '$line_type *gr-options*) 1 ; two options: 1 (solid) and 0 (dots)
177 ; function options
178 (gethash '$nticks *gr-options*) 29
179 (gethash '$adapt_depth *gr-options*) 10
180 (gethash '$key *gr-options*) "" ; by default, no keys
181 (gethash '$filled_func *gr-options*) nil ; false, true (y axis) or an expression
182 (gethash '$xaxis_secondary *gr-options*) nil
183 (gethash '$yaxis_secondary *gr-options*) nil
184 (gethash '$draw_realpart *gr-options*) t
186 ; transformation option
187 (gethash '$transform *gr-options*) '$none
189 ; 3d options
190 (gethash '$xu_grid *gr-options*) 50
191 (gethash '$yv_grid *gr-options*) 50
192 (gethash '$surface_hide *gr-options*) nil
193 (gethash '$interpolate_color *gr-options*) "depthorder"
194 (gethash '$enhanced3d *gr-options*) '$none
195 (gethash '$isolines *gr-options*) '$none
196 (gethash '$wired_surface *gr-options*) nil
197 (gethash '$contour *gr-options*) '$none ; other options are: $base, $surface, $both and $map
198 (gethash '$contour_levels *gr-options*) 5 ; 1-50, [lowest_level,step,highest_level] or {e1,e2,...}
199 (gethash '$isolines_levels *gr-options*) 10 ; 1-50, [lowest_level_fraction,step,highest_level_fraction],
200 ; or {e1_fraction,e2_fraction,...}. Only for VTK.
201 (gethash '$colorbox *gr-options*) t ; in pm3d mode, always show colorbox
202 (gethash '$palette *gr-options*) '$color ; '$color is a short cut for [7,5,15]
203 ; and '$gray is a short cut for [3,3,3].
204 ; See command 'show palette rgbformulae' in gnuplot.
205 (gethash '$capping *gr-options*) '((mlist simp) nil nil)
208 ;; Returns option value
209 (defun get-option (opt) (gethash opt *gr-options*))
216 ;; update options color, fill_color, xaxis_color, yaxis_color,
217 ;; $zaxis_color, and $background_color
218 ;; -----------------------------------------------------------
219 ;; defined as a color name or hexadecimal #rrggbb
220 (defun atom-to-downcased-string (val)
221 ; also, remove spaces, minus symbols, and underscores
222 (remove-if
223 #'(lambda (z) (member (char-int z) '(32 45 95)))
224 (string-downcase
225 (string-trim
226 "\""
227 (coerce (mstring val) 'string)))))
229 (defvar *color-table* (make-hash-table :test 'equal))
230 (setf (gethash "snow" *color-table*) "#FFFAFA"
231 (gethash "ghostwhite" *color-table*) "#F8F8FF"
232 (gethash "whitesmoke" *color-table*) "#F5F5F5"
233 (gethash "gainsboro" *color-table*) "#DCDCDC"
234 (gethash "floralwhite" *color-table*) "#FFFAF0"
235 (gethash "oldlace" *color-table*) "#FDF5E6"
236 (gethash "linen" *color-table*) "#FAF0E6"
237 (gethash "antiquewhite" *color-table*) "#FAEBD7"
238 (gethash "papayawhip" *color-table*) "#FFEFD5"
239 (gethash "blanchedalmond" *color-table*) "#FFEBCD"
240 (gethash "bisque" *color-table*) "#FFE4C4"
241 (gethash "peachpuff" *color-table*) "#FFDAB9"
242 (gethash "navajowhite" *color-table*) "#FFDEAD"
243 (gethash "moccasin" *color-table*) "#FFE4B5"
244 (gethash "cornsilk" *color-table*) "#FFF8DC"
245 (gethash "ivory" *color-table*) "#FFFFF0"
246 (gethash "lemonchiffon" *color-table*) "#FFFACD"
247 (gethash "seashell" *color-table*) "#FFF5EE"
248 (gethash "honeydew" *color-table*) "#F0FFF0"
249 (gethash "mintcream" *color-table*) "#F5FFFA"
250 (gethash "azure" *color-table*) "#F0FFFF"
251 (gethash "aliceblue" *color-table*) "#F0F8FF"
252 (gethash "lavender" *color-table*) "#E6E6FA"
253 (gethash "lavenderblush" *color-table*) "#FFF0F5"
254 (gethash "mistyrose" *color-table*) "#FFE4E1"
255 (gethash "white" *color-table*) "#FFFFFF"
256 (gethash "black" *color-table*) "#000000"
257 (gethash "darkslategray" *color-table*) "#2F4F4F"
258 (gethash "darkslategrey" *color-table*) "#2F4F4F"
259 (gethash "dimgray" *color-table*) "#696969"
260 (gethash "dimgrey" *color-table*) "#696969"
261 (gethash "slategray" *color-table*) "#708090"
262 (gethash "slategrey" *color-table*) "#708090"
263 (gethash "lightslategray" *color-table*) "#778899"
264 (gethash "lightslategrey" *color-table*) "#778899"
265 (gethash "gray" *color-table*) "#BEBEBE"
266 (gethash "grey" *color-table*) "#BEBEBE"
267 (gethash "lightgrey" *color-table*) "#D3D3D3"
268 (gethash "lightgray" *color-table*) "#D3D3D3"
269 (gethash "midnightblue" *color-table*) "#191970"
270 (gethash "navy" *color-table*) "#000080"
271 (gethash "navyblue" *color-table*) "#000080"
272 (gethash "cornflowerblue" *color-table*) "#6495ED"
273 (gethash "darkslateblue" *color-table*) "#483D8B"
274 (gethash "slateblue" *color-table*) "#6A5ACD"
275 (gethash "mediumslateblue" *color-table*) "#7B68EE"
276 (gethash "lightslateblue" *color-table*) "#8470FF"
277 (gethash "mediumblue" *color-table*) "#0000CD"
278 (gethash "royalblue" *color-table*) "#4169E1"
279 (gethash "blue" *color-table*) "#0000FF"
280 (gethash "dodgerblue" *color-table*) "#1E90FF"
281 (gethash "deepskyblue" *color-table*) "#00BFFF"
282 (gethash "skyblue" *color-table*) "#87CEEB"
283 (gethash "lightskyblue" *color-table*) "#87CEFA"
284 (gethash "steelblue" *color-table*) "#4682B4"
285 (gethash "lightsteelblue" *color-table*) "#B0C4DE"
286 (gethash "lightblue" *color-table*) "#ADD8E6"
287 (gethash "powderblue" *color-table*) "#B0E0E6"
288 (gethash "paleturquoise" *color-table*) "#AFEEEE"
289 (gethash "darkturquoise" *color-table*) "#00CED1"
290 (gethash "mediumturquoise" *color-table*) "#48D1CC"
291 (gethash "turquoise" *color-table*) "#40E0D0"
292 (gethash "cyan" *color-table*) "#00FFFF"
293 (gethash "lightcyan" *color-table*) "#E0FFFF"
294 (gethash "cadetblue" *color-table*) "#5F9EA0"
295 (gethash "mediumaquamarine" *color-table*) "#66CDAA"
296 (gethash "aquamarine" *color-table*) "#7FFFD4"
297 (gethash "darkgreen" *color-table*) "#006400"
298 (gethash "darkolivegreen" *color-table*) "#556B2F"
299 (gethash "darkseagreen" *color-table*) "#8FBC8F"
300 (gethash "seagreen" *color-table*) "#2E8B57"
301 (gethash "mediumseagreen" *color-table*) "#3CB371"
302 (gethash "lightseagreen" *color-table*) "#20B2AA"
303 (gethash "palegreen" *color-table*) "#98FB98"
304 (gethash "springgreen" *color-table*) "#00FF7F"
305 (gethash "lawngreen" *color-table*) "#7CFC00"
306 (gethash "green" *color-table*) "#00FF00"
307 (gethash "chartreuse" *color-table*) "#7FFF00"
308 (gethash "mediumspringgreen" *color-table*) "#00FA9A"
309 (gethash "greenyellow" *color-table*) "#ADFF2F"
310 (gethash "limegreen" *color-table*) "#32CD32"
311 (gethash "yellowgreen" *color-table*) "#9ACD32"
312 (gethash "forestgreen" *color-table*) "#228B22"
313 (gethash "olivedrab" *color-table*) "#6B8E23"
314 (gethash "darkkhaki" *color-table*) "#BDB76B"
315 (gethash "khaki" *color-table*) "#F0E68C"
316 (gethash "palegoldenrod" *color-table*) "#EEE8AA"
317 (gethash "lightgoldenrodyellow" *color-table*) "#FAFAD2"
318 (gethash "lightyellow" *color-table*) "#FFFFE0"
319 (gethash "yellow" *color-table*) "#FFFF00"
320 (gethash "gold" *color-table*) "#FFD700"
321 (gethash "lightgoldenrod" *color-table*) "#EEDD82"
322 (gethash "goldenrod" *color-table*) "#DAA520"
323 (gethash "darkgoldenrod" *color-table*) "#B8860B"
324 (gethash "rosybrown" *color-table*) "#BC8F8F"
325 (gethash "indianred" *color-table*) "#CD5C5C"
326 (gethash "saddlebrown" *color-table*) "#8B4513"
327 (gethash "sienna" *color-table*) "#A0522D"
328 (gethash "peru" *color-table*) "#CD853F"
329 (gethash "burlywood" *color-table*) "#DEB887"
330 (gethash "beige" *color-table*) "#F5F5DC"
331 (gethash "wheat" *color-table*) "#F5DEB3"
332 (gethash "sandybrown" *color-table*) "#F4A460"
333 (gethash "tan" *color-table*) "#D2B48C"
334 (gethash "chocolate" *color-table*) "#D2691E"
335 (gethash "firebrick" *color-table*) "#B22222"
336 (gethash "brown" *color-table*) "#A52A2A"
337 (gethash "darksalmon" *color-table*) "#E9967A"
338 (gethash "salmon" *color-table*) "#FA8072"
339 (gethash "lightsalmon" *color-table*) "#FFA07A"
340 (gethash "orange" *color-table*) "#FFA500"
341 (gethash "darkorange" *color-table*) "#FF8C00"
342 (gethash "coral" *color-table*) "#FF7F50"
343 (gethash "lightcoral" *color-table*) "#F08080"
344 (gethash "tomato" *color-table*) "#FF6347"
345 (gethash "orangered" *color-table*) "#FF4500"
346 (gethash "red" *color-table*) "#FF0000"
347 (gethash "hotpink" *color-table*) "#FF69B4"
348 (gethash "deeppink" *color-table*) "#FF1493"
349 (gethash "pink" *color-table*) "#FFC0CB"
350 (gethash "lightpink" *color-table*) "#FFB6C1"
351 (gethash "palevioletred" *color-table*) "#DB7093"
352 (gethash "maroon" *color-table*) "#B03060"
353 (gethash "mediumvioletred" *color-table*) "#C71585"
354 (gethash "violetred" *color-table*) "#D02090"
355 (gethash "magenta" *color-table*) "#FF00FF"
356 (gethash "violet" *color-table*) "#EE82EE"
357 (gethash "plum" *color-table*) "#DDA0DD"
358 (gethash "orchid" *color-table*) "#DA70D6"
359 (gethash "mediumorchid" *color-table*) "#BA55D3"
360 (gethash "darkorchid" *color-table*) "#9932CC"
361 (gethash "darkviolet" *color-table*) "#9400D3"
362 (gethash "blueviolet" *color-table*) "#8A2BE2"
363 (gethash "purple" *color-table*) "#A020F0"
364 (gethash "mediumpurple" *color-table*) "#9370DB"
365 (gethash "thistle" *color-table*) "#D8BFD8"
366 (gethash "snow1" *color-table*) "#FFFAFA"
367 (gethash "snow2" *color-table*) "#EEE9E9"
368 (gethash "snow3" *color-table*) "#CDC9C9"
369 (gethash "snow4" *color-table*) "#8B8989"
370 (gethash "seashell1" *color-table*) "#FFF5EE"
371 (gethash "seashell2" *color-table*) "#EEE5DE"
372 (gethash "seashell3" *color-table*) "#CDC5BF"
373 (gethash "seashell4" *color-table*) "#8B8682"
374 (gethash "antiquewhite1" *color-table*) "#FFEFDB"
375 (gethash "antiquewhite2" *color-table*) "#EEDFCC"
376 (gethash "antiquewhite3" *color-table*) "#CDC0B0"
377 (gethash "antiquewhite4" *color-table*) "#8B8378"
378 (gethash "bisque1" *color-table*) "#FFE4C4"
379 (gethash "bisque2" *color-table*) "#EED5B7"
380 (gethash "bisque3" *color-table*) "#CDB79E"
381 (gethash "bisque4" *color-table*) "#8B7D6B"
382 (gethash "peachpuff1" *color-table*) "#FFDAB9"
383 (gethash "peachpuff2" *color-table*) "#EECBAD"
384 (gethash "peachpuff3" *color-table*) "#CDAF95"
385 (gethash "peachpuff4" *color-table*) "#8B7765"
386 (gethash "navajowhite1" *color-table*) "#FFDEAD"
387 (gethash "navajowhite2" *color-table*) "#EECFA1"
388 (gethash "navajowhite3" *color-table*) "#CDB38B"
389 (gethash "navajowhite4" *color-table*) "#8B795E"
390 (gethash "lemonchiffon1" *color-table*) "#FFFACD"
391 (gethash "lemonchiffon2" *color-table*) "#EEE9BF"
392 (gethash "lemonchiffon3" *color-table*) "#CDC9A5"
393 (gethash "lemonchiffon4" *color-table*) "#8B8970"
394 (gethash "cornsilk1" *color-table*) "#FFF8DC"
395 (gethash "cornsilk2" *color-table*) "#EEE8CD"
396 (gethash "cornsilk3" *color-table*) "#CDC8B1"
397 (gethash "cornsilk4" *color-table*) "#8B8878"
398 (gethash "ivory1" *color-table*) "#FFFFF0"
399 (gethash "ivory2" *color-table*) "#EEEEE0"
400 (gethash "ivory3" *color-table*) "#CDCDC1"
401 (gethash "ivory4" *color-table*) "#8B8B83"
402 (gethash "honeydew1" *color-table*) "#F0FFF0"
403 (gethash "honeydew2" *color-table*) "#E0EEE0"
404 (gethash "honeydew3" *color-table*) "#C1CDC1"
405 (gethash "honeydew4" *color-table*) "#838B83"
406 (gethash "lavenderblush1" *color-table*) "#FFF0F5"
407 (gethash "lavenderblush2" *color-table*) "#EEE0E5"
408 (gethash "lavenderblush3" *color-table*) "#CDC1C5"
409 (gethash "lavenderblush4" *color-table*) "#8B8386"
410 (gethash "mistyrose1" *color-table*) "#FFE4E1"
411 (gethash "mistyrose2" *color-table*) "#EED5D2"
412 (gethash "mistyrose3" *color-table*) "#CDB7B5"
413 (gethash "mistyrose4" *color-table*) "#8B7D7B"
414 (gethash "azure1" *color-table*) "#F0FFFF"
415 (gethash "azure2" *color-table*) "#E0EEEE"
416 (gethash "azure3" *color-table*) "#C1CDCD"
417 (gethash "azure4" *color-table*) "#838B8B"
418 (gethash "slateblue1" *color-table*) "#836FFF"
419 (gethash "slateblue2" *color-table*) "#7A67EE"
420 (gethash "slateblue3" *color-table*) "#6959CD"
421 (gethash "slateblue4" *color-table*) "#473C8B"
422 (gethash "royalblue1" *color-table*) "#4876FF"
423 (gethash "royalblue2" *color-table*) "#436EEE"
424 (gethash "royalblue3" *color-table*) "#3A5FCD"
425 (gethash "royalblue4" *color-table*) "#27408B"
426 (gethash "blue1" *color-table*) "#0000FF"
427 (gethash "blue2" *color-table*) "#0000EE"
428 (gethash "blue3" *color-table*) "#0000CD"
429 (gethash "blue4" *color-table*) "#00008B"
430 (gethash "dodgerblue1" *color-table*) "#1E90FF"
431 (gethash "dodgerblue2" *color-table*) "#1C86EE"
432 (gethash "dodgerblue3" *color-table*) "#1874CD"
433 (gethash "dodgerblue4" *color-table*) "#104E8B"
434 (gethash "steelblue1" *color-table*) "#63B8FF"
435 (gethash "steelblue2" *color-table*) "#5CACEE"
436 (gethash "steelblue3" *color-table*) "#4F94CD"
437 (gethash "steelblue4" *color-table*) "#36648B"
438 (gethash "deepskyblue1" *color-table*) "#00BFFF"
439 (gethash "deepskyblue2" *color-table*) "#00B2EE"
440 (gethash "deepskyblue3" *color-table*) "#009ACD"
441 (gethash "deepskyblue4" *color-table*) "#00688B"
442 (gethash "skyblue1" *color-table*) "#87CEFF"
443 (gethash "skyblue2" *color-table*) "#7EC0EE"
444 (gethash "skyblue3" *color-table*) "#6CA6CD"
445 (gethash "skyblue4" *color-table*) "#4A708B"
446 (gethash "lightskyblue1" *color-table*) "#B0E2FF"
447 (gethash "lightskyblue2" *color-table*) "#A4D3EE"
448 (gethash "lightskyblue3" *color-table*) "#8DB6CD"
449 (gethash "lightskyblue4" *color-table*) "#607B8B"
450 (gethash "slategray1" *color-table*) "#C6E2FF"
451 (gethash "slategray2" *color-table*) "#B9D3EE"
452 (gethash "slategray3" *color-table*) "#9FB6CD"
453 (gethash "slategray4" *color-table*) "#6C7B8B"
454 (gethash "lightsteelblue1" *color-table*) "#CAE1FF"
455 (gethash "lightsteelblue2" *color-table*) "#BCD2EE"
456 (gethash "lightsteelblue3" *color-table*) "#A2B5CD"
457 (gethash "lightsteelblue4" *color-table*) "#6E7B8B"
458 (gethash "lightblue1" *color-table*) "#BFEFFF"
459 (gethash "lightblue2" *color-table*) "#B2DFEE"
460 (gethash "lightblue3" *color-table*) "#9AC0CD"
461 (gethash "lightblue4" *color-table*) "#68838B"
462 (gethash "lightcyan1" *color-table*) "#E0FFFF"
463 (gethash "lightcyan2" *color-table*) "#D1EEEE"
464 (gethash "lightcyan3" *color-table*) "#B4CDCD"
465 (gethash "lightcyan4" *color-table*) "#7A8B8B"
466 (gethash "paleturquoise1" *color-table*) "#BBFFFF"
467 (gethash "paleturquoise2" *color-table*) "#AEEEEE"
468 (gethash "paleturquoise3" *color-table*) "#96CDCD"
469 (gethash "paleturquoise4" *color-table*) "#668B8B"
470 (gethash "cadetblue1" *color-table*) "#98F5FF"
471 (gethash "cadetblue2" *color-table*) "#8EE5EE"
472 (gethash "cadetblue3" *color-table*) "#7AC5CD"
473 (gethash "cadetblue4" *color-table*) "#53868B"
474 (gethash "turquoise1" *color-table*) "#00F5FF"
475 (gethash "turquoise2" *color-table*) "#00E5EE"
476 (gethash "turquoise3" *color-table*) "#00C5CD"
477 (gethash "turquoise4" *color-table*) "#00868B"
478 (gethash "cyan1" *color-table*) "#00FFFF"
479 (gethash "cyan2" *color-table*) "#00EEEE"
480 (gethash "cyan3" *color-table*) "#00CDCD"
481 (gethash "cyan4" *color-table*) "#008B8B"
482 (gethash "darkslategray1" *color-table*) "#97FFFF"
483 (gethash "darkslategray2" *color-table*) "#8DEEEE"
484 (gethash "darkslategray3" *color-table*) "#79CDCD"
485 (gethash "darkslategray4" *color-table*) "#528B8B"
486 (gethash "aquamarine1" *color-table*) "#7FFFD4"
487 (gethash "aquamarine2" *color-table*) "#76EEC6"
488 (gethash "aquamarine3" *color-table*) "#66CDAA"
489 (gethash "aquamarine4" *color-table*) "#458B74"
490 (gethash "darkseagreen1" *color-table*) "#C1FFC1"
491 (gethash "darkseagreen2" *color-table*) "#B4EEB4"
492 (gethash "darkseagreen3" *color-table*) "#9BCD9B"
493 (gethash "darkseagreen4" *color-table*) "#698B69"
494 (gethash "seagreen1" *color-table*) "#54FF9F"
495 (gethash "seagreen2" *color-table*) "#4EEE94"
496 (gethash "seagreen3" *color-table*) "#43CD80"
497 (gethash "seagreen4" *color-table*) "#2E8B57"
498 (gethash "palegreen1" *color-table*) "#9AFF9A"
499 (gethash "palegreen2" *color-table*) "#90EE90"
500 (gethash "palegreen3" *color-table*) "#7CCD7C"
501 (gethash "palegreen4" *color-table*) "#548B54"
502 (gethash "springgreen1" *color-table*) "#00FF7F"
503 (gethash "springgreen2" *color-table*) "#00EE76"
504 (gethash "springgreen3" *color-table*) "#00CD66"
505 (gethash "springgreen4" *color-table*) "#008B45"
506 (gethash "green1" *color-table*) "#00FF00"
507 (gethash "green2" *color-table*) "#00EE00"
508 (gethash "green3" *color-table*) "#00CD00"
509 (gethash "green4" *color-table*) "#008B00"
510 (gethash "chartreuse1" *color-table*) "#7FFF00"
511 (gethash "chartreuse2" *color-table*) "#76EE00"
512 (gethash "chartreuse3" *color-table*) "#66CD00"
513 (gethash "chartreuse4" *color-table*) "#458B00"
514 (gethash "olivedrab1" *color-table*) "#C0FF3E"
515 (gethash "olivedrab2" *color-table*) "#B3EE3A"
516 (gethash "olivedrab3" *color-table*) "#9ACD32"
517 (gethash "olivedrab4" *color-table*) "#698B22"
518 (gethash "darkolivegreen1" *color-table*) "#CAFF70"
519 (gethash "darkolivegreen2" *color-table*) "#BCEE68"
520 (gethash "darkolivegreen3" *color-table*) "#A2CD5A"
521 (gethash "darkolivegreen4" *color-table*) "#6E8B3D"
522 (gethash "khaki1" *color-table*) "#FFF68F"
523 (gethash "khaki2" *color-table*) "#EEE685"
524 (gethash "khaki3" *color-table*) "#CDC673"
525 (gethash "khaki4" *color-table*) "#8B864E"
526 (gethash "lightgoldenrod1" *color-table*) "#FFEC8B"
527 (gethash "lightgoldenrod2" *color-table*) "#EEDC82"
528 (gethash "lightgoldenrod3" *color-table*) "#CDBE70"
529 (gethash "lightgoldenrod4" *color-table*) "#8B814C"
530 (gethash "lightyellow1" *color-table*) "#FFFFE0"
531 (gethash "lightyellow2" *color-table*) "#EEEED1"
532 (gethash "lightyellow3" *color-table*) "#CDCDB4"
533 (gethash "lightyellow4" *color-table*) "#8B8B7A"
534 (gethash "yellow1" *color-table*) "#FFFF00"
535 (gethash "yellow2" *color-table*) "#EEEE00"
536 (gethash "yellow3" *color-table*) "#CDCD00"
537 (gethash "yellow4" *color-table*) "#8B8B00"
538 (gethash "gold1" *color-table*) "#FFD700"
539 (gethash "gold2" *color-table*) "#EEC900"
540 (gethash "gold3" *color-table*) "#CDAD00"
541 (gethash "gold4" *color-table*) "#8B7500"
542 (gethash "goldenrod1" *color-table*) "#FFC125"
543 (gethash "goldenrod2" *color-table*) "#EEB422"
544 (gethash "goldenrod3" *color-table*) "#CD9B1D"
545 (gethash "goldenrod4" *color-table*) "#8B6914"
546 (gethash "darkgoldenrod1" *color-table*) "#FFB90F"
547 (gethash "darkgoldenrod2" *color-table*) "#EEAD0E"
548 (gethash "darkgoldenrod3" *color-table*) "#CD950C"
549 (gethash "darkgoldenrod4" *color-table*) "#8B6508"
550 (gethash "rosybrown1" *color-table*) "#FFC1C1"
551 (gethash "rosybrown2" *color-table*) "#EEB4B4"
552 (gethash "rosybrown3" *color-table*) "#CD9B9B"
553 (gethash "rosybrown4" *color-table*) "#8B6969"
554 (gethash "indianred1" *color-table*) "#FF6A6A"
555 (gethash "indianred2" *color-table*) "#EE6363"
556 (gethash "indianred3" *color-table*) "#CD5555"
557 (gethash "indianred4" *color-table*) "#8B3A3A"
558 (gethash "sienna1" *color-table*) "#FF8247"
559 (gethash "sienna2" *color-table*) "#EE7942"
560 (gethash "sienna3" *color-table*) "#CD6839"
561 (gethash "sienna4" *color-table*) "#8B4726"
562 (gethash "burlywood1" *color-table*) "#FFD39B"
563 (gethash "burlywood2" *color-table*) "#EEC591"
564 (gethash "burlywood3" *color-table*) "#CDAA7D"
565 (gethash "burlywood4" *color-table*) "#8B7355"
566 (gethash "wheat1" *color-table*) "#FFE7BA"
567 (gethash "wheat2" *color-table*) "#EED8AE"
568 (gethash "wheat3" *color-table*) "#CDBA96"
569 (gethash "wheat4" *color-table*) "#8B7E66"
570 (gethash "tan1" *color-table*) "#FFA54F"
571 (gethash "tan2" *color-table*) "#EE9A49"
572 (gethash "tan3" *color-table*) "#CD853F"
573 (gethash "tan4" *color-table*) "#8B5A2B"
574 (gethash "chocolate1" *color-table*) "#FF7F24"
575 (gethash "chocolate2" *color-table*) "#EE7621"
576 (gethash "chocolate3" *color-table*) "#CD661D"
577 (gethash "chocolate4" *color-table*) "#8B4513"
578 (gethash "firebrick1" *color-table*) "#FF3030"
579 (gethash "firebrick2" *color-table*) "#EE2C2C"
580 (gethash "firebrick3" *color-table*) "#CD2626"
581 (gethash "firebrick4" *color-table*) "#8B1A1A"
582 (gethash "brown1" *color-table*) "#FF4040"
583 (gethash "brown2" *color-table*) "#EE3B3B"
584 (gethash "brown3" *color-table*) "#CD3333"
585 (gethash "brown4" *color-table*) "#8B2323"
586 (gethash "salmon1" *color-table*) "#FF8C69"
587 (gethash "salmon2" *color-table*) "#EE8262"
588 (gethash "salmon3" *color-table*) "#CD7054"
589 (gethash "salmon4" *color-table*) "#8B4C39"
590 (gethash "lightsalmon1" *color-table*) "#FFA07A"
591 (gethash "lightsalmon2" *color-table*) "#EE9572"
592 (gethash "lightsalmon3" *color-table*) "#CD8162"
593 (gethash "lightsalmon4" *color-table*) "#8B5742"
594 (gethash "orange1" *color-table*) "#FFA500"
595 (gethash "orange2" *color-table*) "#EE9A00"
596 (gethash "orange3" *color-table*) "#CD8500"
597 (gethash "orange4" *color-table*) "#8B5A00"
598 (gethash "darkorange1" *color-table*) "#FF7F00"
599 (gethash "darkorange2" *color-table*) "#EE7600"
600 (gethash "darkorange3" *color-table*) "#CD6600"
601 (gethash "darkorange4" *color-table*) "#8B4500"
602 (gethash "coral1" *color-table*) "#FF7256"
603 (gethash "coral2" *color-table*) "#EE6A50"
604 (gethash "coral3" *color-table*) "#CD5B45"
605 (gethash "coral4" *color-table*) "#8B3E2F"
606 (gethash "tomato1" *color-table*) "#FF6347"
607 (gethash "tomato2" *color-table*) "#EE5C42"
608 (gethash "tomato3" *color-table*) "#CD4F39"
609 (gethash "tomato4" *color-table*) "#8B3626"
610 (gethash "orangered1" *color-table*) "#FF4500"
611 (gethash "orangered2" *color-table*) "#EE4000"
612 (gethash "orangered3" *color-table*) "#CD3700"
613 (gethash "orangered4" *color-table*) "#8B2500"
614 (gethash "red1" *color-table*) "#FF0000"
615 (gethash "red2" *color-table*) "#EE0000"
616 (gethash "red3" *color-table*) "#CD0000"
617 (gethash "red4" *color-table*) "#8B0000"
618 (gethash "debianred" *color-table*) "#D70751"
619 (gethash "deeppink1" *color-table*) "#FF1493"
620 (gethash "deeppink2" *color-table*) "#EE1289"
621 (gethash "deeppink3" *color-table*) "#CD1076"
622 (gethash "deeppink4" *color-table*) "#8B0A50"
623 (gethash "hotpink1" *color-table*) "#FF6EB4"
624 (gethash "hotpink2" *color-table*) "#EE6AA7"
625 (gethash "hotpink3" *color-table*) "#CD6090"
626 (gethash "hotpink4" *color-table*) "#8B3A62"
627 (gethash "pink1" *color-table*) "#FFB5C5"
628 (gethash "pink2" *color-table*) "#EEA9B8"
629 (gethash "pink3" *color-table*) "#CD919E"
630 (gethash "pink4" *color-table*) "#8B636C"
631 (gethash "lightpink1" *color-table*) "#FFAEB9"
632 (gethash "lightpink2" *color-table*) "#EEA2AD"
633 (gethash "lightpink3" *color-table*) "#CD8C95"
634 (gethash "lightpink4" *color-table*) "#8B5F65"
635 (gethash "palevioletred1" *color-table*) "#FF82AB"
636 (gethash "palevioletred2" *color-table*) "#EE799F"
637 (gethash "palevioletred3" *color-table*) "#CD6889"
638 (gethash "palevioletred4" *color-table*) "#8B475D"
639 (gethash "maroon1" *color-table*) "#FF34B3"
640 (gethash "maroon2" *color-table*) "#EE30A7"
641 (gethash "maroon3" *color-table*) "#CD2990"
642 (gethash "maroon4" *color-table*) "#8B1C62"
643 (gethash "violetred1" *color-table*) "#FF3E96"
644 (gethash "violetred2" *color-table*) "#EE3A8C"
645 (gethash "violetred3" *color-table*) "#CD3278"
646 (gethash "violetred4" *color-table*) "#8B2252"
647 (gethash "magenta1" *color-table*) "#FF00FF"
648 (gethash "magenta2" *color-table*) "#EE00EE"
649 (gethash "magenta3" *color-table*) "#CD00CD"
650 (gethash "magenta4" *color-table*) "#8B008B"
651 (gethash "orchid1" *color-table*) "#FF83FA"
652 (gethash "orchid2" *color-table*) "#EE7AE9"
653 (gethash "orchid3" *color-table*) "#CD69C9"
654 (gethash "orchid4" *color-table*) "#8B4789"
655 (gethash "plum1" *color-table*) "#FFBBFF"
656 (gethash "plum2" *color-table*) "#EEAEEE"
657 (gethash "plum3" *color-table*) "#CD96CD"
658 (gethash "plum4" *color-table*) "#8B668B"
659 (gethash "mediumorchid1" *color-table*) "#E066FF"
660 (gethash "mediumorchid2" *color-table*) "#D15FEE"
661 (gethash "mediumorchid3" *color-table*) "#B452CD"
662 (gethash "mediumorchid4" *color-table*) "#7A378B"
663 (gethash "darkorchid1" *color-table*) "#BF3EFF"
664 (gethash "darkorchid2" *color-table*) "#B23AEE"
665 (gethash "darkorchid3" *color-table*) "#9A32CD"
666 (gethash "darkorchid4" *color-table*) "#68228B"
667 (gethash "purple1" *color-table*) "#9B30FF"
668 (gethash "purple2" *color-table*) "#912CEE"
669 (gethash "purple3" *color-table*) "#7D26CD"
670 (gethash "purple4" *color-table*) "#551A8B"
671 (gethash "mediumpurple1" *color-table*) "#AB82FF"
672 (gethash "mediumpurple2" *color-table*) "#9F79EE"
673 (gethash "mediumpurple3" *color-table*) "#8968CD"
674 (gethash "mediumpurple4" *color-table*) "#5D478B"
675 (gethash "thistle1" *color-table*) "#FFE1FF"
676 (gethash "thistle2" *color-table*) "#EED2EE"
677 (gethash "thistle3" *color-table*) "#CDB5CD"
678 (gethash "thistle4" *color-table*) "#8B7B8B"
679 (gethash "gray0" *color-table*) "#000000"
680 (gethash "grey0" *color-table*) "#000000"
681 (gethash "gray1" *color-table*) "#030303"
682 (gethash "grey1" *color-table*) "#030303"
683 (gethash "gray2" *color-table*) "#050505"
684 (gethash "grey2" *color-table*) "#050505"
685 (gethash "gray3" *color-table*) "#080808"
686 (gethash "grey3" *color-table*) "#080808"
687 (gethash "gray4" *color-table*) "#0A0A0A"
688 (gethash "grey4" *color-table*) "#0A0A0A"
689 (gethash "gray5" *color-table*) "#0D0D0D"
690 (gethash "grey5" *color-table*) "#0D0D0D"
691 (gethash "gray6" *color-table*) "#0F0F0F"
692 (gethash "grey6" *color-table*) "#0F0F0F"
693 (gethash "gray7" *color-table*) "#121212"
694 (gethash "grey7" *color-table*) "#121212"
695 (gethash "gray8" *color-table*) "#141414"
696 (gethash "grey8" *color-table*) "#141414"
697 (gethash "gray9" *color-table*) "#171717"
698 (gethash "grey9" *color-table*) "#171717"
699 (gethash "gray10" *color-table*) "#1A1A1A"
700 (gethash "grey10" *color-table*) "#1A1A1A"
701 (gethash "gray11" *color-table*) "#1C1C1C"
702 (gethash "grey11" *color-table*) "#1C1C1C"
703 (gethash "gray12" *color-table*) "#1F1F1F"
704 (gethash "grey12" *color-table*) "#1F1F1F"
705 (gethash "gray13" *color-table*) "#212121"
706 (gethash "grey13" *color-table*) "#212121"
707 (gethash "gray14" *color-table*) "#242424"
708 (gethash "grey14" *color-table*) "#242424"
709 (gethash "gray15" *color-table*) "#262626"
710 (gethash "grey15" *color-table*) "#262626"
711 (gethash "gray16" *color-table*) "#292929"
712 (gethash "grey16" *color-table*) "#292929"
713 (gethash "gray17" *color-table*) "#2B2B2B"
714 (gethash "grey17" *color-table*) "#2B2B2B"
715 (gethash "gray18" *color-table*) "#2E2E2E"
716 (gethash "grey18" *color-table*) "#2E2E2E"
717 (gethash "gray19" *color-table*) "#303030"
718 (gethash "grey19" *color-table*) "#303030"
719 (gethash "gray20" *color-table*) "#333333"
720 (gethash "grey20" *color-table*) "#333333"
721 (gethash "gray21" *color-table*) "#363636"
722 (gethash "grey21" *color-table*) "#363636"
723 (gethash "gray22" *color-table*) "#383838"
724 (gethash "grey22" *color-table*) "#383838"
725 (gethash "gray23" *color-table*) "#3B3B3B"
726 (gethash "grey23" *color-table*) "#3B3B3B"
727 (gethash "gray24" *color-table*) "#3D3D3D"
728 (gethash "grey24" *color-table*) "#3D3D3D"
729 (gethash "gray25" *color-table*) "#404040"
730 (gethash "grey25" *color-table*) "#404040"
731 (gethash "gray26" *color-table*) "#424242"
732 (gethash "grey26" *color-table*) "#424242"
733 (gethash "gray27" *color-table*) "#454545"
734 (gethash "grey27" *color-table*) "#454545"
735 (gethash "gray28" *color-table*) "#474747"
736 (gethash "grey28" *color-table*) "#474747"
737 (gethash "gray29" *color-table*) "#4A4A4A"
738 (gethash "grey29" *color-table*) "#4A4A4A"
739 (gethash "gray30" *color-table*) "#4D4D4D"
740 (gethash "grey30" *color-table*) "#4D4D4D"
741 (gethash "gray31" *color-table*) "#4F4F4F"
742 (gethash "grey31" *color-table*) "#4F4F4F"
743 (gethash "gray32" *color-table*) "#525252"
744 (gethash "grey32" *color-table*) "#525252"
745 (gethash "gray33" *color-table*) "#545454"
746 (gethash "grey33" *color-table*) "#545454"
747 (gethash "gray34" *color-table*) "#575757"
748 (gethash "grey34" *color-table*) "#575757"
749 (gethash "gray35" *color-table*) "#595959"
750 (gethash "grey35" *color-table*) "#595959"
751 (gethash "gray36" *color-table*) "#5C5C5C"
752 (gethash "grey36" *color-table*) "#5C5C5C"
753 (gethash "gray37" *color-table*) "#5E5E5E"
754 (gethash "grey37" *color-table*) "#5E5E5E"
755 (gethash "gray38" *color-table*) "#616161"
756 (gethash "grey38" *color-table*) "#616161"
757 (gethash "gray39" *color-table*) "#636363"
758 (gethash "grey39" *color-table*) "#636363"
759 (gethash "gray40" *color-table*) "#666666"
760 (gethash "grey40" *color-table*) "#666666"
761 (gethash "gray41" *color-table*) "#696969"
762 (gethash "grey41" *color-table*) "#696969"
763 (gethash "gray42" *color-table*) "#6B6B6B"
764 (gethash "grey42" *color-table*) "#6B6B6B"
765 (gethash "gray43" *color-table*) "#6E6E6E"
766 (gethash "grey43" *color-table*) "#6E6E6E"
767 (gethash "gray44" *color-table*) "#707070"
768 (gethash "grey44" *color-table*) "#707070"
769 (gethash "gray45" *color-table*) "#737373"
770 (gethash "grey45" *color-table*) "#737373"
771 (gethash "gray46" *color-table*) "#757575"
772 (gethash "grey46" *color-table*) "#757575"
773 (gethash "gray47" *color-table*) "#787878"
774 (gethash "grey47" *color-table*) "#787878"
775 (gethash "gray48" *color-table*) "#7A7A7A"
776 (gethash "grey48" *color-table*) "#7A7A7A"
777 (gethash "gray49" *color-table*) "#7D7D7D"
778 (gethash "grey49" *color-table*) "#7D7D7D"
779 (gethash "gray50" *color-table*) "#7F7F7F"
780 (gethash "grey50" *color-table*) "#7F7F7F"
781 (gethash "gray51" *color-table*) "#828282"
782 (gethash "grey51" *color-table*) "#828282"
783 (gethash "gray52" *color-table*) "#858585"
784 (gethash "grey52" *color-table*) "#858585"
785 (gethash "gray53" *color-table*) "#878787"
786 (gethash "grey53" *color-table*) "#878787"
787 (gethash "gray54" *color-table*) "#8A8A8A"
788 (gethash "grey54" *color-table*) "#8A8A8A"
789 (gethash "gray55" *color-table*) "#8C8C8C"
790 (gethash "grey55" *color-table*) "#8C8C8C"
791 (gethash "gray56" *color-table*) "#8F8F8F"
792 (gethash "grey56" *color-table*) "#8F8F8F"
793 (gethash "gray57" *color-table*) "#919191"
794 (gethash "grey57" *color-table*) "#919191"
795 (gethash "gray58" *color-table*) "#949494"
796 (gethash "grey58" *color-table*) "#949494"
797 (gethash "gray59" *color-table*) "#969696"
798 (gethash "grey59" *color-table*) "#969696"
799 (gethash "gray60" *color-table*) "#999999"
800 (gethash "grey60" *color-table*) "#999999"
801 (gethash "gray61" *color-table*) "#9C9C9C"
802 (gethash "grey61" *color-table*) "#9C9C9C"
803 (gethash "gray62" *color-table*) "#9E9E9E"
804 (gethash "grey62" *color-table*) "#9E9E9E"
805 (gethash "gray63" *color-table*) "#A1A1A1"
806 (gethash "grey63" *color-table*) "#A1A1A1"
807 (gethash "gray64" *color-table*) "#A3A3A3"
808 (gethash "grey64" *color-table*) "#A3A3A3"
809 (gethash "gray65" *color-table*) "#A6A6A6"
810 (gethash "grey65" *color-table*) "#A6A6A6"
811 (gethash "gray66" *color-table*) "#A8A8A8"
812 (gethash "grey66" *color-table*) "#A8A8A8"
813 (gethash "gray67" *color-table*) "#ABABAB"
814 (gethash "grey67" *color-table*) "#ABABAB"
815 (gethash "gray68" *color-table*) "#ADADAD"
816 (gethash "grey68" *color-table*) "#ADADAD"
817 (gethash "gray69" *color-table*) "#B0B0B0"
818 (gethash "grey69" *color-table*) "#B0B0B0"
819 (gethash "gray70" *color-table*) "#B3B3B3"
820 (gethash "grey70" *color-table*) "#B3B3B3"
821 (gethash "gray71" *color-table*) "#B5B5B5"
822 (gethash "grey71" *color-table*) "#B5B5B5"
823 (gethash "gray72" *color-table*) "#B8B8B8"
824 (gethash "grey72" *color-table*) "#B8B8B8"
825 (gethash "gray73" *color-table*) "#BABABA"
826 (gethash "grey73" *color-table*) "#BABABA"
827 (gethash "gray74" *color-table*) "#BDBDBD"
828 (gethash "grey74" *color-table*) "#BDBDBD"
829 (gethash "gray75" *color-table*) "#BFBFBF"
830 (gethash "grey75" *color-table*) "#BFBFBF"
831 (gethash "gray76" *color-table*) "#C2C2C2"
832 (gethash "grey76" *color-table*) "#C2C2C2"
833 (gethash "gray77" *color-table*) "#C4C4C4"
834 (gethash "grey77" *color-table*) "#C4C4C4"
835 (gethash "gray78" *color-table*) "#C7C7C7"
836 (gethash "grey78" *color-table*) "#C7C7C7"
837 (gethash "gray79" *color-table*) "#C9C9C9"
838 (gethash "grey79" *color-table*) "#C9C9C9"
839 (gethash "gray80" *color-table*) "#CCCCCC"
840 (gethash "grey80" *color-table*) "#CCCCCC"
841 (gethash "gray81" *color-table*) "#CFCFCF"
842 (gethash "grey81" *color-table*) "#CFCFCF"
843 (gethash "gray82" *color-table*) "#D1D1D1"
844 (gethash "grey82" *color-table*) "#D1D1D1"
845 (gethash "gray83" *color-table*) "#D4D4D4"
846 (gethash "grey83" *color-table*) "#D4D4D4"
847 (gethash "gray84" *color-table*) "#D6D6D6"
848 (gethash "grey84" *color-table*) "#D6D6D6"
849 (gethash "gray85" *color-table*) "#D9D9D9"
850 (gethash "grey85" *color-table*) "#D9D9D9"
851 (gethash "gray86" *color-table*) "#DBDBDB"
852 (gethash "grey86" *color-table*) "#DBDBDB"
853 (gethash "gray87" *color-table*) "#DEDEDE"
854 (gethash "grey87" *color-table*) "#DEDEDE"
855 (gethash "gray88" *color-table*) "#E0E0E0"
856 (gethash "grey88" *color-table*) "#E0E0E0"
857 (gethash "gray89" *color-table*) "#E3E3E3"
858 (gethash "grey89" *color-table*) "#E3E3E3"
859 (gethash "gray90" *color-table*) "#E5E5E5"
860 (gethash "grey90" *color-table*) "#E5E5E5"
861 (gethash "gray91" *color-table*) "#E8E8E8"
862 (gethash "grey91" *color-table*) "#E8E8E8"
863 (gethash "gray92" *color-table*) "#EBEBEB"
864 (gethash "grey92" *color-table*) "#EBEBEB"
865 (gethash "gray93" *color-table*) "#EDEDED"
866 (gethash "grey93" *color-table*) "#EDEDED"
867 (gethash "gray94" *color-table*) "#F0F0F0"
868 (gethash "grey94" *color-table*) "#F0F0F0"
869 (gethash "gray95" *color-table*) "#F2F2F2"
870 (gethash "grey95" *color-table*) "#F2F2F2"
871 (gethash "gray96" *color-table*) "#F5F5F5"
872 (gethash "grey96" *color-table*) "#F5F5F5"
873 (gethash "gray97" *color-table*) "#F7F7F7"
874 (gethash "grey97" *color-table*) "#F7F7F7"
875 (gethash "gray98" *color-table*) "#FAFAFA"
876 (gethash "grey98" *color-table*) "#FAFAFA"
877 (gethash "gray99" *color-table*) "#FCFCFC"
878 (gethash "grey99" *color-table*) "#FCFCFC"
879 (gethash "gray100" *color-table*) "#FFFFFF"
880 (gethash "grey100" *color-table*) "#FFFFFF"
881 (gethash "darkgrey" *color-table*) "#A9A9A9"
882 (gethash "darkgray" *color-table*) "#A9A9A9"
883 (gethash "darkblue" *color-table*) "#00008B"
884 (gethash "darkcyan" *color-table*) "#008B8B"
885 (gethash "darkmagenta" *color-table*) "#8B008B"
886 (gethash "lightred" *color-table*) "#f03232"
887 (gethash "darkred" *color-table*) "#8B0000"
888 (gethash "lightgreen" *color-table*) "#90EE90")
890 (defun correct-color-name (str)
891 (some #'(lambda (z) (string= z str))
892 (loop for k being the hash-keys of *color-table* collect k)))
894 ;; Hex colors can either read
895 ;; #rrggbb or #rrggbbaa
896 ;; with rr, bb, gg and aa being two-digit hex numbers.
897 ;; Numbers containing a transparency aa only work if the gnuplot version
898 ;; that is being used supports it which should be any gnuplot >=5.0.
899 (defun correct-color-hex (str)
900 (and ( or (= (length str) 7) (= (length str) 9))
901 (char= (schar str 0) #\#)
902 (every #'(lambda (z) (position z "0123456789abcdef"))
903 (subseq str 1))))
905 (defun correct-color (str)
906 (or (correct-color-name str)
907 (correct-color-hex str)
908 (string= str "auto")))
910 (defun hex-to-numeric-list (str)
911 (let ((hex1 (subseq str 1 3))
912 (hex2 (subseq str 3 5))
913 (hex3 (subseq str 5)))
914 (list
915 (/ (parse-integer hex1 :radix 16) 255.0)
916 (/ (parse-integer hex2 :radix 16) 255.0)
917 (/ (parse-integer hex3 :radix 16) 255.0))))
919 ;; Interprets a rgb string or a rgba string and converts the latter to argb
920 ;; as gnuplot needs this format
921 (defun hex-to-rgb (str)
922 (if (= (length str) 7)
923 (format nil "rgb '~a'" str)
924 (format nil "rgb '#~a~a'" (subseq str 7 9) (subseq str 1 7))))
926 (defun update-color (opt val)
927 (if (numberp val)
928 (case val
929 (0 (setf val "black"))
930 (1 (setf val "red"))
931 (2 (setf val "blue"))
932 (3 (setf val "green"))
933 (4 (setf val "pink"))
934 (5 (setf val "orange"))
935 (6 (setf val "violet"))
936 (7 (setf val "yellow"))
937 (8 (setf val "magenta"))
938 (9 (setf val "cyan"))
939 (10 (setf val "gray"))
940 (11 (setf val "springgreen"))
941 (12 (setf val "darkcyan"))
942 (13 (setf val "darkmagenta"))
943 (14 (setf val "darkred"))
944 (15 (setf val "mintcream"))
945 (16 (setf val "azure"))
946 (17 (setf val "navy"))
947 (otherwise (merror "model3d: unknown color ~M" val))))
948 (let ((str (atom-to-downcased-string val)))
949 (unless (correct-color str)
950 (merror "model3d: unknown color ~M" val))
951 (when (correct-color-name str)
952 (setf str (gethash str *color-table*)))
953 (setf (gethash opt *gr-options*) str)))
958 ;; update option key_pos
959 ;; ---------------------
960 (defun update-key_pos (val)
961 (case val
962 ($top_left (setf (gethash '$key_pos *gr-options*) "top left"))
963 ($top_center (setf (gethash '$key_pos *gr-options*) "top center"))
964 ($top_right (setf (gethash '$key_pos *gr-options*) "top right"))
965 ($center_left (setf (gethash '$key_pos *gr-options*) "center left"))
966 ($center (setf (gethash '$key_pos *gr-options*) "center center"))
967 ($center_right (setf (gethash '$key_pos *gr-options*) "center right"))
968 ($bottom_left (setf (gethash '$key_pos *gr-options*) "bottom left"))
969 ($bottom_center (setf (gethash '$key_pos *gr-options*) "bottom center"))
970 ($bottom_right (setf (gethash '$key_pos *gr-options*) "bottom right"))
971 (otherwise (merror "draw: illegal key position specification"))))
974 ;; update option terminal
975 ;; ----------------------
976 ;; *draw-terminal-number* is used when working with
977 ;; multiple windows. Empty string means
978 ;; we are working with only one window
979 (defvar *draw-terminal-number* "")
981 (defun update-terminal (val)
982 (let ((terms '($screen $png $pngcairo $jpg $gif $eps $eps_color $canvas
983 $epslatex $epslatex_standalone $svg $x11 $qt
984 $dumb $dumb_file $pdf $pdfcairo $wxt $animated_gif $windows
985 $multipage_pdfcairo $multipage_pdf $multipage_eps
986 $multipage_eps_color $aquaterm $tiff $vrml $obj $stl $pnm $ply)))
987 (cond
988 ((member val terms)
989 (when (and (eq val '$png) $draw_use_pngcairo)
990 (setq val '$pngcairo))
991 (setf (gethash '$terminal *gr-options*) val
992 *draw-terminal-number* ""))
993 ((and ($listp val)
994 (= ($length val) 2)
995 (member (cadr val) '($screen $wxt $aquaterm $qt $windows))
996 (integerp (caddr val))
997 (>= (caddr val) 0))
998 (setf (gethash '$terminal *gr-options*) (cadr val)
999 *draw-terminal-number* (caddr val)))
1001 (merror "draw: illegal terminal specification: ~M" val)))))
1006 ;; update option transform
1007 ;; -----------------------
1008 (defvar *draw-transform-dimensions* 0)
1009 (defvar *draw-transform-f1* nil)
1010 (defvar *draw-transform-f2* nil)
1011 (defvar *draw-transform-f3* nil)
1013 (defmacro transform-point (n)
1014 (if (= n 2)
1015 '(when (> *draw-transform-dimensions* 0)
1016 (let ((xold xx)
1017 (yold yy))
1018 (setf xx (funcall *draw-transform-f1* xold yold)
1019 yy (funcall *draw-transform-f2* xold yold))))
1020 '(when (> *draw-transform-dimensions* 0)
1021 (let ((xold xx)
1022 (yold yy)
1023 (zold zz))
1024 (setf xx (funcall *draw-transform-f1* xold yold zold)
1025 yy (funcall *draw-transform-f2* xold yold zold)
1026 zz (funcall *draw-transform-f3* xold yold zold) )))))
1028 (defmacro transform-lists (n)
1029 (if (= n 2)
1030 '(when (> *draw-transform-dimensions* 0)
1031 (let ((xold x)
1032 (yold y))
1033 (setf x (mapcar #'(lambda (u1 u2) (funcall *draw-transform-f1* u1 u2))
1034 xold yold)
1035 y (mapcar #'(lambda (u1 u2) (funcall *draw-transform-f2* u1 u2))
1036 xold yold)) ))
1037 '(when (> *draw-transform-dimensions* 0)
1038 (let ((xold x)
1039 (yold y)
1040 (zold z))
1041 (setf x (mapcar #'(lambda (u1 u2 u3) (funcall *draw-transform-f1* u1 u2 u3))
1042 xold yold zold)
1043 y (mapcar #'(lambda (u1 u2 u3) (funcall *draw-transform-f2* u1 u2 u3))
1044 xold yold zold)
1045 z (mapcar #'(lambda (u1 u2 u3) (funcall *draw-transform-f3* u1 u2 u3))
1046 xold yold zold))) )))
1048 (defun update-transform (val)
1049 (let (vars)
1050 (cond
1051 ((equal val '$none)
1052 (setf (gethash '$transform *gr-options*) '$none
1053 *draw-transform-dimensions* 0
1054 *draw-transform-f1* nil
1055 *draw-transform-f2* nil
1056 *draw-transform-f3* nil))
1057 ((and ($listp val)
1058 (= ($length val) 4)
1059 ($subsetp ($union ($setify ($listofvars ($first val)))
1060 ($setify ($listofvars ($second val))))
1061 ($setify (list '(mlist) ($third val) ($fourth val)))) )
1062 ; transformation in 2d
1063 (setf vars (list '(mlist) ($third val) ($fourth val)))
1064 (setf (gethash '$transform *gr-options*) val
1065 *draw-transform-dimensions* 2
1066 *draw-transform-f1* (coerce-float-fun ($first val) vars)
1067 *draw-transform-f2* (coerce-float-fun ($second val) vars) ))
1068 ((and ($listp val)
1069 (= ($length val) 6)
1070 ($subsetp ($union ($setify ($listofvars ($first val)))
1071 ($setify ($listofvars ($second val)))
1072 ($setify ($listofvars ($third val))))
1073 ($setify (list '(mlist) ($fourth val) ($fifth val) ($sixth val)))) )
1074 ; transformation in 3d
1075 (setf vars (list '(mlist) ($fourth val) ($fifth val) ($sixth val)))
1076 (setf (gethash '$transform *gr-options*) val
1077 *draw-transform-dimensions* 3
1078 *draw-transform-f1* (coerce-float-fun ($first val) vars)
1079 *draw-transform-f2* (coerce-float-fun ($second val) vars)
1080 *draw-transform-f3* (coerce-float-fun ($third val) vars)))
1082 (merror "draw: illegal transform definition")) )))
1087 ;; update option enhanced3d
1088 ;; ------------------------
1089 (defvar *draw-enhanced3d-type* 0)
1090 (defvar *draw-enhanced3d-fun* nil)
1092 (defun check-enhanced3d-model (grobj lis)
1093 (when (null (position *draw-enhanced3d-type* lis))
1094 (merror (format nil "draw (~a): unacceptable enhanced3d model" grobj))))
1096 (defun update-enhanced3d-expression (vars)
1097 (let ((texture (gethash '$enhanced3d *gr-options*)))
1098 (when (not ($subsetp ($setify ($listofvars texture))
1099 ($setify vars)))
1100 (merror "draw: incompatible variables in enhanced3d expression"))
1101 (setf *draw-enhanced3d-fun* (coerce-float-fun texture vars))))
1103 (defun update-enhanced3d (val)
1104 (cond
1105 ((or (null val)
1106 (equal val '$none))
1107 (setf (gethash '$enhanced3d *gr-options*) '$none
1108 *draw-enhanced3d-type* 0
1109 *draw-enhanced3d-fun* nil))
1110 ((equal val t)
1111 (let ((model '((mlist) $z $x $y $z)))
1112 (setf (gethash '$enhanced3d *gr-options*) model
1113 *draw-enhanced3d-type* 3
1114 *draw-enhanced3d-fun* (coerce-float-fun
1115 ($first model)
1116 (list '(mlist) ($second model) ($third model) ($fourth model))))))
1117 ((and ($listp val)
1118 ($subsetp ($setify ($listofvars ($first val)))
1119 ($setify ($rest val))))
1120 (case ($length val)
1121 (2 (setf (gethash '$enhanced3d *gr-options*) val
1122 *draw-enhanced3d-type* 1
1123 *draw-enhanced3d-fun* (coerce-float-fun
1124 ($first val)
1125 (list '(mlist) ($second val)))))
1126 (3 (setf (gethash '$enhanced3d *gr-options*) val
1127 *draw-enhanced3d-type* 2
1128 *draw-enhanced3d-fun* (coerce-float-fun
1129 ($first val)
1130 (list '(mlist) ($second val) ($third val)))))
1131 (4 (setf (gethash '$enhanced3d *gr-options*) val
1132 *draw-enhanced3d-type* 3
1133 *draw-enhanced3d-fun* (coerce-float-fun
1134 ($first val)
1135 (list '(mlist) ($second val) ($third val) ($fourth val)))))
1136 (otherwise (merror "draw: illegal length of enhanced3d"))))
1137 ((not ($listp val))
1138 ; enhanced3d is given an expression without
1139 ; explicit declaration of its variables.
1140 ; Each graphic object must check for them.
1141 (setf (gethash '$enhanced3d *gr-options*) val
1142 *draw-enhanced3d-type* 99
1143 *draw-enhanced3d-fun* nil))
1145 (merror "draw: illegal enhanced3d definition")) ) )
1149 ;; update option isolines
1150 ;; ----------------------
1151 (defvar *draw-isolines-type* 0)
1152 (defvar *draw-isolines-fun* nil)
1154 (defun check-isolines-model (grobj lis)
1155 (when (null (position *draw-isolines-type* lis))
1156 (merror (format nil "draw (~a): unacceptable isolines model" grobj))))
1158 (defun update-isolines-expression (vars)
1159 (let ((texture (gethash '$isolines *gr-options*)))
1160 (when (not ($subsetp ($setify ($listofvars texture))
1161 ($setify vars)))
1162 (merror "draw: incompatible variables in isolines expression"))
1163 (setf *draw-isolines-fun* (coerce-float-fun texture vars))))
1165 (defun update-isolines (val)
1166 (cond
1167 ((or (null val)
1168 (equal val '$none))
1169 (setf (gethash '$isolines *gr-options*) '$none
1170 *draw-isolines-type* 0
1171 *draw-isolines-fun* nil))
1172 ((equal val t)
1173 (let ((model '((mlist) $z $x $y $z)))
1174 (setf (gethash '$isolines *gr-options*) model
1175 *draw-isolines-type* 3
1176 *draw-isolines-fun* (coerce-float-fun
1177 ($first model)
1178 (list '(mlist) ($second model) ($third model) ($fourth model))))))
1179 ((and ($listp val)
1180 ($subsetp ($setify ($listofvars ($first val)))
1181 ($setify ($rest val))))
1182 (case ($length val)
1183 (2 (setf (gethash '$isolines *gr-options*) val
1184 *draw-isolines-type* 1
1185 *draw-isolines-fun* (coerce-float-fun
1186 ($first val)
1187 (list '(mlist) ($second val)))))
1188 (3 (setf (gethash '$isolines *gr-options*) val
1189 *draw-isolines-type* 2
1190 *draw-isolines-fun* (coerce-float-fun
1191 ($first val)
1192 (list '(mlist) ($second val) ($third val)))))
1193 (4 (setf (gethash '$isolines *gr-options*) val
1194 *draw-isolines-type* 3
1195 *draw-isolines-fun* (coerce-float-fun
1196 ($first val)
1197 (list '(mlist) ($second val) ($third val) ($fourth val)))))
1198 (otherwise (merror "draw: illegal length of isolines"))))
1199 ((not ($listp val))
1200 ; isolines is given an expression without
1201 ; explicit declaration of its variables.
1202 ; Each graphic object must check for them.
1203 (setf (gethash '$isolines *gr-options*) val
1204 *draw-isolines-type* 99
1205 *draw-isolines-fun* nil))
1207 (merror "draw: illegal isolines definition")) ) )
1211 ;; update contour (Gnuplot) and isolines (VTK) levels
1212 ;; ---------------------------------------------------
1213 (defun update-contour-isolines (opt val)
1214 (cond ((and (integerp val) (> val 0 ))
1215 (setf (gethash opt *gr-options*) val))
1216 ((and ($listp val) (= ($length val) 3) )
1217 (let ((ini ($float (nth 1 val)))
1218 (step ($float (nth 2 val)))
1219 (end ($float (nth 3 val))))
1220 (cond ((and (< ini end)
1221 (< step (- end ini)))
1222 (setf (gethash opt *gr-options*) (format nil "incremental ~a,~a,~a" ini step end)))
1224 (merror "draw: illegal contour level incremental description: ~M " val))) ))
1225 ((and ($setp val) (not ($emptyp val)))
1226 (let ((pts (map 'list #'$float (rest val)))
1227 (str "discrete ") )
1228 (dolist (num pts 'done)
1229 (setf str (concatenate 'string str " " (format nil "~a," num))))
1230 (setf (gethash opt *gr-options*) (string-trim '(#\,) str) ) ))
1232 (merror "draw: unknown contour level description: ~M " val))))
1236 ;; update boolean type options
1237 ;; ---------------------------
1238 (defun update-boolean-option (opt val)
1239 (if (or (equal val t)
1240 (null val))
1241 (setf (gethash opt *gr-options*) val)
1242 (merror "draw: non boolean value: ~M " val)))
1246 ;; update positive integer type options
1247 ;; ------------------------------------
1248 (defun update-positive-integer (opt val)
1249 (if (and (integerp val)
1250 (> val 0 ))
1251 (setf (gethash opt *gr-options*) val)
1252 (merror "draw: non positive integer: ~M " val)))
1256 ;; update positive float type options
1257 ;; ----------------------------------
1258 (defun update-positive-float (opt val)
1259 (setf val ($float val))
1260 (if (and (numberp val)
1261 (> val 0 ))
1262 (setf (gethash opt *gr-options*) val)
1263 (merror "draw: Non positive number: ~M " val)))
1267 ;; update non negative float type options
1268 ;; --------------------------------------
1269 (defun update-nonnegative-float (opt val)
1270 (setf val ($float val))
1271 (if (and (numberp val)
1272 (>= val 0 ))
1273 (setf (gethash opt *gr-options*) val)
1274 (merror "draw: Not a non-negative number: ~M " val)))
1278 ;; update option: view
1279 ;; -------------------
1280 (defun update-view (val)
1281 (cond
1282 ((eql val '$map)
1283 (setf (gethash '$view *gr-options*) val))
1284 ((and ($listp val)
1285 (= ($length val) 2))
1286 (let ((rv ($float (cadr val)))
1287 (rh ($float (caddr val))) )
1288 (unless
1289 (and (numberp rv) (>= rv 0) (<= rv 360) )
1290 (merror "draw: vertical rotation angle must be in [0, 360]"))
1291 (unless
1292 (and (numberp rh) (>= rh 0) (<= rh 360) )
1293 (merror "draw: horizontal rotation angle must be in [0, 360]"))
1294 (setf (gethash '$view *gr-options*)
1295 (list rv rh))))
1297 (merror "draw: illegal view specification ~M" val)) ))
1301 ;; update option: interpolate_color
1302 ;; --------------------------------
1303 (defun update-interpolate_color (val)
1304 (cond
1305 ((null val)
1306 (setf (gethash '$interpolate_color *gr-options*) "depthorder"))
1307 ((equal val t)
1308 (setf (gethash '$interpolate_color *gr-options*) "interpolate 0, 0"))
1309 ((and ($listp val)
1310 (= ($length val) 2))
1311 (let ((x ($float (cadr val)))
1312 (y ($float (caddr val))) )
1313 (unless
1314 (and (numberp x) (numberp y))
1315 (merror "draw: interpolate_color parameters must be numbers"))
1316 (setf (gethash '$interpolate_color *gr-options*)
1317 (format nil "interpolate ~a,~a" x y))))
1319 (merror "draw: illegal interpolate_color specification ~M" val)) ))
1323 ;; update option allocation
1324 ;; ------------------------
1325 (defun update-allocation (val)
1326 (let (fval cls)
1327 (cond
1328 ((and ($listp val)
1329 (= ($length val) 2)
1330 (every #'(lambda (z) (and ($listp z)
1331 (= ($length z) 2)))
1332 (rest val))
1333 (setf fval (rest ($float val)))
1334 (setf cls (list (cadar fval) (caddar fval) (cadadr fval) (caddr (cadr fval))))
1335 (if (every #'(lambda (z) (and (float z) (>= z 0.0) (<= z 1.0))) cls)
1336 (setf (gethash '$allocation *gr-options*) cls)
1337 (merror "draw: allocations must me given in relative values")) ))
1339 (merror "draw: illegal allocation format ~M" val)))))
1343 ;; update option dimensions
1344 ;; ------------------------
1345 (defun update-dimensions (val)
1346 (let (cls)
1347 (cond
1348 ((and ($listp val)
1349 (= ($length val) 2))
1350 (setf cls (rest val))
1351 (if (every #'(lambda (z) (and (numberp z) (> z 0))) cls)
1352 (setf (gethash '$dimensions *gr-options*) cls)
1353 (merror "draw: illegal dimensions")))
1355 (merror "draw: illegal dimensions format ~M" val)))))
1359 ;; update option point_type
1360 ;; ------------------------
1361 (defun update-pointtype (val)
1362 (cond
1363 ((and (integerp val) (>= val -1 ))
1364 (setf (gethash '$point_type *gr-options*) val))
1365 (t (let*
1366 ((shapes '($none $dot $plus $multiply $asterisk
1367 $square $filled_square $circle $filled_circle
1368 $up_triangle $filled_up_triangle $down_triangle
1369 $filled_down_triangle $diamant $filled_diamant
1370 $sphere $cube $cylinder $cone))
1371 (pos (position val shapes)))
1372 (if pos
1373 (setf (gethash '$point_type *gr-options*) (- pos 1))
1374 (merror "draw: illegal point type: ~M " val))))))
1378 ;; update string type options
1379 ;; --------------------------
1380 (defun update-string (opt val)
1381 (setf (gethash opt *gr-options*) ($sconcat val)))
1385 ;; update opacity option
1386 ;; ---------------------
1387 (defun update-opacity (val)
1388 (let ((value ($float val)))
1389 (when (or (not (floatp value))
1390 (> value 1)
1391 (< value 0))
1392 (merror "draw: illegal opacity value: ~M " val))
1393 (setf (gethash '$opacity *gr-options*) value)))
1397 ;; update palette option
1398 ;; ---------------------
1400 (defun update-palette (val)
1401 ; defined as $color, $gray, [f1,f2,f3], with -36<=fi<=36,
1402 ; or a list of triplets defining a user palette.
1403 (cond ((member val '($color $gray))
1404 (setf (gethash '$palette *gr-options*) val))
1406 ((and ($listp val)
1407 (= ($length val) 3)
1408 (every #'(lambda (x) (and (integerp x) (<= (abs x) 36)))
1409 (cdr val)) )
1410 (setf (gethash '$palette *gr-options*) (rest val)))
1412 ((and ($listp val) ; user defined palette without transparency
1413 (not ($listp (cadr val)) ))
1414 (let* ((palette (cdr val))
1415 (n (length palette))
1416 str color)
1417 (setf (gethash '$palette *gr-options*)
1418 (loop for k below n
1419 do (setf str (atom-to-downcased-string (nth k palette)))
1420 (cond ((correct-color-hex str)
1421 (setf color (hex-to-numeric-list str)))
1422 ((correct-color-name str)
1423 (setf color (hex-to-numeric-list (gethash str *color-table*))))
1425 (merror "draw: illegal color in palette description")))
1426 collect color))))
1428 ((and ($listp val) ; user defined palette with transparency
1429 (every #'(lambda (x) (and ($listp x) (= (length x) 3)))
1430 (cdr val)))
1431 (let* ((palette (cdr val))
1432 (n (length palette))
1433 str color transparency)
1434 (setf (gethash '$palette *gr-options*)
1435 (loop for k below n
1436 do (setf str (atom-to-downcased-string ($first (nth k palette))))
1437 (cond ((correct-color-hex str)
1438 (setf color (hex-to-numeric-list str)))
1439 ((correct-color-name str)
1440 (setf color (hex-to-numeric-list (gethash str *color-table*))))
1442 (merror "draw: illegal color in palette description")))
1443 (setf transparency ($float ($second (nth k palette))))
1444 (when (or (< transparency 0)
1445 (> transparency 1)
1446 (not (floatp transparency)))
1447 (merror "draw: illegal transparency in palette description"))
1448 collect (append color (list transparency))))))
1451 (merror "draw: illegal palette description: ~M" val))) )
1455 ;; update line_type and line-axes
1456 ;; Negative indices indicate the number of faces to be drawn in case of tubes.
1457 ;; Default number of faces is 8.
1458 ;; --------------------------------------------------------------------------
1459 (defun update-linestyle (opt val)
1460 (cond
1461 ((atom val)
1462 (case val
1463 ($dots (setf (gethash opt *gr-options*) 0))
1464 ($solid (setf (gethash opt *gr-options*) 1))
1465 ($dashes (setf (gethash opt *gr-options*) 2))
1466 ($short_dashes (setf (gethash opt *gr-options*) 3))
1467 ($short_long_dashes (setf (gethash opt *gr-options*) 4))
1468 ($short_short_long_dashes (setf (gethash opt *gr-options*) 5))
1469 ($dot_dash (setf (gethash opt *gr-options*) 6))
1470 ($tube (setf (gethash opt *gr-options*) -8))
1471 (otherwise
1472 (if (numberp val)
1473 (setf (gethash opt *gr-options*) val) (merror "draw: illegal line type: ~M" val)))))
1474 ((and ($listp val)
1475 (= ($length val) 2)
1476 (equal ($first val) '$tube)
1477 (integerp ($second val))
1478 (> ($second val) 2))
1479 (setf (gethash opt *gr-options*) (- ($second val)) ) )
1481 (merror "draw: unknown line type: ~M" val))))
1485 ;; update points_joined option
1486 ;; ---------------------------
1487 (defun update-pointsjoined (val)
1488 (if (member val '(t nil $impulses))
1489 (setf (gethash '$points_joined *gr-options*) val)
1490 (merror "draw: illegal points_joined option: ~M " val)) )
1494 ;; update capping option
1495 ;; a list of two elements, false and/or true
1496 ;; -----------------------------------------
1497 (defun update-capping (val)
1498 (cond
1499 ((and ($listp val)
1500 (= ($length val) 2)
1501 (member ($first val) '(nil t))
1502 (member ($second val) '(nil t)))
1503 (setf (gethash '$capping *gr-options*) val))
1504 ((member val '(nil t))
1505 (setf (gethash '$capping *gr-options*) (list '(mlist simp) val val)))
1507 (merror "draw: illegal capping: ~M " val))) )
1511 (defun ini-local-option-variables ()
1512 (setf ; global variables
1513 *draw-transform-dimensions* 0
1514 *draw-transform-f1* nil
1515 *draw-transform-f2* nil
1516 *draw-transform-f3* nil
1517 *draw-enhanced3d-type* 0
1518 *draw-enhanced3d-fun* nil
1519 *draw-isolines-type* 0
1520 *draw-isolines-fun* nil) )
1524 ;; Sets default values to global options
1525 (defun ini-global-options ()
1526 (setf ; global options
1527 (gethash '$columns *gr-options*) 1
1528 (gethash '$terminal *gr-options*) '$screen ; defined as screen, png, jpg, gif, svg,
1529 ; eps, eps_color, pdf, pdfcairo, wxt or
1530 ; aquaterm. A list of type [term, number]
1531 ; is also admitted if term is screen, wxt
1532 ; or aquaterm
1533 (gethash '$key_pos *gr-options*) nil
1534 (gethash '$dimensions *gr-options*) '(600 500)
1535 (gethash '$file_name *gr-options*) "maxima_out"
1536 (gethash '$gnuplot_file_name *gr-options*) (format nil "maxout~d.gnuplot" (getpid))
1537 (gethash '$data_file_name *gr-options*) (format nil "data~d.gnuplot" (getpid))
1538 (gethash '$delay *gr-options*) 5 ; delay for animated gif's, default 5*(1/100) sec
1542 ;; Sets new values to graphic options
1543 (defun update-gr-option (opt val)
1544 (case opt
1545 ($allocation
1546 (update-allocation val))
1547 ($dimensions
1548 (update-dimensions val))
1549 ($fill_density ; in range [0, 1]
1550 (setf val ($float val))
1551 (if (and (numberp val)
1552 (>= val 0 )
1553 (<= val 1 ))
1554 (setf (gethash opt *gr-options*) val)
1555 (merror "draw: fill_density must be a number in [0, 1]")))
1556 (($line_width $head_length $head_angle $xaxis_width $yaxis_width $zaxis_width)
1557 (update-positive-float opt val))
1558 ($xyplane ; defined as real number or false
1559 (setf val ($float val))
1560 (if (or (numberp val)
1561 (null val ))
1562 (setf (gethash opt *gr-options*) val)
1563 (merror "draw: illegal xyplane allocation: ~M " val)))
1564 ($point_size ; defined as non negative numbers
1565 (update-nonnegative-float opt val))
1566 ($points_joined ; defined as true, false or $impulses
1567 (update-pointsjoined val))
1568 ($colorbox ; defined as true, false or string
1569 (if (or (member val '(t nil))
1570 (stringp val) )
1571 (setf (gethash opt *gr-options*) val)
1572 (merror "draw: illegal colorbox option: ~M " val)) )
1573 (($line_type $xaxis_type $yaxis_type $zaxis_type) ; defined as $solid or $dots
1574 (update-linestyle opt val) )
1575 ($capping
1576 (update-capping val))
1577 ($point_type
1578 (update-pointtype val))
1579 (($columns $nticks $adapt_depth $xu_grid $yv_grid $delay $x_voxel $y_voxel $z_voxel $font_size)
1580 (update-positive-integer opt val))
1581 (($contour_levels $isolines_levels) ; positive integer, increment or set
1582 (update-contour-isolines opt val))
1583 ($opacity
1584 (update-opacity val))
1585 (($transparent $border $logx $logx_secondary $logy $logy_secondary
1586 $logz $logcb $head_both
1587 $xaxis_secondary $yaxis_secondary $axis_bottom $axis_left $axis_top
1588 $axis_right $axis_3d $surface_hide $xaxis $yaxis $zaxis $unit_vectors
1589 $xtics_rotate $ytics_rotate $xtics_secondary_rotate $ytics_secondary_rotate
1590 $ztics_rotate $xtics_axis $ytics_axis $xtics_secondary_axis
1591 $ytics_secondary_axis $ztics_axis $draw_realpart $wired_surface) ; true or false
1592 (update-boolean-option opt val))
1593 ($filled_func ; true, false or an expression
1594 (setf (gethash opt *gr-options*) val))
1595 ($transform
1596 (update-transform val))
1597 ($enhanced3d
1598 (update-enhanced3d val))
1599 ($isolines
1600 (update-isolines val))
1601 (($xtics $ytics $xtics_secondary $ytics_secondary $ztics $cbtics)
1602 ; $auto or t, $none or nil, number, increment, set, set of pairs
1603 (cond ((member val '($none nil)) ; nil is maintained for back-portability
1604 (setf (gethash opt *gr-options*) nil))
1605 ((member val '($auto t)) ; t is maintained for back-portability
1606 (setf (gethash opt *gr-options*) "autofreq"))
1607 ((and (numberp (setf val ($float val))) ; increment
1608 (> val 0 ))
1609 (setf (gethash opt *gr-options*) val))
1610 ((and ($listp val) ; [ini,incr,end]
1611 (= ($length val) 3)
1612 (< (cadr val) (cadddr val))
1613 (> (caddr val) 0)
1614 (< (caddr val) (- (cadddr val) (cadr val))) )
1615 (setf (gethash opt *gr-options*)
1616 (format nil "~a,~a,~a" (cadr val) (caddr val) (cadddr val))))
1617 ((and ($setp val)
1618 (every #'(lambda (z) (numberp z))
1619 (cdr val)) ) ; {n1,n2,n3,...}
1620 (setf
1621 (gethash opt *gr-options*)
1622 (do ((k (cdr val) (cdr k))
1623 (str "" (concatenate 'string str (format nil "~a," (car k)))) )
1624 ((null k) (concatenate
1625 'string
1627 (string-right-trim "," str)
1628 ")")))))
1629 ((and ($setp val)
1630 (every #'(lambda (z) (and ($listp z)
1631 (= ($length z) 2)
1632 (numberp (caddr z)) ))
1633 (cdr val)) ) ; {[lab1,n1],[lab2,n2],...}
1634 (setf
1635 (gethash opt *gr-options*)
1636 (do ((k (cdr val) (cdr k))
1637 (str "" (concatenate
1638 'string
1640 (format nil "'~a' ~a," (cadar k) (caddar k)))))
1641 ((null k) (concatenate
1642 'string
1644 (string-right-trim "," str)
1645 ")")))))
1647 (merror "draw: illegal tics allocation: ~M" val)) ))
1648 ($terminal
1649 (update-terminal val))
1650 ($key_pos
1651 (update-key_pos val))
1652 ($zlabel_rotate
1653 (if (member val '(t nil $auto))
1654 (setf (gethash opt *gr-options*) val)
1655 (merror "draw: illegal zlabel_rotate option: ~M" val)))
1656 ($head_type ; defined as $filled, $empty and $nofilled
1657 (if (member val '($filled $empty $nofilled))
1658 (setf (gethash opt *gr-options*) val)
1659 (merror "draw: illegal head type for vectors: ~M" val)))
1660 ($contour ; defined as $none, $base, $surface, $both and $map
1661 (if (member val '($none $base $surface $both $map))
1662 (setf (gethash opt *gr-options*) val)
1663 (merror "draw: illegal contour allocation: ~M" val)))
1664 ($proportional_axes ; defined as $none, $xy and $xyz
1665 (if (member val '($none $xy $xyz))
1666 (setf (gethash opt *gr-options*) val)
1667 (merror "draw: illegal proportional_axes specification")))
1668 ($error_type ; defined as $x, $y and $xy
1669 (if (member val '($x $y $xy $boxes))
1670 (setf (gethash opt *gr-options*) val)
1671 (merror "draw: illegal error_type specification")))
1672 ($label_alignment ; defined as $center, $left and $right
1673 (if (member val '($center $left $right))
1674 (setf (gethash opt *gr-options*) val)
1675 (merror "draw: illegal label alignment: ~M" val)))
1676 ($label_orientation ; defined as $horizontal and $vertical
1677 (if (member val '($horizontal $vertical))
1678 (setf (gethash opt *gr-options*) val)
1679 (merror "draw: illegal label orientation: ~M" val)))
1680 (($key $file_name $xy_file $title $xlabel $ylabel $zlabel $xlabel_secondary $ylabel_secondary
1681 $font $gnuplot_file_name $data_file_name)
1682 (update-string opt val))
1683 ($user_preamble ; defined as a string or a Maxima list of strings
1684 (let ((str ""))
1685 (cond
1686 (($atom val)
1687 (setf str val))
1688 (($listp val)
1689 (dolist (st (rest val))
1690 (if (not ($atom st))
1691 (merror "draw: user preamble ~M should be a string" st))
1692 (setf str (concatenate 'string
1694 (format nil (if (string= str "") "~a" "~%~a") st)))))
1695 (t (merror "draw: illegal user preamble especification")))
1696 (setf (gethash opt *gr-options*) str)) )
1697 (($xrange $yrange $xrange_secondary $yrange_secondary
1698 $zrange $cbrange) ; defined as a Maxima list with two numbers in increasing order
1699 (cond ((member val '($auto nil)) ; nil is maintained for back-portability
1700 (setf (gethash opt *gr-options*) nil))
1701 ((or (not ($listp val))
1702 (/= ($length val) 2))
1703 (merror "draw: illegal range: ~M " val))
1705 (let ((fval1 ($float (cadr val)))
1706 (fval2 ($float (caddr val))))
1707 (cond
1708 ((or (not (floatp fval1))
1709 (not (floatp fval2))
1710 (< fval2 fval1))
1711 (merror "draw: illegal values in range specification"))
1712 ((= ($length val) 2) ; it's a trick: length 2 => user change
1713 (setf (gethash opt *gr-options*) (list fval1 fval2)))
1714 (t ; should be length 3 or nil option => automatic computation of ranks
1715 (setf (gethash opt *gr-options*) (list fval1 fval2 0)) )) ))) )
1716 (($grid) ; defined as a Maxima list with two numbers.
1717 ; 0 0 means "off",
1718 ; >0 >0 means "on with n grid lines per tick",
1719 (cond ((null val)
1720 (setf (gethash opt *gr-options*) (list 0 0)))
1721 ((eq val t)
1722 (setf (gethash opt *gr-options*) (list 1 1)))
1723 ((or (not ($listp val))
1724 (/= ($length val) 2))
1725 (merror "draw: illegal grid lines specification: ~M " val))
1727 (let ((fval1 ($float (cadr val)))
1728 (fval2 ($float (caddr val))))
1729 (cond
1730 ((or (not (floatp fval1))
1731 (not (floatp fval2))
1732 (< fval1 1)
1733 (< fval2 1))
1734 (merror "grid: illegal grid lines specification"))
1736 (setf (gethash opt *gr-options*) (list ($round fval1) ($round fval2))) )
1737 ) ))) )
1738 (($ip_grid $ip_grid_in)
1739 (if (not ($listp val))
1740 (merror "draw: illegal value for grid")
1741 (if (not (and (integerp ($first val))
1742 (integerp ($second val))))
1743 (merror "draw: illegal value for grid")
1744 (setf (gethash opt *gr-options*) val))))
1745 ($palette
1746 (update-palette val))
1747 (($color $fill_color $xaxis_color $yaxis_color
1748 $zaxis_color $background_color)
1749 (update-color opt val))
1750 ($view
1751 (update-view val))
1752 ($interpolate_color
1753 (update-interpolate_color val))
1756 ; DEPRECATED OPTIONS
1757 ($tube_extremes
1758 ($print "Warning: 'tube_extremes' is deprecated, using 'capping' instead...")
1759 (update-capping (substitute nil '$open (substitute t '$closed val))))
1760 ($file_bgcolor
1761 ($print "Warning: 'file_bgcolor' is deprecated, using 'background_color' instead...")
1762 (update-color '$background_color val))
1763 ($rot_vertical
1764 ($print "Warning: 'rot_vertical' is deprecated, using 'view' instead...")
1765 (update-view (list '(mlist) val (second (gethash '$view *gr-options*)))))
1766 ($rot_horizontal
1767 ($print "Warning: 'rot_horizontal' is deprecated, using 'view' instead...")
1768 (update-view (list '(mlist) (first (gethash '$view *gr-options*)) val)))
1769 ($pic_width
1770 ($print "Warning: 'pic_width' is deprecated, using 'dimensions' instead...")
1771 (update-dimensions (list '(mlist) val (second (gethash '$dimensions *gr-options*)))))
1772 ($pic_height
1773 ($print "Warning: 'pic_height' is deprecated, using 'dimensions' instead...")
1774 (update-dimensions (list '(mlist) (first (gethash '$dimensions *gr-options*)) val)))
1775 (($eps_width $pdf_width)
1776 ($print "Warning: 'eps_width' is deprecated, using 'dimensions' instead...")
1777 (update-dimensions (list '(mlist) (* 100 val) (second (gethash '$dimensions *gr-options*)))))
1778 (($eps_height $pdf_height)
1779 ($print "Warning: 'eps_height' is deprecated, using 'dimensions' instead...")
1780 (update-dimensions (list '(mlist) (first (gethash '$dimensions *gr-options*)) (* 100 val))))
1782 (otherwise (merror "draw: unknown option ~M " opt)) ) )
1791 ;;; OTHER COMMON GNUPLOT - VTK AUXILIARY FUNCTIONS
1794 (defun near-equal (a b)
1795 (let ((eps 10.0d-14))
1796 (< (abs (- a b)) eps)))
1798 ;; Transforms arguments to make-scene-2d, make-scene-3d,
1799 ;; draw, and vtk3d to a unique list. With this piece of code,
1800 ;; gr2d, gr3d, draw, and model3d admit as arguments nested lists
1801 ;; of options and graphic objects
1802 (defmacro listify-arguments (args)
1803 `(rest ($flatten
1804 ($tree_reduce
1805 '$append
1806 (cons '(mlist)
1807 (map
1808 'list #'(lambda (z) (if ($listp z) z (list '(mlist) z)))
1809 ,args))))))
1811 ;; The following functions implement the marching cubes algorithm
1812 ;; for implicit functions in 3d.
1813 (defvar *i3d_triangles*
1814 '#(#(-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1815 #(0 8 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1816 #(0 1 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1817 #(1 8 3 9 8 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1818 #(1 2 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1819 #(0 8 3 1 2 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1820 #(9 2 10 0 2 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1821 #(2 8 3 2 10 8 10 9 8 -1 -1 -1 -1 -1 -1 -1)
1822 #(3 11 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1823 #(0 11 2 8 11 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1824 #(1 9 0 2 3 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
1825 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)
2058 #(1 2 11 1 11 9 9 11 8 -1 -1 -1 -1 -1 -1 -1)
2059 #(3 0 9 3 9 11 1 2 9 2 11 9 -1 -1 -1 -1)
2060 #(0 2 11 8 0 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2061 #(3 2 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2062 #(2 3 8 2 8 10 10 8 9 -1 -1 -1 -1 -1 -1 -1)
2063 #(9 10 2 0 9 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2064 #(2 3 8 2 8 10 0 1 8 1 10 8 -1 -1 -1 -1)
2065 #(1 10 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2066 #(1 3 8 9 1 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2067 #(0 9 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2068 #(0 3 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)
2069 #(-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)) )
2071 ; Copies multidimensional arrays.
2072 (defun copy-array (array)
2073 (let ((dims (array-dimensions array)))
2074 (adjust-array
2075 (make-array
2076 dims
2077 :element-type (array-element-type array)
2078 :displaced-to array)
2079 dims)))
2081 ; Calculates surface-edge intersection by interpolation
2082 (defun edge-interpolation (x1 y1 z1 x2 y2 z2 v1 v2)
2083 (cond ((or (< (abs v1) 0.00001)
2084 (< (abs (- v1 v2)) 0.00001))
2085 (list x1 y1 z1))
2086 ((< (abs v2) 0.00001)
2087 (list x2 y2 z2))
2089 (let ((m (/ (- v1) (- v2 v1))))
2090 (list
2091 (+ x1 (* m (- x2 x1)))
2092 (+ y1 (* m (- y2 y1)))
2093 (+ z1 (* m (- z2 z1))))))))
2095 (defmacro make-triangle-vertices (i1 j1 k1 i2 j2 k2 e1 e2)
2096 `(edge-interpolation
2097 (aref px ,i1) (aref py ,j1) (aref pz ,k1)
2098 (aref px ,i2) (aref py ,j2) (aref pz ,k2)
2099 (aref val ,e1) (aref val ,e2)))
2101 (defun flatten (lis)
2102 (cond ((atom lis) lis)
2103 ((listp (car lis))
2104 (append (flatten (car lis)) (flatten (cdr lis))))
2106 (append (list (car lis)) (flatten (cdr lis))))))
2108 (defun find-triangles (expr par1 xmin xmax par2 ymin ymax par3 zmin zmax)
2109 (let* ((nx (get-option '$x_voxel))
2110 (ny (get-option '$y_voxel))
2111 (nz (get-option '$z_voxel))
2112 (dx (/ (- xmax xmin) nx))
2113 (dy (/ (- ymax ymin) ny))
2114 (dz (/ (- zmax zmin) nz))
2115 (fcn (coerce-float-fun (m- ($lhs expr) ($rhs expr)) `((mlist) ,par1 ,par2 ,par3)))
2116 (vert '())
2117 (px (make-array (+ nx 1) :element-type 'flonum))
2118 (py (make-array (+ ny 1) :element-type 'flonum))
2119 (pz (make-array (+ nz 1) :element-type 'flonum))
2120 (oldval (make-array `(,(+ nx 1) ,(+ ny 1)) :element-type 'flonum))
2121 (newval (make-array `(,(+ nx 1) ,(+ ny 1)) :element-type 'flonum)) )
2122 ; initialize coordinate arrays
2123 (loop for i to nx do (setf (aref px i) (+ xmin (* i dx))))
2124 (loop for j to ny do (setf (aref py j) (+ ymin (* j dy))))
2125 (loop for k to nz do (setf (aref pz k) (+ zmin (* k dz))))
2127 ; initialize first layer
2128 (loop for i to nx do
2129 (loop for j to ny do
2130 (let ((fxy (funcall fcn (aref px i) (aref py j) (aref pz 0))))
2131 (if (floatp fxy)
2132 (setf (aref oldval i j) fxy)
2133 (merror "draw3d (implicit): non real value")))))
2135 ; begin triangularization process
2136 (loop for k from 1 to nz do
2138 ; calculate node values in new layer
2139 (loop for i to nx do
2140 (loop for j to ny do
2141 (let ((fxy (funcall fcn (aref px i) (aref py j) (aref pz k))))
2142 (if (floatp fxy)
2143 (setf (aref newval i j) fxy)
2144 (merror "draw3d (implicit): check surface definition; non real value")))))
2146 ; analyze voxels in this slide
2147 (loop for i below nx do
2148 (loop for j below ny do
2149 (let* (triangles
2150 (cubidx 0)
2151 (k-1 (- k 1))
2152 (i+1 (+ i 1))
2153 (j+1 (+ j 1))
2154 (val (make-array 8 :element-type 'flonum
2155 :initial-contents
2156 `(,(aref oldval i j+1) ,(aref oldval i+1 j+1)
2157 ,(aref oldval i+1 j) ,(aref oldval i j)
2158 ,(aref newval i j+1) ,(aref newval i+1 j+1)
2159 ,(aref newval i+1 j) ,(aref newval i j)))))
2160 (when (<= (aref val 0) 0.0) (setf cubidx (logior cubidx 1)))
2161 (when (<= (aref val 1) 0.0) (setf cubidx (logior cubidx 2)))
2162 (when (<= (aref val 2) 0.0) (setf cubidx (logior cubidx 4)))
2163 (when (<= (aref val 3) 0.0) (setf cubidx (logior cubidx 8)))
2164 (when (<= (aref val 4) 0.0) (setf cubidx (logior cubidx 16)))
2165 (when (<= (aref val 5) 0.0) (setf cubidx (logior cubidx 32)))
2166 (when (<= (aref val 6) 0.0) (setf cubidx (logior cubidx 64)))
2167 (when (<= (aref val 7) 0.0) (setf cubidx (logior cubidx 128)))
2168 (setf triangles (aref *i3d_triangles* cubidx)) ; edges intersecting the surface
2169 (do ((e 0 (1+ e)))
2170 ((= (aref triangles e) -1) 'done)
2171 (push
2172 (case (aref triangles e)
2173 (0 (make-triangle-vertices i j+1 k-1 i+1 j+1 k-1 0 1))
2174 (1 (make-triangle-vertices i+1 j+1 k-1 i+1 j k-1 1 2))
2175 (2 (make-triangle-vertices i+1 j k-1 i j k-1 2 3))
2176 (3 (make-triangle-vertices i j k-1 i j+1 k-1 3 0))
2177 (4 (make-triangle-vertices i j+1 k i+1 j+1 k 4 5))
2178 (5 (make-triangle-vertices i+1 j+1 k i+1 j k 5 6))
2179 (6 (make-triangle-vertices i+1 j k i j k 6 7))
2180 (7 (make-triangle-vertices i j k i j+1 k 7 4))
2181 (8 (make-triangle-vertices i j+1 k-1 i j+1 k 0 4))
2182 (9 (make-triangle-vertices i+1 j+1 k-1 i+1 j+1 k 1 5))
2183 (10 (make-triangle-vertices i+1 j k-1 i+1 j k 2 6))
2184 (11 (make-triangle-vertices i j k-1 i j k 3 7)) )
2185 vert)))))
2186 ; make oldval a copy of newval
2187 (setf oldval (copy-array newval)))
2188 vert))
2195 ;; This is the function to be called at Maxima level.
2196 ;; Some examples:
2197 ;; draw(gr2d(opt & obj))$ => a 2d plot, equivalent to draw2d(opt & obj)
2198 ;; draw(gr3d(opt & obj))$ => a 2d plot, equivalent to draw3d(opt & obj)
2199 ;; draw(gr2d(opt & obj),gr2d(opt & obj),gr3d(opt & obj),gr2d(opt & obj))$
2200 ;; => four plots in one column, one of them is a 3d plot
2201 ;; draw(terminal=png,columns=2,gr2d(opt & obj),gr3d(opt & obj))
2202 ;; => png file with two plots (2d and 3d) side by side
2203 ;; See bellow for $draw2d and $draw3d
2204 (defun $draw (&rest args)
2205 (cond ((member $draw_renderer '($gnuplot $gnuplot_pipes))
2206 (apply 'draw_gnuplot args))
2207 ((member $draw_renderer '($vtk $vtk6 $vtk7))
2208 (apply 'draw_vtk args))
2210 (merror "draw: unknown renderer ~M" $draw_renderer))))
2212 ;; Equivalent to draw2d(opt & obj)
2213 (defun $draw2d (&rest args)
2214 ($draw (cons '($gr2d) args)) )
2216 ;; Equivalent to draw3d(opt & obj)
2217 (defun $draw3d (&rest args)
2218 (cond ((member $draw_renderer '($gnuplot $gnuplot_pipes))
2219 (draw_gnuplot (cons '($gr3d) args)))
2220 ((member $draw_renderer '($vtk $vtk6 $vtk7))
2221 (draw_vtk (cons '($gr3d) args)))
2223 (merror "draw: unknown renderer ~M" $draw_renderer))))