From 7fe982a7bbb1c1fb444b0543ed11a830a892d12d Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Wed, 31 Dec 2025 17:57:04 -0500 Subject: [PATCH 01/20] Handle list of exprs --- mathics/core/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mathics/core/util.py b/mathics/core/util.py index ed9fd3628..4cf650b69 100644 --- a/mathics/core/util.py +++ b/mathics/core/util.py @@ -134,7 +134,10 @@ def print_expression_tree( if file is None: file = sys.stdout - if isinstance(expr, Symbol): + if isinstance(expr, (tuple, list)): + for e in expr: + print_expression_tree(e, indent, marker, file, approximate) + elif isinstance(expr, Symbol): print(f"{indent}{marker(expr)}{expr}", file=file) elif not hasattr(expr, "elements"): if isinstance(expr, MachineReal) and approximate: From 8df6e64d5aa6c227254011c071768672aec5e1d0 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Wed, 31 Dec 2025 17:57:47 -0500 Subject: [PATCH 02/20] Allow CLI to specify yaml file on command line Helpful during development --- test/builtin/drawing/test_plot_detail.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/builtin/drawing/test_plot_detail.py b/test/builtin/drawing/test_plot_detail.py index a469798db..6701a578f 100644 --- a/test/builtin/drawing/test_plot_detail.py +++ b/test/builtin/drawing/test_plot_detail.py @@ -349,8 +349,8 @@ def yaml_tests_generator(fn: str): ] -def all_yaml_tests_generator(): - for fn in YAML_TESTS: +def all_yaml_tests_generator(fns=None): + for fn in fns or YAML_TESTS: yield from yaml_tests_generator(fn) @@ -370,14 +370,14 @@ def test_yaml(parms): one_test(**parms) -def do_test_all(): +def do_test_all(fns): # several of these tests failed on pyodide due to apparent differences # in numpy (and/or the blas library backing it) between pyodide and other platforms # including numerical instability, different data types (integer vs real) # the tests above seem so far to be ok on pyodide, but generally they are # simpler than these doc_tests if not pyodide: - for parms in all_yaml_tests_generator(): + for parms in all_yaml_tests_generator(fns): one_test(**parms) @@ -386,11 +386,12 @@ def do_test_all(): parser = argparse.ArgumentParser(description="manage plot tests") parser.add_argument("--update", action="store_true", help="update reference files") + parser.add_argument("files", nargs="*", help="yaml test files") args = parser.parse_args() UPDATE_MODE = args.update try: - do_test_all() + do_test_all(args.files) except AssertionError as oops: print(oops) print("FAIL") From 27cee4b369114822e03eb0eb6f6743a693f9e633 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Wed, 31 Dec 2025 17:58:53 -0500 Subject: [PATCH 03/20] Initial ParametricPlot3D --- mathics/builtin/drawing/plot.py | 14 ++++- mathics/builtin/drawing/plot_plot.py | 4 +- mathics/builtin/drawing/plot_plot3d.py | 53 +++++++++++++----- mathics/eval/drawing/plot3d.py | 7 +++ mathics/eval/drawing/plot3d_vectorized.py | 67 ++++++++++++++++------- 5 files changed, 108 insertions(+), 37 deletions(-) diff --git a/mathics/builtin/drawing/plot.py b/mathics/builtin/drawing/plot.py index a44ca3e05..5318d0949 100644 --- a/mathics/builtin/drawing/plot.py +++ b/mathics/builtin/drawing/plot.py @@ -22,7 +22,7 @@ from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression -from mathics.core.symbols import Symbol +from mathics.core.symbols import Symbol, SymbolList from mathics.core.systemsymbols import ( SymbolAll, SymbolAutomatic, @@ -413,11 +413,21 @@ class PlotOptions: plot_points: list maxdepth: int - def __init__(self, builtin, range_exprs, options, dim, evaluation): + def __init__(self, builtin, functions, range_exprs, options, dim, evaluation): def error(*args, **kwargs): evaluation.message(builtin.get_name(), *args, **kwargs) raise ValueError() + # convert functions to list of lists of exprs + def to_list(expr): + if isinstance(expr, Expression) and expr.head is SymbolList: + return [to_list(e) for e in expr.elements] + else: + return expr + + functions = to_list(functions) + self.functions = functions if isinstance(functions, list) else [functions] + # plot ranges of the form {x,xmin,xmax} etc. (returns Symbol) self.ranges = [] for range_expr in range_exprs: diff --git a/mathics/builtin/drawing/plot_plot.py b/mathics/builtin/drawing/plot_plot.py index 0ee93d302..cf97853a3 100644 --- a/mathics/builtin/drawing/plot_plot.py +++ b/mathics/builtin/drawing/plot_plot.py @@ -74,7 +74,9 @@ def eval(self, functions, ranges, evaluation: Evaluation, options: dict): # parse options, bailing out if anything is wrong try: ranges = ranges.elements if ranges.head is SymbolSequence else [ranges] - plot_options = plot.PlotOptions(self, ranges, options, 2, evaluation) + plot_options = plot.PlotOptions( + self, functions, ranges, options, 2, evaluation + ) except ValueError: return None diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index ac4f17f65..6749ce833 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -101,22 +101,21 @@ def eval( try: dim = 3 if self.graphics_class is Graphics3D else 2 ranges = ranges.elements if ranges.head is SymbolSequence else [ranges] - plot_options = plot.PlotOptions(self, ranges, options, dim, evaluation) + plot_options = plot.PlotOptions( + self, functions, ranges, options, dim, evaluation + ) except ValueError: return None - # TODO: consult many_functions variable set by subclass and error - # if many_functions is False but multiple are supplied - if functions.has_form("List", None): - plot_options.functions = functions.elements - else: - plot_options.functions = [functions] - # supply default value if plot_options.plot_points is None: default_plot_points = (200, 200) if plot.use_vectorized_plot else (7, 7) plot_options.plot_points = default_plot_points + # supply apply_function which knows how to take the plot parameters + # and produce xs, ys, and zs + plot_options.apply_function = self.apply_function + # subclass must set eval_function and graphics_class eval_function = plot.get_plot_eval_function(self.__class__) with np.errstate(all="ignore"): # suppress numpy warnings @@ -127,11 +126,14 @@ def eval( # now we have a list of length dim # handle Automatic ~ {xmin,xmax} etc. # TODO: dowstream consumers might be happier if we used data range where applicable - for i, (pr, r) in enumerate(zip(plot_options.plot_range, plot_options.ranges)): - # TODO: this treats Automatic and Full as the same, which isn't quite right - if isinstance(pr, (str, Symbol)) and not isinstance(r[1], complex): - # extract {xmin,xmax} from {x,xmin,xmax} - plot_options.plot_range[i] = r[1:] + if not isinstance(self, ParametricPlot3D): + for i, (pr, r) in enumerate( + zip(plot_options.plot_range, plot_options.ranges) + ): + # TODO: this treats Automatic and Full as the same, which isn't quite right + if isinstance(pr, (str, Symbol)) and not isinstance(r[1], complex): + # extract {xmin,xmax} from {x,xmin,xmax} + plot_options.plot_range[i] = r[1:] # unpythonize and update PlotRange option options[str(SymbolPlotRange)] = to_mathics_list(*plot_options.plot_range) @@ -142,6 +144,10 @@ def eval( ) return graphics_expr + def apply_function(self, function, names, us, vs): + parms = {str(names[0]): us, str(names[1]): vs} + return us, vs, function(**parms) + class ComplexPlot3D(_Plot3D): """ @@ -165,6 +171,10 @@ class ComplexPlot3D(_Plot3D): many_functions = True graphics_class = Graphics3D + def apply_function(self, function, names, us, vs): + parms = {str(names[0]): us + vs * 1j} + return us, vs, function(**parms) + class ComplexPlot(_Plot3D): """ @@ -188,6 +198,10 @@ class ComplexPlot(_Plot3D): many_functions = False graphics_class = Graphics + def apply_function(self, function, names, us, vs): + parms = {str(names[0]): us + vs * 1j} + return us, vs, function(**parms) + class ContourPlot(_Plot3D): """ @@ -246,6 +260,19 @@ class DensityPlot(_Plot3D): graphics_class = Graphics +class ParametricPlot3D(_Plot3D): + summary_text = "plot a parametric surface" + expected_args = 3 + options = _Plot3D.options3d + + many_functions = True + graphics_class = Graphics3D + + def apply_function(self, functions, names, us, vs): + parms = {str(names[0]): us, str(names[1]): vs} + return [f(**parms) for f in functions] + + class Plot3D(_Plot3D): """ :WMA link: https://reference.wolfram.com/language/ref/Plot3D.html diff --git a/mathics/eval/drawing/plot3d.py b/mathics/eval/drawing/plot3d.py index 512460881..62b616a2e 100644 --- a/mathics/eval/drawing/plot3d.py +++ b/mathics/eval/drawing/plot3d.py @@ -513,3 +513,10 @@ def eval_ContourPlot( evaluation: Evaluation, ): return None + + +def eval_ParametricPlot3D( + plot_options, + evaluation: Evaluation, +): + return None diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index 34b50ab1d..2a0e14bc0 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -4,6 +4,7 @@ """ import math +from typing import Sequence import numpy as np @@ -29,13 +30,13 @@ def make_plot(plot_options, evaluation: Evaluation, dim: int, is_complex: bool, # pull out plot options if not is_complex: - _, xmin, xmax = plot_options.ranges[0] - _, ymin, ymax = plot_options.ranges[1] + _, umin, umax = plot_options.ranges[0] + _, vmin, vmax = plot_options.ranges[1] else: # will generate xs and ys as for real, then combine to form complex cs _, cmin, cmax = plot_options.ranges[0] - xmin, xmax = cmin.real, cmax.real - ymin, ymax = cmin.imag, cmax.imag + umin, umax = cmin.real, cmax.real + vmin, vmax = cmin.imag, cmax.imag names = [strip_context(str(range[0])) for range in plot_options.ranges] # Mesh option @@ -44,13 +45,16 @@ def make_plot(plot_options, evaluation: Evaluation, dim: int, is_complex: bool, nmesh = 0 # compile the functions + def compile_exprs(expr_or_list: Sequence | Expression) -> Sequence: + if isinstance(expr_or_list, (list, tuple)): + return [compile_exprs(e) for e in expr_or_list] + else: + return lambdify_compile(evaluation, expr_or_list, names) + with Timer("compile"): - compiled_functions = [ - lambdify_compile(evaluation, function, names) - for function in plot_options.functions - ] + compiled_functions = compile_exprs(plot_options.functions) - def compute_over_grid(nx, ny): + def compute_over_grid(nu, nv): """ For each function, computes an (nx*ny, 3) array of coordinates (xyzs), and an (nx, ny) array of indices (inxs) into xyzs representing @@ -62,24 +66,21 @@ def compute_over_grid(nx, ny): grid used to display a mesh of lines on the surface. """ - # compute (nx, ny) grids of xs and ys for corresponding vertexes - xs = np.linspace(xmin, xmax, nx) - ys = np.linspace(ymin, ymax, ny) - xs, ys = np.meshgrid(xs, ys) + # compute (nu, nv) grids of us and vs for corresponding vertexes + us = np.linspace(umin, umax, nu) + vs = np.linspace(vmin, vmax, nv) + us, vs = np.meshgrid(us, vs) - # (nx,ny) array of numbers from 0 to n-1 that are + # (nu,nv) array of numbers from 0 to n-1 that are # indexes into xyzs array for corresponding vertex # +1 because these will be used as WL indexes, which are 1-based - inxs = np.arange(math.prod(xs.shape)).reshape(xs.shape) + 1 + inxs = np.arange(math.prod(us.shape)).reshape(us.shape) + 1 for function in compiled_functions: # compute zs from xs and ys using compiled function - with Timer("compute zs"): - if not is_complex: - zs = function(**{str(names[0]): xs, str(names[1]): ys}) - else: - cs = xs + ys * 1j # TODO: fast enough? - zs = function(**{str(names[0]): cs}) + with Timer("compute xs, ys, zs"): + # xs, ys, zs = function(**{str(names[0]): us, str(names[1]): vs}) + xs, ys, zs = plot_options.apply_function(function, names, us, vs) # sometimes expr gets compiled into something that returns a complex # even though the imaginary part is 0 @@ -87,6 +88,8 @@ def compute_over_grid(nx, ny): # TODO: needed this for Hypergeometric - look into that # assert np.all(np.isreal(zs)), "array contains complex values" if not is_complex: + xs = np.real(xs) + ys = np.real(ys) zs = np.real(zs) # if it's a constant, make it a full array @@ -95,6 +98,7 @@ def compute_over_grid(nx, ny): # (nx*ny, 3) array of points, to be indexed by quads xyzs = np.stack([xs, ys, zs]).transpose(1, 2, 0).reshape(-1, 3) + print("xxx xyzs.shape", xyzs.shape) yield xyzs, inxs @@ -307,3 +311,24 @@ def emit(graphics, i, xyzs, quads): graphics.add_complex(xyzs_re, lines=None, polys=quads, colors=rgb) return make_plot(plot_options, evaluation, dim=2, is_complex=True, emit=emit) + + +@Timer("eval_ParametricPlot3D") +def eval_ParametricPlot3D( + plot_options, + evaluation: Evaluation, +): + def emit(graphics, i, xyzs, quads): + # choose a color + color_directive = palette_color_directive(palette3, i) + graphics.add_directives(color_directive) + + # add a GraphicsComplex displaying a surface for this function + graphics.add_complex(xyzs, lines=None, polys=quads) + + # we want a list, each element of which is a list of 2 or 3 functions + # to compute the coordinates of the lines or surface + if not isinstance(plot_options.functions[0], (list, tuple)): + plot_options.functions = [plot_options.functions] + + return make_plot(plot_options, evaluation, dim=3, is_complex=False, emit=emit) From fbaa7d33d751c036bb1acb37794001d046f63822 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Wed, 31 Dec 2025 22:16:51 -0500 Subject: [PATCH 04/20] Small reorg --- mathics/builtin/drawing/plot_plot.py | 9 +++++++-- mathics/eval/drawing/plot3d_vectorized.py | 11 ++--------- mathics/eval/drawing/util.py | 9 +++++++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/mathics/builtin/drawing/plot_plot.py b/mathics/builtin/drawing/plot_plot.py index cf97853a3..4cb462f49 100644 --- a/mathics/builtin/drawing/plot_plot.py +++ b/mathics/builtin/drawing/plot_plot.py @@ -86,10 +86,15 @@ def eval(self, functions, ranges, evaluation: Evaluation, options: dict): apply_function = self.apply_function if not plot.use_vectorized_plot: apply_function = lru_cache(apply_function) + plot_options.apply_function = apply_function - # additional options specific to this class + # TODO: PlotOptions has already regularized .functions to be a list + # (of lists) of functions, used by the _Plot3d builtins. + # But _Plot builtins still need to be reworked to use it, + # so we still use the old mechanism here. plot_options.functions = self.get_functions_param(functions) - plot_options.apply_function = apply_function + + # additional options specific to this class plot_options.use_log_scale = self.use_log_scale plot_options.expect_list = self.expect_list if plot_options.plot_points is None: diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index 2a0e14bc0..9c27f8acc 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -9,7 +9,6 @@ import numpy as np from mathics.builtin.colors.color_internals import convert_color -from mathics.core.convert.lambdify import lambdify_compile from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.symbols import strip_context @@ -22,7 +21,7 @@ from mathics.timing import Timer from .colors import palette2, palette3, palette_color_directive -from .util import GraphicsGenerator +from .util import GraphicsGenerator, compile_exprs def make_plot(plot_options, evaluation: Evaluation, dim: int, is_complex: bool, emit): @@ -45,14 +44,8 @@ def make_plot(plot_options, evaluation: Evaluation, dim: int, is_complex: bool, nmesh = 0 # compile the functions - def compile_exprs(expr_or_list: Sequence | Expression) -> Sequence: - if isinstance(expr_or_list, (list, tuple)): - return [compile_exprs(e) for e in expr_or_list] - else: - return lambdify_compile(evaluation, expr_or_list, names) - with Timer("compile"): - compiled_functions = compile_exprs(plot_options.functions) + compiled_functions = compile_exprs(evaluation, plot_options.functions, names) def compute_over_grid(nu, nv): """ diff --git a/mathics/eval/drawing/util.py b/mathics/eval/drawing/util.py index d6e5c8ec4..4929843aa 100644 --- a/mathics/eval/drawing/util.py +++ b/mathics/eval/drawing/util.py @@ -5,6 +5,7 @@ from mathics.core.atoms import NumericArray from mathics.core.convert.expression import to_expression, to_mathics_list +from mathics.core.convert.lambdify import lambdify_compile from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol @@ -102,3 +103,11 @@ def generate(self, options): ) return graphics_expr + + +def compile_exprs(evaluation, expr_or_list, names): + """Traverse a nested list structure and compile the functions at the leaves""" + if isinstance(expr_or_list, (list, tuple)): + return [compile_exprs(evaluation, e, names) for e in expr_or_list] + else: + return lambdify_compile(evaluation, expr_or_list, names) From b18dc6802f3fcb7dd47c4d7fe90db47117179e11 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 00:32:44 -0500 Subject: [PATCH 05/20] ParametricPlot with one independent variable making a curve --- mathics/builtin/drawing/plot_plot3d.py | 12 ++- mathics/core/systemsymbols.py | 1 + mathics/eval/drawing/plot3d_vectorized.py | 95 ++++++++++++++++++----- 3 files changed, 86 insertions(+), 22 deletions(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index 6749ce833..69ba58a48 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -109,7 +109,13 @@ def eval( # supply default value if plot_options.plot_points is None: - default_plot_points = (200, 200) if plot.use_vectorized_plot else (7, 7) + if isinstance(self, ParametricPlot3D) and len(plot_options.ranges) == 1: + # ParametricPlot3D with one independent variable generating a curve + default_plot_points = (1000,) + elif plot.use_vectorized_plot: + default_plot_points = (200, 200) + else: + default_plot_points = (7, 7) plot_options.plot_points = default_plot_points # supply apply_function which knows how to take the plot parameters @@ -268,8 +274,8 @@ class ParametricPlot3D(_Plot3D): many_functions = True graphics_class = Graphics3D - def apply_function(self, functions, names, us, vs): - parms = {str(names[0]): us, str(names[1]): vs} + def apply_function(self, functions, names, *parms): + parms = {str(n): p for n, p in zip(names, parms)} return [f(**parms) for f in functions] diff --git a/mathics/core/systemsymbols.py b/mathics/core/systemsymbols.py index 258ec92ef..deafd0d95 100644 --- a/mathics/core/systemsymbols.py +++ b/mathics/core/systemsymbols.py @@ -26,6 +26,7 @@ SymbolAborted = Symbol("System`$Aborted") SymbolAbs = Symbol("System`Abs") SymbolAbsoluteTime = Symbol("AbsoluteTime") +SymbolAbsoluteThickness = Symbol("System`AbsoluteThickness") SymbolAccuracy = Symbol("System`Accuracy") SymbolAlignmentPoint = Symbol("System`AlignmentPoint") SymbolAll = Symbol("System`All") diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index 9c27f8acc..414650698 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -13,18 +13,23 @@ from mathics.core.expression import Expression from mathics.core.symbols import strip_context from mathics.core.systemsymbols import ( + Symbol, + SymbolAbsoluteThickness, SymbolEqual, SymbolNone, SymbolRGBColor, SymbolSubtract, ) +from mathics.core.util import print_expression_tree # noqa from mathics.timing import Timer from .colors import palette2, palette3, palette_color_directive from .util import GraphicsGenerator, compile_exprs -def make_plot(plot_options, evaluation: Evaluation, dim: int, is_complex: bool, emit): +def make_surfaces( + plot_options, evaluation: Evaluation, dim: int, is_complex: bool, emit +): graphics = GraphicsGenerator(dim) # pull out plot options @@ -59,6 +64,9 @@ def compute_over_grid(nu, nv): grid used to display a mesh of lines on the surface. """ + # Note on naming: we use u,v to refer to the independent variable initially. + # For Plot3D etc. those will be x and y, but for ParametricPlot3D and + # and for SpericalPlot3D the xs, ys, and zs will all be computed. # compute (nu, nv) grids of us and vs for corresponding vertexes us = np.linspace(umin, umax, nu) vs = np.linspace(vmin, vmax, nv) @@ -89,10 +97,8 @@ def compute_over_grid(nu, nv): if isinstance(zs, (float, int, complex)): zs = np.full(xs.shape, zs) - # (nx*ny, 3) array of points, to be indexed by quads + # (nu*nv, 3) array of points, to be indexed by quads xyzs = np.stack([xs, ys, zs]).transpose(1, 2, 0).reshape(-1, 3) - print("xxx xyzs.shape", xyzs.shape) - yield xyzs, inxs # generate the quads and emit a GraphicsComplex containing them @@ -105,7 +111,7 @@ def compute_over_grid(nu, nv): quads = quads.T.reshape(-1, 4) # pass the xyzs and quads back to the caller to add colors and emit quads as appropriate - emit(graphics, i, xyzs, quads) + emit(graphics, i, xyzs, None, quads) # If requested by the Mesh attribute create a mesh of lines covering the surfaces # For now only for Plot3D @@ -128,6 +134,46 @@ def compute_over_grid(nu, nv): return graphics +# For ParametricPlot3D with just one independent variable we generate a curve +# TODO: consider whether we can DRY this with similar code in ParmetricPlot +def make_curvess(plot_options, evaluation: Evaluation, dim: int, emit): + graphics = GraphicsGenerator(dim) + + # pull out plot options + _, tmin, tmax = plot_options.ranges[0] + nt = plot_options.plot_points[0] + + # compile + print_expression_tree(plot_options.functions) + names = [strip_context(str(range[0])) for range in plot_options.ranges] + with Timer("compile"): + compiled_functions = compile_exprs(evaluation, plot_options.functions, names) + + # sample points and indexes for making line + ts = np.linspace(tmin, tmax, nt) + line = np.arange(nt) + 1 + + # compute curve for each function + for i, function in enumerate(compiled_functions): + # compute xs, ys, zs from ts + with Timer("compute xs, ys, zs"): + xs, ys, zs = plot_options.apply_function(function, names, ts) + + # if it's a constant, make it a full array + def full_array(a): + return np.full(ts.shape, a) if isinstance(a, (float, int, complex)) else a + + xs = full_array(xs) + ys = full_array(ys) + zs = full_array(zs) + + # stack 'em + xyzs = np.stack([xs, ys, zs]).T + emit(graphics, i, xyzs, [line], None) + + return graphics + + @Timer("density_colors") def density_colors(zs): """default color palette for DensityPlot and ContourPlot (f(x) form)""" @@ -148,7 +194,7 @@ def eval_Plot3D( plot_options, evaluation: Evaluation, ): - def emit(graphics, i, xyzs, quads): + def emit(graphics, i, xyzs, _, quads): # choose a color color_directive = palette_color_directive(palette3, i) graphics.add_directives(color_directive) @@ -156,7 +202,7 @@ def emit(graphics, i, xyzs, quads): # add a GraphicsComplex displaying a surface for this function graphics.add_complex(xyzs, lines=None, polys=quads) - return make_plot(plot_options, evaluation, dim=3, is_complex=False, emit=emit) + return make_surfaces(plot_options, evaluation, dim=3, is_complex=False, emit=emit) @Timer("eval_DensityPlot") @@ -164,7 +210,7 @@ def eval_DensityPlot( plot_options, evaluation: Evaluation, ): - def emit(graphics, i, xyzs, quads): + def emit(graphics, i, xyzs, _, quads): # Fixed palette for now # TODO: accept color options colors = density_colors(xyzs[:, 2]) @@ -172,7 +218,7 @@ def emit(graphics, i, xyzs, quads): # flatten the points and add the quads graphics.add_complex(xyzs[:, 0:2], lines=None, polys=quads, colors=colors) - return make_plot(plot_options, evaluation, dim=2, is_complex=False, emit=emit) + return make_surfaces(plot_options, evaluation, dim=2, is_complex=False, emit=emit) @Timer("eval_ContourPlot") @@ -195,7 +241,7 @@ def eval_ContourPlot( contour_levels = [0] background = False - def emit(graphics, i, xyzs, quads): + def emit(graphics, i, xyzs, _, quads): # set line color if background: # showing a background, so just black lines @@ -251,7 +297,7 @@ def emit(graphics, i, xyzs, quads): ) # plot_options.plot_points = [n * 10 for n in plot_options.plot_points] - return make_plot(plot_options, evaluation, dim=2, is_complex=False, emit=emit) + return make_surfaces(plot_options, evaluation, dim=2, is_complex=False, emit=emit) @Timer("complex colors") @@ -283,13 +329,13 @@ def eval_ComplexPlot3D( plot_options, evaluation: Evaluation, ): - def emit(graphics, i, xyzs, quads): + def emit(graphics, i, xyzs, _, quads): zs = xyzs[:, 2] rgb = complex_colors(zs, s=0.8) xyzs[:, 2] = abs(zs) graphics.add_complex(xyzs.real, lines=None, polys=quads, colors=rgb) - return make_plot(plot_options, evaluation, dim=3, is_complex=True, emit=emit) + return make_surfaces(plot_options, evaluation, dim=3, is_complex=True, emit=emit) @Timer("eval_ComplexPlot") @@ -297,13 +343,13 @@ def eval_ComplexPlot( plot_options, evaluation: Evaluation, ): - def emit(graphics, i, xyzs, quads): + def emit(graphics, i, xyzs, _, quads): # flatten the points and add the quads rgb = complex_colors(xyzs[:, 2]) xyzs_re = xyzs[:, 0:2].real graphics.add_complex(xyzs_re, lines=None, polys=quads, colors=rgb) - return make_plot(plot_options, evaluation, dim=2, is_complex=True, emit=emit) + return make_surfaces(plot_options, evaluation, dim=2, is_complex=True, emit=emit) @Timer("eval_ParametricPlot3D") @@ -311,17 +357,28 @@ def eval_ParametricPlot3D( plot_options, evaluation: Evaluation, ): - def emit(graphics, i, xyzs, quads): + # ParametericPlot3D can make curves or surfaces depending on number of independent variables + is_surface = len(plot_options.ranges) > 1 + + def emit(graphics, i, xyzs, lines, polys): # choose a color - color_directive = palette_color_directive(palette3, i) + palette = palette3 if is_surface else palette2 + color_directive = palette_color_directive(palette, i) graphics.add_directives(color_directive) + if not is_surface: + graphics.add_directives([SymbolAbsoluteThickness, 4]) # add a GraphicsComplex displaying a surface for this function - graphics.add_complex(xyzs, lines=None, polys=quads) + graphics.add_complex(xyzs, lines=lines, polys=polys) # we want a list, each element of which is a list of 2 or 3 functions # to compute the coordinates of the lines or surface if not isinstance(plot_options.functions[0], (list, tuple)): plot_options.functions = [plot_options.functions] - return make_plot(plot_options, evaluation, dim=3, is_complex=False, emit=emit) + if is_surface: + return make_surfaces( + plot_options, evaluation, dim=3, is_complex=False, emit=emit + ) + else: + return make_curves(plot_options, evaluation, dim=3, emit=emit) From 6b5da3cc4877b497a3e65f13db1d82bfcc81598a Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 00:37:08 -0500 Subject: [PATCH 06/20] typo --- mathics/eval/drawing/plot3d_vectorized.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index 414650698..9869a5d38 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -136,7 +136,7 @@ def compute_over_grid(nu, nv): # For ParametricPlot3D with just one independent variable we generate a curve # TODO: consider whether we can DRY this with similar code in ParmetricPlot -def make_curvess(plot_options, evaluation: Evaluation, dim: int, emit): +def make_curves(plot_options, evaluation: Evaluation, dim: int, emit): graphics = GraphicsGenerator(dim) # pull out plot options From 0a22cea0a4d2b1f4fedbc3f5c0098dd3b2e83598 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 01:01:15 -0500 Subject: [PATCH 07/20] Tests --- test/builtin/drawing/test_plot_detail.py | 2 +- .../vec-parametricplot3d-multi-vec.txt | 455 ++++++++++++++++++ .../vec-parametricplot3d-rings-vec.txt | 366 ++++++++++++++ ...c-parametricplot3d-torus-plotrange-vec.txt | 253 ++++++++++ .../vec-parametricplot3d-torus-vec.txt | 250 ++++++++++ .../vec-parametricplot3d-trefoil-vec.txt | 277 +++++++++++ test/builtin/drawing/vec_tests.yaml | 42 ++ 7 files changed, 1644 insertions(+), 1 deletion(-) create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-multi-vec.txt create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-rings-vec.txt create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-plotrange-vec.txt create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-vec.txt create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-trefoil-vec.txt diff --git a/test/builtin/drawing/test_plot_detail.py b/test/builtin/drawing/test_plot_detail.py index 6701a578f..416f60fc8 100644 --- a/test/builtin/drawing/test_plot_detail.py +++ b/test/builtin/drawing/test_plot_detail.py @@ -343,8 +343,8 @@ def yaml_tests_generator(fn: str): YAML_TESTS = [ - "doc_tests.yaml", "vec_tests.yaml", + "doc_tests.yaml", "parameters.yaml", ] diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-multi-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-multi-vec.txt new file mode 100644 index 000000000..2c3732d7a --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-multi-vec.txt @@ -0,0 +1,455 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 0.392157 + System`Real 0.560784 + System`Real 1.0 + System`AbsoluteThickness + System`Integer 4 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 1000×3] + [[ 0.00000000e+00 -1.00000000e+00 -0.00000000e+00] + [ 3.14466690e-02 -9.99861551e-01 -1.88673048e-02] + [ 6.28891086e-02 -9.99446227e-01 -3.77278927e-02] + ... + [-6.28891086e-02 -9.99446227e-01 3.77278927e-02] + [-3.14466690e-02 -9.99861551e-01 1.88673048e-02] + [-1.22464680e-15 -1.00000000e+00 7.34788079e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 1×1000] + [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 37 38 39 40 41 42 + 43 44 45 46 47 48 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 81 82 83 84 + 85 86 87 88 89 90 91 92 93 94 95 96 97 98 + 99 100 101 102 103 104 105 106 107 108 109 110 111 112 + 113 114 115 116 117 118 119 120 121 122 123 124 125 126 + 127 128 129 130 131 132 133 134 135 136 137 138 139 140 + 141 142 143 144 145 146 147 148 149 150 151 152 153 154 + 155 156 157 158 159 160 161 162 163 164 165 166 167 168 + 169 170 171 172 173 174 175 176 177 178 179 180 181 182 + 183 184 185 186 187 188 189 190 191 192 193 194 195 196 + 197 198 199 200 201 202 203 204 205 206 207 208 209 210 + 211 212 213 214 215 216 217 218 219 220 221 222 223 224 + 225 226 227 228 229 230 231 232 233 234 235 236 237 238 + 239 240 241 242 243 244 245 246 247 248 249 250 251 252 + 253 254 255 256 257 258 259 260 261 262 263 264 265 266 + 267 268 269 270 271 272 273 274 275 276 277 278 279 280 + 281 282 283 284 285 286 287 288 289 290 291 292 293 294 + 295 296 297 298 299 300 301 302 303 304 305 306 307 308 + 309 310 311 312 313 314 315 316 317 318 319 320 321 322 + 323 324 325 326 327 328 329 330 331 332 333 334 335 336 + 337 338 339 340 341 342 343 344 345 346 347 348 349 350 + 351 352 353 354 355 356 357 358 359 360 361 362 363 364 + 365 366 367 368 369 370 371 372 373 374 375 376 377 378 + 379 380 381 382 383 384 385 386 387 388 389 390 391 392 + 393 394 395 396 397 398 399 400 401 402 403 404 405 406 + 407 408 409 410 411 412 413 414 415 416 417 418 419 420 + 421 422 423 424 425 426 427 428 429 430 431 432 433 434 + 435 436 437 438 439 440 441 442 443 444 445 446 447 448 + 449 450 451 452 453 454 455 456 457 458 459 460 461 462 + 463 464 465 466 467 468 469 470 471 472 473 474 475 476 + 477 478 479 480 481 482 483 484 485 486 487 488 489 490 + 491 492 493 494 495 496 497 498 499 500 501 502 503 504 + 505 506 507 508 509 510 511 512 513 514 515 516 517 518 + 519 520 521 522 523 524 525 526 527 528 529 530 531 532 + 533 534 535 536 537 538 539 540 541 542 543 544 545 546 + 547 548 549 550 551 552 553 554 555 556 557 558 559 560 + 561 562 563 564 565 566 567 568 569 570 571 572 573 574 + 575 576 577 578 579 580 581 582 583 584 585 586 587 588 + 589 590 591 592 593 594 595 596 597 598 599 600 601 602 + 603 604 605 606 607 608 609 610 611 612 613 614 615 616 + 617 618 619 620 621 622 623 624 625 626 627 628 629 630 + 631 632 633 634 635 636 637 638 639 640 641 642 643 644 + 645 646 647 648 649 650 651 652 653 654 655 656 657 658 + 659 660 661 662 663 664 665 666 667 668 669 670 671 672 + 673 674 675 676 677 678 679 680 681 682 683 684 685 686 + 687 688 689 690 691 692 693 694 695 696 697 698 699 700 + 701 702 703 704 705 706 707 708 709 710 711 712 713 714 + 715 716 717 718 719 720 721 722 723 724 725 726 727 728 + 729 730 731 732 733 734 735 736 737 738 739 740 741 742 + 743 744 745 746 747 748 749 750 751 752 753 754 755 756 + 757 758 759 760 761 762 763 764 765 766 767 768 769 770 + 771 772 773 774 775 776 777 778 779 780 781 782 783 784 + 785 786 787 788 789 790 791 792 793 794 795 796 797 798 + 799 800 801 802 803 804 805 806 807 808 809 810 811 812 + 813 814 815 816 817 818 819 820 821 822 823 824 825 826 + 827 828 829 830 831 832 833 834 835 836 837 838 839 840 + 841 842 843 844 845 846 847 848 849 850 851 852 853 854 + 855 856 857 858 859 860 861 862 863 864 865 866 867 868 + 869 870 871 872 873 874 875 876 877 878 879 880 881 882 + 883 884 885 886 887 888 889 890 891 892 893 894 895 896 + 897 898 899 900 901 902 903 904 905 906 907 908 909 910 + 911 912 913 914 915 916 917 918 919 920 921 922 923 924 + 925 926 927 928 929 930 931 932 933 934 935 936 937 938 + 939 940 941 942 943 944 945 946 947 948 949 950 951 952 + 953 954 955 956 957 958 959 960 961 962 963 964 965 966 + 967 968 969 970 971 972 973 974 975 976 977 978 979 980 + 981 982 983 984 985 986 987 988 989 990 991 992 993 994 + 995 996 997 998 999 1000]] + System`RGBColor + System`Real 1.0 + System`Real 0.690196 + System`Real 0.0 + System`AbsoluteThickness + System`Integer 4 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 1000×3] + [[ 0.00000000e+00 2.00000000e+00 0.00000000e+00] + [ 1.25788666e-02 1.99996044e+00 2.48933554e-01] + [ 2.51572357e-02 1.99984177e+00 4.82194534e-01] + ... + [-2.51572357e-02 1.99984177e+00 -4.82194534e-01] + [-1.25788666e-02 1.99996044e+00 -2.48933554e-01] + [-4.89858720e-16 2.00000000e+00 -9.79717439e-15]] + System`Line + System`NumericArray NumericArray[Integer*, 1×1000] + [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 37 38 39 40 41 42 + 43 44 45 46 47 48 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 81 82 83 84 + 85 86 87 88 89 90 91 92 93 94 95 96 97 98 + 99 100 101 102 103 104 105 106 107 108 109 110 111 112 + 113 114 115 116 117 118 119 120 121 122 123 124 125 126 + 127 128 129 130 131 132 133 134 135 136 137 138 139 140 + 141 142 143 144 145 146 147 148 149 150 151 152 153 154 + 155 156 157 158 159 160 161 162 163 164 165 166 167 168 + 169 170 171 172 173 174 175 176 177 178 179 180 181 182 + 183 184 185 186 187 188 189 190 191 192 193 194 195 196 + 197 198 199 200 201 202 203 204 205 206 207 208 209 210 + 211 212 213 214 215 216 217 218 219 220 221 222 223 224 + 225 226 227 228 229 230 231 232 233 234 235 236 237 238 + 239 240 241 242 243 244 245 246 247 248 249 250 251 252 + 253 254 255 256 257 258 259 260 261 262 263 264 265 266 + 267 268 269 270 271 272 273 274 275 276 277 278 279 280 + 281 282 283 284 285 286 287 288 289 290 291 292 293 294 + 295 296 297 298 299 300 301 302 303 304 305 306 307 308 + 309 310 311 312 313 314 315 316 317 318 319 320 321 322 + 323 324 325 326 327 328 329 330 331 332 333 334 335 336 + 337 338 339 340 341 342 343 344 345 346 347 348 349 350 + 351 352 353 354 355 356 357 358 359 360 361 362 363 364 + 365 366 367 368 369 370 371 372 373 374 375 376 377 378 + 379 380 381 382 383 384 385 386 387 388 389 390 391 392 + 393 394 395 396 397 398 399 400 401 402 403 404 405 406 + 407 408 409 410 411 412 413 414 415 416 417 418 419 420 + 421 422 423 424 425 426 427 428 429 430 431 432 433 434 + 435 436 437 438 439 440 441 442 443 444 445 446 447 448 + 449 450 451 452 453 454 455 456 457 458 459 460 461 462 + 463 464 465 466 467 468 469 470 471 472 473 474 475 476 + 477 478 479 480 481 482 483 484 485 486 487 488 489 490 + 491 492 493 494 495 496 497 498 499 500 501 502 503 504 + 505 506 507 508 509 510 511 512 513 514 515 516 517 518 + 519 520 521 522 523 524 525 526 527 528 529 530 531 532 + 533 534 535 536 537 538 539 540 541 542 543 544 545 546 + 547 548 549 550 551 552 553 554 555 556 557 558 559 560 + 561 562 563 564 565 566 567 568 569 570 571 572 573 574 + 575 576 577 578 579 580 581 582 583 584 585 586 587 588 + 589 590 591 592 593 594 595 596 597 598 599 600 601 602 + 603 604 605 606 607 608 609 610 611 612 613 614 615 616 + 617 618 619 620 621 622 623 624 625 626 627 628 629 630 + 631 632 633 634 635 636 637 638 639 640 641 642 643 644 + 645 646 647 648 649 650 651 652 653 654 655 656 657 658 + 659 660 661 662 663 664 665 666 667 668 669 670 671 672 + 673 674 675 676 677 678 679 680 681 682 683 684 685 686 + 687 688 689 690 691 692 693 694 695 696 697 698 699 700 + 701 702 703 704 705 706 707 708 709 710 711 712 713 714 + 715 716 717 718 719 720 721 722 723 724 725 726 727 728 + 729 730 731 732 733 734 735 736 737 738 739 740 741 742 + 743 744 745 746 747 748 749 750 751 752 753 754 755 756 + 757 758 759 760 761 762 763 764 765 766 767 768 769 770 + 771 772 773 774 775 776 777 778 779 780 781 782 783 784 + 785 786 787 788 789 790 791 792 793 794 795 796 797 798 + 799 800 801 802 803 804 805 806 807 808 809 810 811 812 + 813 814 815 816 817 818 819 820 821 822 823 824 825 826 + 827 828 829 830 831 832 833 834 835 836 837 838 839 840 + 841 842 843 844 845 846 847 848 849 850 851 852 853 854 + 855 856 857 858 859 860 861 862 863 864 865 866 867 868 + 869 870 871 872 873 874 875 876 877 878 879 880 881 882 + 883 884 885 886 887 888 889 890 891 892 893 894 895 896 + 897 898 899 900 901 902 903 904 905 906 907 908 909 910 + 911 912 913 914 915 916 917 918 919 920 921 922 923 924 + 925 926 927 928 929 930 931 932 933 934 935 936 937 938 + 939 940 941 942 943 944 945 946 947 948 949 950 951 952 + 953 954 955 956 957 958 959 960 961 962 963 964 965 966 + 967 968 969 970 971 972 973 974 975 976 977 978 979 980 + 981 982 983 984 985 986 987 988 989 990 991 992 993 994 + 995 996 997 998 999 1000]] + System`RGBColor + System`Real 0.196078 + System`Real 0.588235 + System`Real 0.54902 + System`AbsoluteThickness + System`Integer 4 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 1000×3] + [[ 0.00000000e+00 2.00000000e+00 0.00000000e+00] + [ 1.25788666e-02 1.99996044e+00 0.00000000e+00] + [ 2.51572357e-02 1.99984177e+00 0.00000000e+00] + ... + [-2.51572357e-02 1.99984177e+00 0.00000000e+00] + [-1.25788666e-02 1.99996044e+00 0.00000000e+00] + [-4.89858720e-16 2.00000000e+00 0.00000000e+00]] + System`Line + System`NumericArray NumericArray[Integer*, 1×1000] + [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 37 38 39 40 41 42 + 43 44 45 46 47 48 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 81 82 83 84 + 85 86 87 88 89 90 91 92 93 94 95 96 97 98 + 99 100 101 102 103 104 105 106 107 108 109 110 111 112 + 113 114 115 116 117 118 119 120 121 122 123 124 125 126 + 127 128 129 130 131 132 133 134 135 136 137 138 139 140 + 141 142 143 144 145 146 147 148 149 150 151 152 153 154 + 155 156 157 158 159 160 161 162 163 164 165 166 167 168 + 169 170 171 172 173 174 175 176 177 178 179 180 181 182 + 183 184 185 186 187 188 189 190 191 192 193 194 195 196 + 197 198 199 200 201 202 203 204 205 206 207 208 209 210 + 211 212 213 214 215 216 217 218 219 220 221 222 223 224 + 225 226 227 228 229 230 231 232 233 234 235 236 237 238 + 239 240 241 242 243 244 245 246 247 248 249 250 251 252 + 253 254 255 256 257 258 259 260 261 262 263 264 265 266 + 267 268 269 270 271 272 273 274 275 276 277 278 279 280 + 281 282 283 284 285 286 287 288 289 290 291 292 293 294 + 295 296 297 298 299 300 301 302 303 304 305 306 307 308 + 309 310 311 312 313 314 315 316 317 318 319 320 321 322 + 323 324 325 326 327 328 329 330 331 332 333 334 335 336 + 337 338 339 340 341 342 343 344 345 346 347 348 349 350 + 351 352 353 354 355 356 357 358 359 360 361 362 363 364 + 365 366 367 368 369 370 371 372 373 374 375 376 377 378 + 379 380 381 382 383 384 385 386 387 388 389 390 391 392 + 393 394 395 396 397 398 399 400 401 402 403 404 405 406 + 407 408 409 410 411 412 413 414 415 416 417 418 419 420 + 421 422 423 424 425 426 427 428 429 430 431 432 433 434 + 435 436 437 438 439 440 441 442 443 444 445 446 447 448 + 449 450 451 452 453 454 455 456 457 458 459 460 461 462 + 463 464 465 466 467 468 469 470 471 472 473 474 475 476 + 477 478 479 480 481 482 483 484 485 486 487 488 489 490 + 491 492 493 494 495 496 497 498 499 500 501 502 503 504 + 505 506 507 508 509 510 511 512 513 514 515 516 517 518 + 519 520 521 522 523 524 525 526 527 528 529 530 531 532 + 533 534 535 536 537 538 539 540 541 542 543 544 545 546 + 547 548 549 550 551 552 553 554 555 556 557 558 559 560 + 561 562 563 564 565 566 567 568 569 570 571 572 573 574 + 575 576 577 578 579 580 581 582 583 584 585 586 587 588 + 589 590 591 592 593 594 595 596 597 598 599 600 601 602 + 603 604 605 606 607 608 609 610 611 612 613 614 615 616 + 617 618 619 620 621 622 623 624 625 626 627 628 629 630 + 631 632 633 634 635 636 637 638 639 640 641 642 643 644 + 645 646 647 648 649 650 651 652 653 654 655 656 657 658 + 659 660 661 662 663 664 665 666 667 668 669 670 671 672 + 673 674 675 676 677 678 679 680 681 682 683 684 685 686 + 687 688 689 690 691 692 693 694 695 696 697 698 699 700 + 701 702 703 704 705 706 707 708 709 710 711 712 713 714 + 715 716 717 718 719 720 721 722 723 724 725 726 727 728 + 729 730 731 732 733 734 735 736 737 738 739 740 741 742 + 743 744 745 746 747 748 749 750 751 752 753 754 755 756 + 757 758 759 760 761 762 763 764 765 766 767 768 769 770 + 771 772 773 774 775 776 777 778 779 780 781 782 783 784 + 785 786 787 788 789 790 791 792 793 794 795 796 797 798 + 799 800 801 802 803 804 805 806 807 808 809 810 811 812 + 813 814 815 816 817 818 819 820 821 822 823 824 825 826 + 827 828 829 830 831 832 833 834 835 836 837 838 839 840 + 841 842 843 844 845 846 847 848 849 850 851 852 853 854 + 855 856 857 858 859 860 861 862 863 864 865 866 867 868 + 869 870 871 872 873 874 875 876 877 878 879 880 881 882 + 883 884 885 886 887 888 889 890 891 892 893 894 895 896 + 897 898 899 900 901 902 903 904 905 906 907 908 909 910 + 911 912 913 914 915 916 917 918 919 920 921 922 923 924 + 925 926 927 928 929 930 931 932 933 934 935 936 937 938 + 939 940 941 942 943 944 945 946 947 948 949 950 951 952 + 953 954 955 956 957 958 959 960 961 962 963 964 965 966 + 967 968 969 970 971 972 973 974 975 976 977 978 979 980 + 981 982 983 984 985 986 987 988 989 990 991 992 993 994 + 995 996 997 998 999 1000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Real 0.4 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`Automatic + System`Automatic + System`Automatic + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-rings-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-rings-vec.txt new file mode 100644 index 000000000..9c479dd67 --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-rings-vec.txt @@ -0,0 +1,366 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 1.0 + System`Real 0.690196 + System`Real 0.0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 6.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 5.99700953e+00 1.89411299e-01 0.00000000e+00] + [ 5.98804112e+00 3.78633788e-01 0.00000000e+00] + ... + [ 5.98804112e+00 -3.78633788e-01 -2.44929360e-16] + [ 5.99700953e+00 -1.89411299e-01 -2.44929360e-16] + [ 6.00000000e+00 -1.46957616e-15 -2.44929360e-16]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Real 0.392157 + System`Real 0.560784 + System`Real 1.0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 0.00000000e+00 0.00000000e+00 6.00000000e+00] + [ 1.89411299e-01 0.00000000e+00 5.99700953e+00] + [ 3.78633788e-01 0.00000000e+00 5.98804112e+00] + ... + [-3.78633788e-01 -2.44929360e-16 5.98804112e+00] + [-1.89411299e-01 -2.44929360e-16 5.99700953e+00] + [-1.46957616e-15 -2.44929360e-16 6.00000000e+00]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Real 0.862745 + System`Real 0.14902 + System`Real 0.498039 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 0.00000000e+00 6.00000000e+00 0.00000000e+00] + [ 0.00000000e+00 5.99700953e+00 1.89411299e-01] + [ 0.00000000e+00 5.98804112e+00 3.78633788e-01] + ... + [-2.44929360e-16 5.98804112e+00 -3.78633788e-01] + [-2.44929360e-16 5.99700953e+00 -1.89411299e-01] + [-2.44929360e-16 6.00000000e+00 -1.46957616e-15]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Integer 0 + System`Integer 0 + System`Integer 0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 6.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 5.99700953e+00 1.89411299e-01 0.00000000e+00] + [ 5.98804112e+00 3.78633788e-01 0.00000000e+00] + ... + [ 5.98804112e+00 -3.78633788e-01 -2.44929360e-16] + [ 5.99700953e+00 -1.89411299e-01 -2.44929360e-16] + [ 6.00000000e+00 -1.46957616e-15 -2.44929360e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 2 3 ... 198 199 200] + [ 201 202 203 ... 398 399 400] + [ 401 402 403 ... 598 599 600] + ... + [3401 3402 3403 ... 3598 3599 3600] + [3601 3602 3603 ... 3798 3799 3800] + [3801 3802 3803 ... 3998 3999 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 0.00000000e+00 0.00000000e+00 6.00000000e+00] + [ 1.89411299e-01 0.00000000e+00 5.99700953e+00] + [ 3.78633788e-01 0.00000000e+00 5.98804112e+00] + ... + [-3.78633788e-01 -2.44929360e-16 5.98804112e+00] + [-1.89411299e-01 -2.44929360e-16 5.99700953e+00] + [-1.46957616e-15 -2.44929360e-16 6.00000000e+00]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 2 3 ... 198 199 200] + [ 201 202 203 ... 398 399 400] + [ 401 402 403 ... 598 599 600] + ... + [3401 3402 3403 ... 3598 3599 3600] + [3601 3602 3603 ... 3798 3799 3800] + [3801 3802 3803 ... 3998 3999 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 0.00000000e+00 6.00000000e+00 0.00000000e+00] + [ 0.00000000e+00 5.99700953e+00 1.89411299e-01] + [ 0.00000000e+00 5.98804112e+00 3.78633788e-01] + ... + [-2.44929360e-16 5.98804112e+00 -3.78633788e-01] + [-2.44929360e-16 5.99700953e+00 -1.89411299e-01] + [-2.44929360e-16 6.00000000e+00 -1.46957616e-15]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 2 3 ... 198 199 200] + [ 201 202 203 ... 398 399 400] + [ 401 402 403 ... 598 599 600] + ... + [3401 3402 3403 ... 3598 3599 3600] + [3601 3602 3603 ... 3798 3799 3800] + [3801 3802 3803 ... 3998 3999 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 6.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 5.67490345e+00 1.94819682e+00 0.00000000e+00] + [ 4.73484306e+00 3.68527628e+00 0.00000000e+00] + ... + [ 4.73484306e+00 -3.68527628e+00 -2.44929360e-16] + [ 5.67490345e+00 -1.94819682e+00 -2.44929360e-16] + [ 6.00000000e+00 -1.46957616e-15 -2.44929360e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 21 41 ... 3941 3961 3981] + [ 2 22 42 ... 3942 3962 3982] + [ 3 23 43 ... 3943 3963 3983] + ... + [ 18 38 58 ... 3958 3978 3998] + [ 19 39 59 ... 3959 3979 3999] + [ 20 40 60 ... 3960 3980 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 0.00000000e+00 0.00000000e+00 6.00000000e+00] + [ 1.94819682e+00 0.00000000e+00 5.67490345e+00] + [ 3.68527628e+00 0.00000000e+00 4.73484306e+00] + ... + [-3.68527628e+00 -2.44929360e-16 4.73484306e+00] + [-1.94819682e+00 -2.44929360e-16 5.67490345e+00] + [-1.46957616e-15 -2.44929360e-16 6.00000000e+00]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 21 41 ... 3941 3961 3981] + [ 2 22 42 ... 3942 3962 3982] + [ 3 23 43 ... 3943 3963 3983] + ... + [ 18 38 58 ... 3958 3978 3998] + [ 19 39 59 ... 3959 3979 3999] + [ 20 40 60 ... 3960 3980 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 0.00000000e+00 6.00000000e+00 0.00000000e+00] + [ 0.00000000e+00 5.67490345e+00 1.94819682e+00] + [ 0.00000000e+00 4.73484306e+00 3.68527628e+00] + ... + [-2.44929360e-16 4.73484306e+00 -3.68527628e+00] + [-2.44929360e-16 5.67490345e+00 -1.94819682e+00] + [-2.44929360e-16 6.00000000e+00 -1.46957616e-15]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 21 41 ... 3941 3961 3981] + [ 2 22 42 ... 3942 3962 3982] + [ 3 23 43 ... 3943 3963 3983] + ... + [ 18 38 58 ... 3958 3978 3998] + [ 19 39 59 ... 3959 3979 3999] + [ 20 40 60 ... 3960 3980 4000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Integer 1 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`Automatic + System`Automatic + System`Automatic + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-plotrange-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-plotrange-vec.txt new file mode 100644 index 000000000..d6ac1342b --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-plotrange-vec.txt @@ -0,0 +1,253 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 1.0 + System`Real 0.690196 + System`Real 0.0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 3.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 2.99850477e+00 9.47056493e-02 0.00000000e+00] + [ 2.99402056e+00 1.89316894e-01 0.00000000e+00] + ... + [ 2.99402056e+00 -1.89316894e-01 -2.44929360e-16] + [ 2.99850477e+00 -9.47056493e-02 -2.44929360e-16] + [ 3.00000000e+00 -7.34788079e-16 -2.44929360e-16]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Integer 0 + System`Integer 0 + System`Integer 0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 3.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 2.99850477e+00 9.47056493e-02 0.00000000e+00] + [ 2.99402056e+00 1.89316894e-01 0.00000000e+00] + ... + [ 2.99402056e+00 -1.89316894e-01 -2.44929360e-16] + [ 2.99850477e+00 -9.47056493e-02 -2.44929360e-16] + [ 3.00000000e+00 -7.34788079e-16 -2.44929360e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 2 3 ... 198 199 200] + [ 201 202 203 ... 398 399 400] + [ 401 402 403 ... 598 599 600] + ... + [3401 3402 3403 ... 3598 3599 3600] + [3601 3602 3603 ... 3798 3799 3800] + [3801 3802 3803 ... 3998 3999 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 3.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 2.83745173e+00 9.74098408e-01 0.00000000e+00] + [ 2.36742153e+00 1.84263814e+00 0.00000000e+00] + ... + [ 2.36742153e+00 -1.84263814e+00 -2.44929360e-16] + [ 2.83745173e+00 -9.74098408e-01 -2.44929360e-16] + [ 3.00000000e+00 -7.34788079e-16 -2.44929360e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 21 41 ... 3941 3961 3981] + [ 2 22 42 ... 3942 3962 3982] + [ 3 23 43 ... 3943 3963 3983] + ... + [ 18 38 58 ... 3958 3978 3998] + [ 19 39 59 ... 3959 3979 3999] + [ 20 40 60 ... 3960 3980 4000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Real 0.4 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`List + System`Real 0.0 + System`Real 3.0 + System`List + System`Real 0.0 + System`Real 3.0 + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-vec.txt new file mode 100644 index 000000000..29229bb83 --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-torus-vec.txt @@ -0,0 +1,250 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 1.0 + System`Real 0.690196 + System`Real 0.0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 3.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 2.99850477e+00 9.47056493e-02 0.00000000e+00] + [ 2.99402056e+00 1.89316894e-01 0.00000000e+00] + ... + [ 2.99402056e+00 -1.89316894e-01 -2.44929360e-16] + [ 2.99850477e+00 -9.47056493e-02 -2.44929360e-16] + [ 3.00000000e+00 -7.34788079e-16 -2.44929360e-16]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Integer 0 + System`Integer 0 + System`Integer 0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 3.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 2.99850477e+00 9.47056493e-02 0.00000000e+00] + [ 2.99402056e+00 1.89316894e-01 0.00000000e+00] + ... + [ 2.99402056e+00 -1.89316894e-01 -2.44929360e-16] + [ 2.99850477e+00 -9.47056493e-02 -2.44929360e-16] + [ 3.00000000e+00 -7.34788079e-16 -2.44929360e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 2 3 ... 198 199 200] + [ 201 202 203 ... 398 399 400] + [ 401 402 403 ... 598 599 600] + ... + [3401 3402 3403 ... 3598 3599 3600] + [3601 3602 3603 ... 3798 3799 3800] + [3801 3802 3803 ... 3998 3999 4000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 4000×3] + [[ 3.00000000e+00 0.00000000e+00 0.00000000e+00] + [ 2.83745173e+00 9.74098408e-01 0.00000000e+00] + [ 2.36742153e+00 1.84263814e+00 0.00000000e+00] + ... + [ 2.36742153e+00 -1.84263814e+00 -2.44929360e-16] + [ 2.83745173e+00 -9.74098408e-01 -2.44929360e-16] + [ 3.00000000e+00 -7.34788079e-16 -2.44929360e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 20×200] + [[ 1 21 41 ... 3941 3961 3981] + [ 2 22 42 ... 3942 3962 3982] + [ 3 23 43 ... 3943 3963 3983] + ... + [ 18 38 58 ... 3958 3978 3998] + [ 19 39 59 ... 3959 3979 3999] + [ 20 40 60 ... 3960 3980 4000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Real 0.4 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`Automatic + System`Automatic + System`Automatic + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-trefoil-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-trefoil-vec.txt new file mode 100644 index 000000000..30f8deed9 --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-trefoil-vec.txt @@ -0,0 +1,277 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 0.392157 + System`Real 0.560784 + System`Real 1.0 + System`AbsoluteThickness + System`Integer 4 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 1000×3] + [[ 0.00000000e+00 -1.00000000e+00 -0.00000000e+00] + [ 3.14466690e-02 -9.99861551e-01 -1.88673048e-02] + [ 6.28891086e-02 -9.99446227e-01 -3.77278927e-02] + ... + [-6.28891086e-02 -9.99446227e-01 3.77278927e-02] + [-3.14466690e-02 -9.99861551e-01 1.88673048e-02] + [-1.22464680e-15 -1.00000000e+00 7.34788079e-16]] + System`Line + System`NumericArray NumericArray[Integer*, 1×1000] + [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 37 38 39 40 41 42 + 43 44 45 46 47 48 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 81 82 83 84 + 85 86 87 88 89 90 91 92 93 94 95 96 97 98 + 99 100 101 102 103 104 105 106 107 108 109 110 111 112 + 113 114 115 116 117 118 119 120 121 122 123 124 125 126 + 127 128 129 130 131 132 133 134 135 136 137 138 139 140 + 141 142 143 144 145 146 147 148 149 150 151 152 153 154 + 155 156 157 158 159 160 161 162 163 164 165 166 167 168 + 169 170 171 172 173 174 175 176 177 178 179 180 181 182 + 183 184 185 186 187 188 189 190 191 192 193 194 195 196 + 197 198 199 200 201 202 203 204 205 206 207 208 209 210 + 211 212 213 214 215 216 217 218 219 220 221 222 223 224 + 225 226 227 228 229 230 231 232 233 234 235 236 237 238 + 239 240 241 242 243 244 245 246 247 248 249 250 251 252 + 253 254 255 256 257 258 259 260 261 262 263 264 265 266 + 267 268 269 270 271 272 273 274 275 276 277 278 279 280 + 281 282 283 284 285 286 287 288 289 290 291 292 293 294 + 295 296 297 298 299 300 301 302 303 304 305 306 307 308 + 309 310 311 312 313 314 315 316 317 318 319 320 321 322 + 323 324 325 326 327 328 329 330 331 332 333 334 335 336 + 337 338 339 340 341 342 343 344 345 346 347 348 349 350 + 351 352 353 354 355 356 357 358 359 360 361 362 363 364 + 365 366 367 368 369 370 371 372 373 374 375 376 377 378 + 379 380 381 382 383 384 385 386 387 388 389 390 391 392 + 393 394 395 396 397 398 399 400 401 402 403 404 405 406 + 407 408 409 410 411 412 413 414 415 416 417 418 419 420 + 421 422 423 424 425 426 427 428 429 430 431 432 433 434 + 435 436 437 438 439 440 441 442 443 444 445 446 447 448 + 449 450 451 452 453 454 455 456 457 458 459 460 461 462 + 463 464 465 466 467 468 469 470 471 472 473 474 475 476 + 477 478 479 480 481 482 483 484 485 486 487 488 489 490 + 491 492 493 494 495 496 497 498 499 500 501 502 503 504 + 505 506 507 508 509 510 511 512 513 514 515 516 517 518 + 519 520 521 522 523 524 525 526 527 528 529 530 531 532 + 533 534 535 536 537 538 539 540 541 542 543 544 545 546 + 547 548 549 550 551 552 553 554 555 556 557 558 559 560 + 561 562 563 564 565 566 567 568 569 570 571 572 573 574 + 575 576 577 578 579 580 581 582 583 584 585 586 587 588 + 589 590 591 592 593 594 595 596 597 598 599 600 601 602 + 603 604 605 606 607 608 609 610 611 612 613 614 615 616 + 617 618 619 620 621 622 623 624 625 626 627 628 629 630 + 631 632 633 634 635 636 637 638 639 640 641 642 643 644 + 645 646 647 648 649 650 651 652 653 654 655 656 657 658 + 659 660 661 662 663 664 665 666 667 668 669 670 671 672 + 673 674 675 676 677 678 679 680 681 682 683 684 685 686 + 687 688 689 690 691 692 693 694 695 696 697 698 699 700 + 701 702 703 704 705 706 707 708 709 710 711 712 713 714 + 715 716 717 718 719 720 721 722 723 724 725 726 727 728 + 729 730 731 732 733 734 735 736 737 738 739 740 741 742 + 743 744 745 746 747 748 749 750 751 752 753 754 755 756 + 757 758 759 760 761 762 763 764 765 766 767 768 769 770 + 771 772 773 774 775 776 777 778 779 780 781 782 783 784 + 785 786 787 788 789 790 791 792 793 794 795 796 797 798 + 799 800 801 802 803 804 805 806 807 808 809 810 811 812 + 813 814 815 816 817 818 819 820 821 822 823 824 825 826 + 827 828 829 830 831 832 833 834 835 836 837 838 839 840 + 841 842 843 844 845 846 847 848 849 850 851 852 853 854 + 855 856 857 858 859 860 861 862 863 864 865 866 867 868 + 869 870 871 872 873 874 875 876 877 878 879 880 881 882 + 883 884 885 886 887 888 889 890 891 892 893 894 895 896 + 897 898 899 900 901 902 903 904 905 906 907 908 909 910 + 911 912 913 914 915 916 917 918 919 920 921 922 923 924 + 925 926 927 928 929 930 931 932 933 934 935 936 937 938 + 939 940 941 942 943 944 945 946 947 948 949 950 951 952 + 953 954 955 956 957 958 959 960 961 962 963 964 965 966 + 967 968 969 970 971 972 973 974 975 976 977 978 979 980 + 981 982 983 984 985 986 987 988 989 990 991 992 993 994 + 995 996 997 998 999 1000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Real 0.4 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`Automatic + System`Automatic + System`Automatic + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 diff --git a/test/builtin/drawing/vec_tests.yaml b/test/builtin/drawing/vec_tests.yaml index 976423075..daeda4138 100644 --- a/test/builtin/drawing/vec_tests.yaml +++ b/test/builtin/drawing/vec_tests.yaml @@ -65,6 +65,48 @@ vec-parametricplot-zeta-sideways: ] ' # +# ParametricPlot3D +# +vec-parametricplot3d-trefoil: + expr: ParametricPlot3D[{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, {t, 0, 2 Pi}] +vec-parametricplot3d-multi: + expr: ' + ParametricPlot3D[ + {{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, + {2 Sin[t], 2 Cos[t], Sin[40 t]}, + {2 Sin[t], 2 Cos[t], 0}}, + {t, 0, 2 Pi} + ] + ' +vec-parametricplot3d-torus: + expr: ' + ParametricPlot3D[ + {(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, + {u, 0, 2 Pi}, {v, 0, 2 Pi} + ] + ' +vec-parametricplot3d-torus-plotrange: + expr: ' + ParametricPlot3D[ + {(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, + {u, 0, 2 Pi}, {v, 0, 2 Pi}, + PlotRange -> {{0,3},{0,3}} + ] + ' +vec-parametricplot3d-rings: + expr: ' + Module[{R, r, x, y, z}, + R=5; r=1; + x = (R + r Cos[v]) Cos[u]; + y = (R + r Cos[v]) Sin[u]; + z = r Sin[v]; + ParametricPlot3D[ + {{x, y, z}, {y, z, x}, {z, x, y}}, + {u, 0, 2 Pi}, {v, 0, 2 Pi}, BoxRatios->{1,1,1} + ] + ] + ' +# # Plot # vec-plot-exclusions: From a8fd5e7d812b5462f74c2ee81c82266b386aaa8d Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 08:34:05 -0500 Subject: [PATCH 08/20] Formatting --- mathics/eval/drawing/plot3d_vectorized.py | 2 -- mathics/eval/drawing/util.py | 4 ---- 2 files changed, 6 deletions(-) diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index 9869a5d38..f48998eb0 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -4,7 +4,6 @@ """ import math -from typing import Sequence import numpy as np @@ -13,7 +12,6 @@ from mathics.core.expression import Expression from mathics.core.symbols import strip_context from mathics.core.systemsymbols import ( - Symbol, SymbolAbsoluteThickness, SymbolEqual, SymbolNone, diff --git a/mathics/eval/drawing/util.py b/mathics/eval/drawing/util.py index 4929843aa..10850f9cf 100644 --- a/mathics/eval/drawing/util.py +++ b/mathics/eval/drawing/util.py @@ -2,7 +2,6 @@ Common utilities for plotting """ - from mathics.core.atoms import NumericArray from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.lambdify import lambdify_compile @@ -21,10 +20,7 @@ ) -# TODO: this will be extended with support for GraphicsComplex in a -# subsequent PR, which may involve a little more refactoring class GraphicsGenerator: - """ Support for generating Graphics and Graphics3D expressions """ From 118e8a81ee277f8c703fd6d16e67cead7e0e02ce Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 08:48:54 -0500 Subject: [PATCH 09/20] Description --- mathics/builtin/drawing/plot_plot3d.py | 17 ++++++++++++++++- mathics/eval/drawing/util.py | 7 ++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index 69ba58a48..a5f9236f6 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -267,7 +267,22 @@ class DensityPlot(_Plot3D): class ParametricPlot3D(_Plot3D): - summary_text = "plot a parametric surface" + """ + :WMA link: https://reference.wolfram.com/language/ref/ParametricPlot3D.html +
+
'ParametricPlot3D'[${x(u,v), y(u,v), z(u,v)}$, {$u$, $u_{min}$, $u_{max}$}, {$v$, $v_{min}$, $v_{max}$}] +
creates a three-dimensional surface using the functions $x$, $y$, $z$ over the specified ranges for parameters $u$ and $v$. + +
'ParametricPlot3D'[${x(u), y(u), z(u)}$, {$u$, $u_{min}$, $u_{max}$}] +
creates a three-dimensional space curve using the functions $x$, $y$, $z$ over the specified range for parameter $u$. + + See :Drawing Option and Option Values: + /doc/reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values + for a list of Plot options. +
+ """ + + summary_text = "plot a parametric surface or curve in three dimensions" expected_args = 3 options = _Plot3D.options3d diff --git a/mathics/eval/drawing/util.py b/mathics/eval/drawing/util.py index 10850f9cf..8645b6bf3 100644 --- a/mathics/eval/drawing/util.py +++ b/mathics/eval/drawing/util.py @@ -2,9 +2,12 @@ Common utilities for plotting """ +from typing import Sequence, String + from mathics.core.atoms import NumericArray from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.lambdify import lambdify_compile +from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol @@ -101,7 +104,9 @@ def generate(self, options): return graphics_expr -def compile_exprs(evaluation, expr_or_list, names): +def compile_exprs( + evaluation: Evaluation, expr_or_list: Expression | Sequence, names: Sequence[String] +): """Traverse a nested list structure and compile the functions at the leaves""" if isinstance(expr_or_list, (list, tuple)): return [compile_exprs(evaluation, e, names) for e in expr_or_list] From ed03fcdaf05b23f95eebea8a37c128492fa03bbf Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 10:08:29 -0500 Subject: [PATCH 10/20] Formatting --- mathics/eval/drawing/plot3d_vectorized.py | 2 -- mathics/eval/drawing/util.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index f48998eb0..99ab3d59b 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -18,7 +18,6 @@ SymbolRGBColor, SymbolSubtract, ) -from mathics.core.util import print_expression_tree # noqa from mathics.timing import Timer from .colors import palette2, palette3, palette_color_directive @@ -142,7 +141,6 @@ def make_curves(plot_options, evaluation: Evaluation, dim: int, emit): nt = plot_options.plot_points[0] # compile - print_expression_tree(plot_options.functions) names = [strip_context(str(range[0])) for range in plot_options.ranges] with Timer("compile"): compiled_functions = compile_exprs(evaluation, plot_options.functions, names) diff --git a/mathics/eval/drawing/util.py b/mathics/eval/drawing/util.py index 8645b6bf3..0276d3e8b 100644 --- a/mathics/eval/drawing/util.py +++ b/mathics/eval/drawing/util.py @@ -2,7 +2,7 @@ Common utilities for plotting """ -from typing import Sequence, String +from typing import Sequence from mathics.core.atoms import NumericArray from mathics.core.convert.expression import to_expression, to_mathics_list @@ -105,7 +105,7 @@ def generate(self, options): def compile_exprs( - evaluation: Evaluation, expr_or_list: Expression | Sequence, names: Sequence[String] + evaluation: Evaluation, expr_or_list: Expression | Sequence, names: Sequence[str] ): """Traverse a nested list structure and compile the functions at the leaves""" if isinstance(expr_or_list, (list, tuple)): From 96a5e36d6d5180befe7a9d694cbbba772666b80c Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 12:35:25 -0500 Subject: [PATCH 11/20] Add Moebius strip test --- mathics/builtin/drawing/plot.py | 11 +- mathics/eval/drawing/plot3d_vectorized.py | 17 +- .../vec-parametricplot-moebius-vec.txt | 318 ++++++++++++++++++ test/builtin/drawing/vec_tests.yaml | 10 + 4 files changed, 346 insertions(+), 10 deletions(-) create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt diff --git a/mathics/builtin/drawing/plot.py b/mathics/builtin/drawing/plot.py index 5318d0949..5262c0e8a 100644 --- a/mathics/builtin/drawing/plot.py +++ b/mathics/builtin/drawing/plot.py @@ -481,11 +481,14 @@ def to_list(expr): self.exclusions = exclusions # Mesh option (returns Symbol) - mesh = builtin.get_option(options, "Mesh", evaluation) - if mesh not in (SymbolNone, SymbolFull, SymbolAll): + mesh = builtin.get_option(options, "Mesh", evaluation).to_python(preserve_symbols=True) + if isinstance(mesh, (list, tuple)) and all(isinstance(m, int) for m in mesh): + self.mesh = mesh + elif mesh not in (SymbolNone, SymbolFull, SymbolAll): evaluation.message("Mesh", "ilevels", mesh) - mesh = SymbolFull - self.mesh = mesh + self.mesh = SymbolFull + else: + self.mesh = mesh # PlotPoints option (returns Symbol) plot_points_option = builtin.get_option(options, "PlotPoints", evaluation) diff --git a/mathics/eval/drawing/plot3d_vectorized.py b/mathics/eval/drawing/plot3d_vectorized.py index 99ab3d59b..8f24526f5 100644 --- a/mathics/eval/drawing/plot3d_vectorized.py +++ b/mathics/eval/drawing/plot3d_vectorized.py @@ -41,9 +41,14 @@ def make_surfaces( names = [strip_context(str(range[0])) for range in plot_options.ranges] # Mesh option - nmesh = 20 - if plot_options.mesh is SymbolNone: - nmesh = 0 + mesh = plot_options.mesh + nmeshx = nmeshy = 20 + if mesh is SymbolNone: + nmeshx = nmeshy = 0 + elif isinstance(plot_options.mesh, int): + nmeshx = nmeshy = plot_options.mesh + elif isinstance(mesh, (list, tuple)) and all(isinstance(m, int) for m in mesh): + nmeshx, nmeshy = mesh # compile the functions with Timer("compile"): @@ -113,7 +118,7 @@ def compute_over_grid(nu, nv): # If requested by the Mesh attribute create a mesh of lines covering the surfaces # For now only for Plot3D # TODO: mesh for DensityPlot? - if nmesh and dim == 3: + if nmeshx and nmeshy and dim == 3: # meshes are black for now graphics.add_directives([SymbolRGBColor, 0, 0, 0]) @@ -123,9 +128,9 @@ def compute_over_grid(nu, nv): # from one row or one column of the inxs array. # Each mesh line has high res (nx or ny) so it follows # the contours of the surface. - for xyzs, inxs in compute_over_grid(nx, nmesh): + for xyzs, inxs in compute_over_grid(nx, nmeshy): graphics.add_complex(xyzs.real, lines=inxs, polys=None) - for xyzs, inxs in compute_over_grid(nmesh, ny): + for xyzs, inxs in compute_over_grid(nmeshx, ny): graphics.add_complex(xyzs.real, lines=inxs.T, polys=None) return graphics diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt new file mode 100644 index 000000000..3422baf35 --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt @@ -0,0 +1,318 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 1.0 + System`Real 0.690196 + System`Real 0.0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] + [ 4.99813069e-01 1.57862418e-02 -7.89312101e-03] + [ 4.99252135e-01 3.15685419e-02 -1.57842749e-02] + ... + [ 4.99252135e-01 -3.15685419e-02 1.57842749e-02] + [ 4.99813069e-01 -1.57862418e-02 7.89312101e-03] + [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Integer 0 + System`Integer 0 + System`Integer 0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 1000×3] + [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] + [ 4.99813069e-01 1.57862418e-02 -7.89312101e-03] + [ 4.99252135e-01 3.15685419e-02 -1.57842749e-02] + ... + [ 4.99252135e-01 -3.15685419e-02 1.57842749e-02] + [ 4.99813069e-01 -1.57862418e-02 7.89312101e-03] + [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] + System`Line + System`NumericArray NumericArray[Integer*, 5×200] + [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 37 38 39 40 41 42 + 43 44 45 46 47 48 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 81 82 83 84 + 85 86 87 88 89 90 91 92 93 94 95 96 97 98 + 99 100 101 102 103 104 105 106 107 108 109 110 111 112 + 113 114 115 116 117 118 119 120 121 122 123 124 125 126 + 127 128 129 130 131 132 133 134 135 136 137 138 139 140 + 141 142 143 144 145 146 147 148 149 150 151 152 153 154 + 155 156 157 158 159 160 161 162 163 164 165 166 167 168 + 169 170 171 172 173 174 175 176 177 178 179 180 181 182 + 183 184 185 186 187 188 189 190 191 192 193 194 195 196 + 197 198 199 200] + [ 201 202 203 204 205 206 207 208 209 210 211 212 213 214 + 215 216 217 218 219 220 221 222 223 224 225 226 227 228 + 229 230 231 232 233 234 235 236 237 238 239 240 241 242 + 243 244 245 246 247 248 249 250 251 252 253 254 255 256 + 257 258 259 260 261 262 263 264 265 266 267 268 269 270 + 271 272 273 274 275 276 277 278 279 280 281 282 283 284 + 285 286 287 288 289 290 291 292 293 294 295 296 297 298 + 299 300 301 302 303 304 305 306 307 308 309 310 311 312 + 313 314 315 316 317 318 319 320 321 322 323 324 325 326 + 327 328 329 330 331 332 333 334 335 336 337 338 339 340 + 341 342 343 344 345 346 347 348 349 350 351 352 353 354 + 355 356 357 358 359 360 361 362 363 364 365 366 367 368 + 369 370 371 372 373 374 375 376 377 378 379 380 381 382 + 383 384 385 386 387 388 389 390 391 392 393 394 395 396 + 397 398 399 400] + [ 401 402 403 404 405 406 407 408 409 410 411 412 413 414 + 415 416 417 418 419 420 421 422 423 424 425 426 427 428 + 429 430 431 432 433 434 435 436 437 438 439 440 441 442 + 443 444 445 446 447 448 449 450 451 452 453 454 455 456 + 457 458 459 460 461 462 463 464 465 466 467 468 469 470 + 471 472 473 474 475 476 477 478 479 480 481 482 483 484 + 485 486 487 488 489 490 491 492 493 494 495 496 497 498 + 499 500 501 502 503 504 505 506 507 508 509 510 511 512 + 513 514 515 516 517 518 519 520 521 522 523 524 525 526 + 527 528 529 530 531 532 533 534 535 536 537 538 539 540 + 541 542 543 544 545 546 547 548 549 550 551 552 553 554 + 555 556 557 558 559 560 561 562 563 564 565 566 567 568 + 569 570 571 572 573 574 575 576 577 578 579 580 581 582 + 583 584 585 586 587 588 589 590 591 592 593 594 595 596 + 597 598 599 600] + [ 601 602 603 604 605 606 607 608 609 610 611 612 613 614 + 615 616 617 618 619 620 621 622 623 624 625 626 627 628 + 629 630 631 632 633 634 635 636 637 638 639 640 641 642 + 643 644 645 646 647 648 649 650 651 652 653 654 655 656 + 657 658 659 660 661 662 663 664 665 666 667 668 669 670 + 671 672 673 674 675 676 677 678 679 680 681 682 683 684 + 685 686 687 688 689 690 691 692 693 694 695 696 697 698 + 699 700 701 702 703 704 705 706 707 708 709 710 711 712 + 713 714 715 716 717 718 719 720 721 722 723 724 725 726 + 727 728 729 730 731 732 733 734 735 736 737 738 739 740 + 741 742 743 744 745 746 747 748 749 750 751 752 753 754 + 755 756 757 758 759 760 761 762 763 764 765 766 767 768 + 769 770 771 772 773 774 775 776 777 778 779 780 781 782 + 783 784 785 786 787 788 789 790 791 792 793 794 795 796 + 797 798 799 800] + [ 801 802 803 804 805 806 807 808 809 810 811 812 813 814 + 815 816 817 818 819 820 821 822 823 824 825 826 827 828 + 829 830 831 832 833 834 835 836 837 838 839 840 841 842 + 843 844 845 846 847 848 849 850 851 852 853 854 855 856 + 857 858 859 860 861 862 863 864 865 866 867 868 869 870 + 871 872 873 874 875 876 877 878 879 880 881 882 883 884 + 885 886 887 888 889 890 891 892 893 894 895 896 897 898 + 899 900 901 902 903 904 905 906 907 908 909 910 911 912 + 913 914 915 916 917 918 919 920 921 922 923 924 925 926 + 927 928 929 930 931 932 933 934 935 936 937 938 939 940 + 941 942 943 944 945 946 947 948 949 950 951 952 953 954 + 955 956 957 958 959 960 961 962 963 964 965 966 967 968 + 969 970 971 972 973 974 975 976 977 978 979 980 981 982 + 983 984 985 986 987 988 989 990 991 992 993 994 995 996 + 997 998 999 1000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 3000×3] + [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] + [ 4.61779019e-01 2.22381055e-01 -1.11260467e-01] + [ 3.42617351e-01 4.29628570e-01 -2.16941870e-01] + ... + [ 3.42617351e-01 -4.29628570e-01 2.16941870e-01] + [ 4.61779019e-01 -2.22381055e-01 1.11260467e-01] + [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] + System`Line + System`NumericArray NumericArray[Integer*, 15×200] + [[ 1 16 31 ... 2956 2971 2986] + [ 2 17 32 ... 2957 2972 2987] + [ 3 18 33 ... 2958 2973 2988] + ... + [ 13 28 43 ... 2968 2983 2998] + [ 14 29 44 ... 2969 2984 2999] + [ 15 30 45 ... 2970 2985 3000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Real 0.4 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`Automatic + System`Automatic + System`Automatic + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 diff --git a/test/builtin/drawing/vec_tests.yaml b/test/builtin/drawing/vec_tests.yaml index daeda4138..035c0c801 100644 --- a/test/builtin/drawing/vec_tests.yaml +++ b/test/builtin/drawing/vec_tests.yaml @@ -106,6 +106,16 @@ vec-parametricplot3d-rings: ] ] ' +vec-parametricplot-moebius: + expr: ' + ParametricPlot3D[ + {(1 + (v/2) Cos[u/2]) Cos[u], + (1 + (v/2) Cos[u/2]) Sin[u], + (v/2) Sin[u/2]}, + {u, 0, 2 Pi}, {v, -1, 1}, + Mesh -> {15, 5} + ] + ' # # Plot # From a0c6fd273de66a65cd1d0d958b415ef1cfcb0acb Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Thu, 1 Jan 2026 12:35:59 -0500 Subject: [PATCH 12/20] Formatting --- mathics/builtin/drawing/plot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mathics/builtin/drawing/plot.py b/mathics/builtin/drawing/plot.py index 5262c0e8a..2958f6353 100644 --- a/mathics/builtin/drawing/plot.py +++ b/mathics/builtin/drawing/plot.py @@ -481,7 +481,9 @@ def to_list(expr): self.exclusions = exclusions # Mesh option (returns Symbol) - mesh = builtin.get_option(options, "Mesh", evaluation).to_python(preserve_symbols=True) + mesh = builtin.get_option(options, "Mesh", evaluation).to_python( + preserve_symbols=True + ) if isinstance(mesh, (list, tuple)) and all(isinstance(m, int) for m in mesh): self.mesh = mesh elif mesh not in (SymbolNone, SymbolFull, SymbolAll): From def106be9ba6d8396266805d291caff141762bb9 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Sat, 3 Jan 2026 09:13:03 -0500 Subject: [PATCH 13/20] Add examples and links --- mathics/builtin/drawing/plot_plot3d.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index a5f9236f6..ae46d623a 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -269,6 +269,7 @@ class DensityPlot(_Plot3D): class ParametricPlot3D(_Plot3D): """ :WMA link: https://reference.wolfram.com/language/ref/ParametricPlot3D.html + :Parametric equation: https://en.wikipedia.org/wiki/Parametric_equation
'ParametricPlot3D'[${x(u,v), y(u,v), z(u,v)}$, {$u$, $u_{min}$, $u_{max}$}, {$v$, $v_{min}$, $v_{max}$}]
creates a three-dimensional surface using the functions $x$, $y$, $z$ over the specified ranges for parameters $u$ and $v$. @@ -280,6 +281,18 @@ class ParametricPlot3D(_Plot3D): /doc/reference-of-built-in-symbols/graphics-and-drawing/drawing-options-and-option-values for a list of Plot options.
+ + >> ParametricPlot3D[{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, {t, 0, 2 Pi}] + = -Graphics- + + A function of a single parameter $t$ generates a trefoil knot. + + >> ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi} + ] + = -Graphics- + + A function of two parameters $u$ and $v$ generates a torus. + """ summary_text = "plot a parametric surface or curve in three dimensions" From d4a3f5dcf6a59dd434e604f4482080e8b746ee6c Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Sat, 3 Jan 2026 09:17:45 -0500 Subject: [PATCH 14/20] Correct doctest test output --- mathics/builtin/drawing/plot_plot3d.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index ae46d623a..341f81c37 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -283,13 +283,12 @@ class ParametricPlot3D(_Plot3D): >> ParametricPlot3D[{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, {t, 0, 2 Pi}] - = -Graphics- + = ParametricPlot3D[{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, {t, 0, 2 Pi}] A function of a single parameter $t$ generates a trefoil knot. - >> ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi} - ] - = -Graphics- + >> ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] + = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] A function of two parameters $u$ and $v$ generates a torus. From 7784fd3dffe91417aafab1b2276fedd50a7de27a Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Sat, 3 Jan 2026 09:27:13 -0500 Subject: [PATCH 15/20] Fix test name --- .../vec-parametricplot-moebius-vec.txt | 318 ------------------ test/builtin/drawing/vec_tests.yaml | 2 +- 2 files changed, 1 insertion(+), 319 deletions(-) delete mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt deleted file mode 100644 index 3422baf35..000000000 --- a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot-moebius-vec.txt +++ /dev/null @@ -1,318 +0,0 @@ -System`Graphics3D - System`List - System`RGBColor - System`Real 1.0 - System`Real 0.690196 - System`Real 0.0 - System`GraphicsComplex - System`NumericArray NumericArray[Real*, 40000×3] - [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] - [ 4.99813069e-01 1.57862418e-02 -7.89312101e-03] - [ 4.99252135e-01 3.15685419e-02 -1.57842749e-02] - ... - [ 4.99252135e-01 -3.15685419e-02 1.57842749e-02] - [ 4.99813069e-01 -1.57862418e-02 7.89312101e-03] - [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] - System`Polygon - System`NumericArray NumericArray[Integer*, 39601×4] - [[ 1 2 202 201] - [ 201 202 402 401] - [ 401 402 602 601] - ... - [39399 39400 39600 39599] - [39599 39600 39800 39799] - [39799 39800 40000 39999]] - System`RGBColor - System`Integer 0 - System`Integer 0 - System`Integer 0 - System`GraphicsComplex - System`NumericArray NumericArray[Real*, 1000×3] - [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] - [ 4.99813069e-01 1.57862418e-02 -7.89312101e-03] - [ 4.99252135e-01 3.15685419e-02 -1.57842749e-02] - ... - [ 4.99252135e-01 -3.15685419e-02 1.57842749e-02] - [ 4.99813069e-01 -1.57862418e-02 7.89312101e-03] - [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] - System`Line - System`NumericArray NumericArray[Integer*, 5×200] - [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - 15 16 17 18 19 20 21 22 23 24 25 26 27 28 - 29 30 31 32 33 34 35 36 37 38 39 40 41 42 - 43 44 45 46 47 48 49 50 51 52 53 54 55 56 - 57 58 59 60 61 62 63 64 65 66 67 68 69 70 - 71 72 73 74 75 76 77 78 79 80 81 82 83 84 - 85 86 87 88 89 90 91 92 93 94 95 96 97 98 - 99 100 101 102 103 104 105 106 107 108 109 110 111 112 - 113 114 115 116 117 118 119 120 121 122 123 124 125 126 - 127 128 129 130 131 132 133 134 135 136 137 138 139 140 - 141 142 143 144 145 146 147 148 149 150 151 152 153 154 - 155 156 157 158 159 160 161 162 163 164 165 166 167 168 - 169 170 171 172 173 174 175 176 177 178 179 180 181 182 - 183 184 185 186 187 188 189 190 191 192 193 194 195 196 - 197 198 199 200] - [ 201 202 203 204 205 206 207 208 209 210 211 212 213 214 - 215 216 217 218 219 220 221 222 223 224 225 226 227 228 - 229 230 231 232 233 234 235 236 237 238 239 240 241 242 - 243 244 245 246 247 248 249 250 251 252 253 254 255 256 - 257 258 259 260 261 262 263 264 265 266 267 268 269 270 - 271 272 273 274 275 276 277 278 279 280 281 282 283 284 - 285 286 287 288 289 290 291 292 293 294 295 296 297 298 - 299 300 301 302 303 304 305 306 307 308 309 310 311 312 - 313 314 315 316 317 318 319 320 321 322 323 324 325 326 - 327 328 329 330 331 332 333 334 335 336 337 338 339 340 - 341 342 343 344 345 346 347 348 349 350 351 352 353 354 - 355 356 357 358 359 360 361 362 363 364 365 366 367 368 - 369 370 371 372 373 374 375 376 377 378 379 380 381 382 - 383 384 385 386 387 388 389 390 391 392 393 394 395 396 - 397 398 399 400] - [ 401 402 403 404 405 406 407 408 409 410 411 412 413 414 - 415 416 417 418 419 420 421 422 423 424 425 426 427 428 - 429 430 431 432 433 434 435 436 437 438 439 440 441 442 - 443 444 445 446 447 448 449 450 451 452 453 454 455 456 - 457 458 459 460 461 462 463 464 465 466 467 468 469 470 - 471 472 473 474 475 476 477 478 479 480 481 482 483 484 - 485 486 487 488 489 490 491 492 493 494 495 496 497 498 - 499 500 501 502 503 504 505 506 507 508 509 510 511 512 - 513 514 515 516 517 518 519 520 521 522 523 524 525 526 - 527 528 529 530 531 532 533 534 535 536 537 538 539 540 - 541 542 543 544 545 546 547 548 549 550 551 552 553 554 - 555 556 557 558 559 560 561 562 563 564 565 566 567 568 - 569 570 571 572 573 574 575 576 577 578 579 580 581 582 - 583 584 585 586 587 588 589 590 591 592 593 594 595 596 - 597 598 599 600] - [ 601 602 603 604 605 606 607 608 609 610 611 612 613 614 - 615 616 617 618 619 620 621 622 623 624 625 626 627 628 - 629 630 631 632 633 634 635 636 637 638 639 640 641 642 - 643 644 645 646 647 648 649 650 651 652 653 654 655 656 - 657 658 659 660 661 662 663 664 665 666 667 668 669 670 - 671 672 673 674 675 676 677 678 679 680 681 682 683 684 - 685 686 687 688 689 690 691 692 693 694 695 696 697 698 - 699 700 701 702 703 704 705 706 707 708 709 710 711 712 - 713 714 715 716 717 718 719 720 721 722 723 724 725 726 - 727 728 729 730 731 732 733 734 735 736 737 738 739 740 - 741 742 743 744 745 746 747 748 749 750 751 752 753 754 - 755 756 757 758 759 760 761 762 763 764 765 766 767 768 - 769 770 771 772 773 774 775 776 777 778 779 780 781 782 - 783 784 785 786 787 788 789 790 791 792 793 794 795 796 - 797 798 799 800] - [ 801 802 803 804 805 806 807 808 809 810 811 812 813 814 - 815 816 817 818 819 820 821 822 823 824 825 826 827 828 - 829 830 831 832 833 834 835 836 837 838 839 840 841 842 - 843 844 845 846 847 848 849 850 851 852 853 854 855 856 - 857 858 859 860 861 862 863 864 865 866 867 868 869 870 - 871 872 873 874 875 876 877 878 879 880 881 882 883 884 - 885 886 887 888 889 890 891 892 893 894 895 896 897 898 - 899 900 901 902 903 904 905 906 907 908 909 910 911 912 - 913 914 915 916 917 918 919 920 921 922 923 924 925 926 - 927 928 929 930 931 932 933 934 935 936 937 938 939 940 - 941 942 943 944 945 946 947 948 949 950 951 952 953 954 - 955 956 957 958 959 960 961 962 963 964 965 966 967 968 - 969 970 971 972 973 974 975 976 977 978 979 980 981 982 - 983 984 985 986 987 988 989 990 991 992 993 994 995 996 - 997 998 999 1000]] - System`GraphicsComplex - System`NumericArray NumericArray[Real*, 3000×3] - [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] - [ 4.61779019e-01 2.22381055e-01 -1.11260467e-01] - [ 3.42617351e-01 4.29628570e-01 -2.16941870e-01] - ... - [ 3.42617351e-01 -4.29628570e-01 2.16941870e-01] - [ 4.61779019e-01 -2.22381055e-01 1.11260467e-01] - [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] - System`Line - System`NumericArray NumericArray[Integer*, 15×200] - [[ 1 16 31 ... 2956 2971 2986] - [ 2 17 32 ... 2957 2972 2987] - [ 3 18 33 ... 2958 2973 2988] - ... - [ 13 28 43 ... 2968 2983 2998] - [ 14 29 44 ... 2969 2984 2999] - [ 15 30 45 ... 2970 2985 3000]] - System`Rule - System`AlignmentPoint - System`Center - System`Rule - System`AspectRatio - System`Integer 1 - System`Rule - System`Axes - System`True - System`Rule - System`AxesEdge - System`Automatic - System`Rule - System`AxesLabel - System`None - System`Rule - System`AxesOrigin - System`Automatic - System`Rule - System`AxesStyle - System`List - System`Rule - System`Background - System`Automatic - System`Rule - System`BaseStyle - System`List - System`Rule - System`BaselinePosition - System`Automatic - System`Rule - System`BoxRatios - System`List - System`Integer 1 - System`Integer 1 - System`Real 0.4 - System`Rule - System`BoxStyle - System`List - System`Rule - System`Boxed - System`True - System`Rule - System`ClipPlanes - System`None - System`Rule - System`ClipPlanesStyle - System`Automatic - System`Rule - System`ContentSelectable - System`Automatic - System`Rule - System`ControllerLinking - System`False - System`Rule - System`ControllerPath - System`Automatic - System`Rule - System`CoordinatesToolOptions - System`Automatic - System`Rule - System`Epilog - System`List - System`Rule - System`FaceGrids - System`None - System`Rule - System`FaceGridsStyle - System`List - System`Rule - System`FormatType - System`TraditionalForm - System`Rule - System`Frame - System`False - System`Rule - System`FrameLabel - System`None - System`Rule - System`FrameStyle - System`List - System`Rule - System`FrameTicks - System`Automatic - System`Rule - System`FrameTicksStyle - System`List - System`Rule - System`GridLines - System`None - System`Rule - System`GridLinesStyle - System`List - System`Rule - System`ImageMargins - System`Real 0.0 - System`Rule - System`ImagePadding - System`All - System`Rule - System`ImageSize - System`Automatic - System`Rule - System`LabelStyle - System`List - System`Rule - System`Lighting - System`Automatic - System`Rule - System`LogPlot - System`False - System`Rule - System`Method - System`Automatic - System`Rule - System`PlotLabel - System`None - System`Rule - System`PlotRange - System`List - System`Automatic - System`Automatic - System`Automatic - System`Rule - System`PlotRangeClipping - System`False - System`Rule - System`PlotRangePadding - System`Automatic - System`Rule - System`PlotRegion - System`Automatic - System`Rule - System`PreserveImageOptions - System`Automatic - System`Rule - System`Prolog - System`List - System`Rule - System`RotateLabel - System`True - System`Rule - System`RotationAction - System`Fit - System`Rule - System`SphericalRegion - System`Automatic - System`Rule - System`Ticks - System`Automatic - System`Rule - System`TicksStyle - System`List - System`Rule - System`TouchscreenAutoZoom - System`False - System`Rule - System`ViewAngle - System`Automatic - System`Rule - System`ViewCenter - System`Automatic - System`Rule - System`ViewMatrix - System`Automatic - System`Rule - System`ViewPoint - System`List - System`Real 1.3 - System`Real -2.4 - System`Real 2.0 - System`Rule - System`ViewProjection - System`Automatic - System`Rule - System`ViewRange - System`All - System`Rule - System`ViewVector - System`Automatic - System`Rule - System`ViewVertical - System`List - System`Integer 0 - System`Integer 0 - System`Integer 1 diff --git a/test/builtin/drawing/vec_tests.yaml b/test/builtin/drawing/vec_tests.yaml index 035c0c801..63bc77a46 100644 --- a/test/builtin/drawing/vec_tests.yaml +++ b/test/builtin/drawing/vec_tests.yaml @@ -106,7 +106,7 @@ vec-parametricplot3d-rings: ] ] ' -vec-parametricplot-moebius: +vec-parametricplot3d-moebius: expr: ' ParametricPlot3D[ {(1 + (v/2) Cos[u/2]) Cos[u], From 17975c31ee1bd40290ee17a3c62556cc81bd16cd Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Sat, 3 Jan 2026 09:31:55 -0500 Subject: [PATCH 16/20] Formatting --- mathics/builtin/drawing/plot_plot3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index 341f81c37..37c0e42bc 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -289,7 +289,7 @@ class ParametricPlot3D(_Plot3D): >> ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] - + A function of two parameters $u$ and $v$ generates a torus. """ From 3b2e854da3f89baa4c22a6f710132689b1db7f1c Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Sat, 3 Jan 2026 10:16:58 -0500 Subject: [PATCH 17/20] Add test --- .gitignore | 2 +- .../vec-parametricplot3d-moebius-vec.txt | 318 ++++++++++++++++++ 2 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-moebius-vec.txt diff --git a/.gitignore b/.gitignore index 039c83dc8..a26b3ba0e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ ChangeLog.orig ChangeLog.rej Documents/ Homepage/ -Test/ +#Test/ _Copies_/ _Database_/ build/ diff --git a/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-moebius-vec.txt b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-moebius-vec.txt new file mode 100644 index 000000000..3422baf35 --- /dev/null +++ b/test/builtin/drawing/test_plot_detail_ref/vec-parametricplot3d-moebius-vec.txt @@ -0,0 +1,318 @@ +System`Graphics3D + System`List + System`RGBColor + System`Real 1.0 + System`Real 0.690196 + System`Real 0.0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 40000×3] + [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] + [ 4.99813069e-01 1.57862418e-02 -7.89312101e-03] + [ 4.99252135e-01 3.15685419e-02 -1.57842749e-02] + ... + [ 4.99252135e-01 -3.15685419e-02 1.57842749e-02] + [ 4.99813069e-01 -1.57862418e-02 7.89312101e-03] + [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] + System`Polygon + System`NumericArray NumericArray[Integer*, 39601×4] + [[ 1 2 202 201] + [ 201 202 402 401] + [ 401 402 602 601] + ... + [39399 39400 39600 39599] + [39599 39600 39800 39799] + [39799 39800 40000 39999]] + System`RGBColor + System`Integer 0 + System`Integer 0 + System`Integer 0 + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 1000×3] + [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] + [ 4.99813069e-01 1.57862418e-02 -7.89312101e-03] + [ 4.99252135e-01 3.15685419e-02 -1.57842749e-02] + ... + [ 4.99252135e-01 -3.15685419e-02 1.57842749e-02] + [ 4.99813069e-01 -1.57862418e-02 7.89312101e-03] + [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] + System`Line + System`NumericArray NumericArray[Integer*, 5×200] + [[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + 15 16 17 18 19 20 21 22 23 24 25 26 27 28 + 29 30 31 32 33 34 35 36 37 38 39 40 41 42 + 43 44 45 46 47 48 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 65 66 67 68 69 70 + 71 72 73 74 75 76 77 78 79 80 81 82 83 84 + 85 86 87 88 89 90 91 92 93 94 95 96 97 98 + 99 100 101 102 103 104 105 106 107 108 109 110 111 112 + 113 114 115 116 117 118 119 120 121 122 123 124 125 126 + 127 128 129 130 131 132 133 134 135 136 137 138 139 140 + 141 142 143 144 145 146 147 148 149 150 151 152 153 154 + 155 156 157 158 159 160 161 162 163 164 165 166 167 168 + 169 170 171 172 173 174 175 176 177 178 179 180 181 182 + 183 184 185 186 187 188 189 190 191 192 193 194 195 196 + 197 198 199 200] + [ 201 202 203 204 205 206 207 208 209 210 211 212 213 214 + 215 216 217 218 219 220 221 222 223 224 225 226 227 228 + 229 230 231 232 233 234 235 236 237 238 239 240 241 242 + 243 244 245 246 247 248 249 250 251 252 253 254 255 256 + 257 258 259 260 261 262 263 264 265 266 267 268 269 270 + 271 272 273 274 275 276 277 278 279 280 281 282 283 284 + 285 286 287 288 289 290 291 292 293 294 295 296 297 298 + 299 300 301 302 303 304 305 306 307 308 309 310 311 312 + 313 314 315 316 317 318 319 320 321 322 323 324 325 326 + 327 328 329 330 331 332 333 334 335 336 337 338 339 340 + 341 342 343 344 345 346 347 348 349 350 351 352 353 354 + 355 356 357 358 359 360 361 362 363 364 365 366 367 368 + 369 370 371 372 373 374 375 376 377 378 379 380 381 382 + 383 384 385 386 387 388 389 390 391 392 393 394 395 396 + 397 398 399 400] + [ 401 402 403 404 405 406 407 408 409 410 411 412 413 414 + 415 416 417 418 419 420 421 422 423 424 425 426 427 428 + 429 430 431 432 433 434 435 436 437 438 439 440 441 442 + 443 444 445 446 447 448 449 450 451 452 453 454 455 456 + 457 458 459 460 461 462 463 464 465 466 467 468 469 470 + 471 472 473 474 475 476 477 478 479 480 481 482 483 484 + 485 486 487 488 489 490 491 492 493 494 495 496 497 498 + 499 500 501 502 503 504 505 506 507 508 509 510 511 512 + 513 514 515 516 517 518 519 520 521 522 523 524 525 526 + 527 528 529 530 531 532 533 534 535 536 537 538 539 540 + 541 542 543 544 545 546 547 548 549 550 551 552 553 554 + 555 556 557 558 559 560 561 562 563 564 565 566 567 568 + 569 570 571 572 573 574 575 576 577 578 579 580 581 582 + 583 584 585 586 587 588 589 590 591 592 593 594 595 596 + 597 598 599 600] + [ 601 602 603 604 605 606 607 608 609 610 611 612 613 614 + 615 616 617 618 619 620 621 622 623 624 625 626 627 628 + 629 630 631 632 633 634 635 636 637 638 639 640 641 642 + 643 644 645 646 647 648 649 650 651 652 653 654 655 656 + 657 658 659 660 661 662 663 664 665 666 667 668 669 670 + 671 672 673 674 675 676 677 678 679 680 681 682 683 684 + 685 686 687 688 689 690 691 692 693 694 695 696 697 698 + 699 700 701 702 703 704 705 706 707 708 709 710 711 712 + 713 714 715 716 717 718 719 720 721 722 723 724 725 726 + 727 728 729 730 731 732 733 734 735 736 737 738 739 740 + 741 742 743 744 745 746 747 748 749 750 751 752 753 754 + 755 756 757 758 759 760 761 762 763 764 765 766 767 768 + 769 770 771 772 773 774 775 776 777 778 779 780 781 782 + 783 784 785 786 787 788 789 790 791 792 793 794 795 796 + 797 798 799 800] + [ 801 802 803 804 805 806 807 808 809 810 811 812 813 814 + 815 816 817 818 819 820 821 822 823 824 825 826 827 828 + 829 830 831 832 833 834 835 836 837 838 839 840 841 842 + 843 844 845 846 847 848 849 850 851 852 853 854 855 856 + 857 858 859 860 861 862 863 864 865 866 867 868 869 870 + 871 872 873 874 875 876 877 878 879 880 881 882 883 884 + 885 886 887 888 889 890 891 892 893 894 895 896 897 898 + 899 900 901 902 903 904 905 906 907 908 909 910 911 912 + 913 914 915 916 917 918 919 920 921 922 923 924 925 926 + 927 928 929 930 931 932 933 934 935 936 937 938 939 940 + 941 942 943 944 945 946 947 948 949 950 951 952 953 954 + 955 956 957 958 959 960 961 962 963 964 965 966 967 968 + 969 970 971 972 973 974 975 976 977 978 979 980 981 982 + 983 984 985 986 987 988 989 990 991 992 993 994 995 996 + 997 998 999 1000]] + System`GraphicsComplex + System`NumericArray NumericArray[Real*, 3000×3] + [[ 5.00000000e-01 0.00000000e+00 -0.00000000e+00] + [ 4.61779019e-01 2.22381055e-01 -1.11260467e-01] + [ 3.42617351e-01 4.29628570e-01 -2.16941870e-01] + ... + [ 3.42617351e-01 -4.29628570e-01 2.16941870e-01] + [ 4.61779019e-01 -2.22381055e-01 1.11260467e-01] + [ 5.00000000e-01 -1.22464680e-16 6.12323400e-17]] + System`Line + System`NumericArray NumericArray[Integer*, 15×200] + [[ 1 16 31 ... 2956 2971 2986] + [ 2 17 32 ... 2957 2972 2987] + [ 3 18 33 ... 2958 2973 2988] + ... + [ 13 28 43 ... 2968 2983 2998] + [ 14 29 44 ... 2969 2984 2999] + [ 15 30 45 ... 2970 2985 3000]] + System`Rule + System`AlignmentPoint + System`Center + System`Rule + System`AspectRatio + System`Integer 1 + System`Rule + System`Axes + System`True + System`Rule + System`AxesEdge + System`Automatic + System`Rule + System`AxesLabel + System`None + System`Rule + System`AxesOrigin + System`Automatic + System`Rule + System`AxesStyle + System`List + System`Rule + System`Background + System`Automatic + System`Rule + System`BaseStyle + System`List + System`Rule + System`BaselinePosition + System`Automatic + System`Rule + System`BoxRatios + System`List + System`Integer 1 + System`Integer 1 + System`Real 0.4 + System`Rule + System`BoxStyle + System`List + System`Rule + System`Boxed + System`True + System`Rule + System`ClipPlanes + System`None + System`Rule + System`ClipPlanesStyle + System`Automatic + System`Rule + System`ContentSelectable + System`Automatic + System`Rule + System`ControllerLinking + System`False + System`Rule + System`ControllerPath + System`Automatic + System`Rule + System`CoordinatesToolOptions + System`Automatic + System`Rule + System`Epilog + System`List + System`Rule + System`FaceGrids + System`None + System`Rule + System`FaceGridsStyle + System`List + System`Rule + System`FormatType + System`TraditionalForm + System`Rule + System`Frame + System`False + System`Rule + System`FrameLabel + System`None + System`Rule + System`FrameStyle + System`List + System`Rule + System`FrameTicks + System`Automatic + System`Rule + System`FrameTicksStyle + System`List + System`Rule + System`GridLines + System`None + System`Rule + System`GridLinesStyle + System`List + System`Rule + System`ImageMargins + System`Real 0.0 + System`Rule + System`ImagePadding + System`All + System`Rule + System`ImageSize + System`Automatic + System`Rule + System`LabelStyle + System`List + System`Rule + System`Lighting + System`Automatic + System`Rule + System`LogPlot + System`False + System`Rule + System`Method + System`Automatic + System`Rule + System`PlotLabel + System`None + System`Rule + System`PlotRange + System`List + System`Automatic + System`Automatic + System`Automatic + System`Rule + System`PlotRangeClipping + System`False + System`Rule + System`PlotRangePadding + System`Automatic + System`Rule + System`PlotRegion + System`Automatic + System`Rule + System`PreserveImageOptions + System`Automatic + System`Rule + System`Prolog + System`List + System`Rule + System`RotateLabel + System`True + System`Rule + System`RotationAction + System`Fit + System`Rule + System`SphericalRegion + System`Automatic + System`Rule + System`Ticks + System`Automatic + System`Rule + System`TicksStyle + System`List + System`Rule + System`TouchscreenAutoZoom + System`False + System`Rule + System`ViewAngle + System`Automatic + System`Rule + System`ViewCenter + System`Automatic + System`Rule + System`ViewMatrix + System`Automatic + System`Rule + System`ViewPoint + System`List + System`Real 1.3 + System`Real -2.4 + System`Real 2.0 + System`Rule + System`ViewProjection + System`Automatic + System`Rule + System`ViewRange + System`All + System`Rule + System`ViewVector + System`Automatic + System`Rule + System`ViewVertical + System`List + System`Integer 0 + System`Integer 0 + System`Integer 1 From 939ae8a8ac2733cd07e86f4d87715d18b2fe0bf1 Mon Sep 17 00:00:00 2001 From: Bruce Lucas Date: Sat, 3 Jan 2026 11:44:06 -0500 Subject: [PATCH 18/20] Update plot_plot3d.py --- mathics/builtin/drawing/plot_plot3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index 37c0e42bc..b271c391e 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -268,8 +268,8 @@ class DensityPlot(_Plot3D): class ParametricPlot3D(_Plot3D): """ - :WMA link: https://reference.wolfram.com/language/ref/ParametricPlot3D.html :Parametric equation: https://en.wikipedia.org/wiki/Parametric_equation + :WMA link: https://reference.wolfram.com/language/ref/ParametricPlot3D.html
'ParametricPlot3D'[${x(u,v), y(u,v), z(u,v)}$, {$u$, $u_{min}$, $u_{max}$}, {$v$, $v_{min}$, $v_{max}$}]
creates a three-dimensional surface using the functions $x$, $y$, $z$ over the specified ranges for parameters $u$ and $v$. From ce2cfc6943910c7caa265f4198cf93a0057131fe Mon Sep 17 00:00:00 2001 From: Juan Mauricio Matera Date: Sat, 10 Jan 2026 14:34:14 -0300 Subject: [PATCH 19/20] Apply suggestion from @mmatera --- mathics/builtin/drawing/plot_plot3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index b271c391e..55b8a76ae 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -288,7 +288,7 @@ class ParametricPlot3D(_Plot3D): A function of a single parameter $t$ generates a trefoil knot. >> ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] - = ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}] + = ... A function of two parameters $u$ and $v$ generates a torus. From 55d4a14318273ec8b1cfeb6933ef2e282065eed5 Mon Sep 17 00:00:00 2001 From: Juan Mauricio Matera Date: Sat, 10 Jan 2026 14:34:46 -0300 Subject: [PATCH 20/20] Apply suggestion from @mmatera --- mathics/builtin/drawing/plot_plot3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathics/builtin/drawing/plot_plot3d.py b/mathics/builtin/drawing/plot_plot3d.py index 55b8a76ae..5a7fc81e8 100644 --- a/mathics/builtin/drawing/plot_plot3d.py +++ b/mathics/builtin/drawing/plot_plot3d.py @@ -283,7 +283,7 @@ class ParametricPlot3D(_Plot3D):
>> ParametricPlot3D[{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, {t, 0, 2 Pi}] - = ParametricPlot3D[{Sin[t] + 2 Sin[2 t], Cos[t] - 2 Cos[2 t], -Sin[3 t]}, {t, 0, 2 Pi}] + = ... A function of a single parameter $t$ generates a trefoil knot.