BLITZ MATH 3D -- USER MANUAL ============================ Version 1.0. Authors: Olivier Landemarre & Claude AI opus 5.5. Blitz Math 3D draws curves, surfaces and volumes described by formulas, in three dimensions. You type a formula, choose the domain, and the object appears in a GEM window, where you turn it with the mouse, set the light, the colors, a section... before saving your document or exporting the image. Contents: 1. Installation and versions 2. Getting started 3. The object window 4. Writing a formula 5. Document types, with examples 6. The menus 7. The settings boxes 8. Variables and animation 9. Saving, exporting, exchanging 10. The command line 11. Example documents 12. Tips and frequently asked questions 1. INSTALLATION AND VERSIONS ============================ The files --------- * MATH3D.PRG Role : the full version, for a 68030 or better with a coprocessor (FPU) * MATH3D60.PRG Role : the same full version, for the 68060 (CT60, CT63, Hades, Milan...) * MATH3DCF.PRG Role : the same full version, for the ColdFire V4e of the FireBee * MATH3DL.PRG Role : the light version, for a 68000 without coprocessor * MATH3D.RSC Role : the resource (menus, boxes, texts), in French * RSRC\MATH3D.RSC Role : the resource in the other languages * EXAMPLES\ Role : example documents, 8.3 names for TOS (section 11) * EX_LONG\ Role : the same, with their original names (MiNT, MagiC, Linux) * MANUAL.TXT, MANUAL.PDF Role : this manual; MANUEL.TXT and MANUEL.PDF in French * LISEZMOI.TXT Role : the content of the archive, in short Copy everything into one folder, keeping MATH3D.RSC and the RSRC folder next to the programs. At startup, the program takes the resource of the system language (English, German, Spanish, Portuguese, Catalan, Italian, Dutch, Swedish, Norwegian, Danish, Finnish, Czech, Hungarian, Polish, Romanian, Greek) if it is in RSRC, otherwise MATH3D.RSC, in French. This manual uses the names of the English resource. The language comes from the AES. MyAES follows the country code saved in the NVRAM (and loads the resource of that code by itself); XaAES, the one of its configuration. Portuguese (code 35) and Catalan (54) are thus picked up automatically there. TOS and EmuTOS do not report the language: to force one, copy its resource over MATH3D.RSC, for example RSRC\MATH3D0.RSC for US English or RSRC\MATH3D35.RSC for Portuguese. Czech, Hungarian, Polish, Romanian and Greek are written in the system font of their country (Kamenicky, Latin-2, Greek), the one a machine set up for that country has. Copied onto a machine with the Western European font, these resources would show wrong letters. The program writes a small file next to itself, MATH3D.CFG: the list of recent files. Which version? -------------- * Processor MATH3D.PRG (full) : 68030 or better, with FPU (Falcon + 68882, TT, CT60, V4SA...) MATH3DL.PRG (light) : any Atari, 68000 included (ST, STE, Mega ST, basic Falcon) * Memory MATH3D.PRG (full) : 2 MB minimum MATH3DL.PRG (light) : 2 MB minimum * Screens MATH3D.PRG (full) : from monochrome to True Color MATH3DL.PRG (light) : from monochrome to 256 colors, Falcon 16 bits (not the 24 and 32-bit modes nor the Intel byte order of graphics cards) * Computing MATH3D.PRG (full) : in floating point MATH3DL.PRG (light) : in fixed point for interaction, fast without FPU On a 68060 (Falcon with CT60 or CT63, Hades, Milan...), take MATH3D60.PRG: the full version compiled for that processor. The 68060 no longer has some coprocessor instructions in hardware (sine, exponential, logarithm...): MATH3D60.PRG computes them itself, without going through the system's slow emulation. On a 68060, MATH3D.PRG also works, but more slowly. On the FireBee, take MATH3DCF.PRG: it is the full version, compiled for its ColdFire V4e processor and its coprocessor. It does everything MATH3D.PRG does, command line included. The light version does everything needed to draw the "classic" curves and surfaces: explicit, parametric, polar, cylindrical, spherical curves, meridians; parametric, spherical, revolution surfaces, graphs; implicit curves and isosurfaces; tubes; solid faces and wireframe. Only in the full version: differential equations, phase portraits, complex functions, vector fields, conformal maps, STL objects; color by curvature, contour lines, critical points, geodesics, Frenet frames, field lines, section by a plane, several isosurfaces; Measures, Variables, Animate a variable; the sum() function; the SAGA overlay of the V4SA. In the light version, fog, specular highlights and smooth shading are greyed out (too slow without FPU). A document coming from the full version that uses them still opens: the option stays available, so that you can switch it off. Both versions read and write the same document format (.ARG). Systems ------- TOS, EmuTOS, MagiC, MiNT with XaAES or MyAES. The settings boxes open in windows where the AES allows it (AES 4.1 and later), and as modal boxes elsewhere. 2. GETTING STARTED ================== Your first object, a saddle: 1. Start the program, then File > New. 2. In the Surfaces column, choose Graph z = f(x,y). 3. The domain offers x from -2 to 2, 32 points and the same for y: keep it. Click Create. 4. A plane appears (the starting formula is 0). Choose Object > Formulas..., type x*x-y*y and confirm. 5. Drag the mouse in the window with the left button held down: the object turns. With Shift held down, dragging zooms. 6. Render > Colors...: type orange in Object, confirm. 7. File > Save as...: your document is a .ARG file. Each document type starts with a neutral formula (a plane, a circle, a sphere...) that you then replace with your own: it is the simplest way to see at once what the domain covers. 3. THE OBJECT WINDOW ==================== * drag, left button Effect : turns the object * Shift + drag Effect : zooms * mouse wheel (if the mouse has one and the system passes it on) Effect : zooms * right button Effect : opens the context menu * Undo / Ctrl+Z Effect : undoes the last change * Shift+Undo / Ctrl+Y Effect : redoes * Ctrl+C Effect : copies the image to the clipboard While you turn the object, the window shows a preview (wireframe, or solid faces if Window > Solid preview is checked); the final image is computed when you release the button. The context menu (right button) ------------------------------- - Save: TGA image, .args document, .obj mesh. - Display: wireframe, highlights (Specular), fog, Phong shading, ground shadow (Shading), finer mesh (Mesh +) or coarser mesh (Mesh -), and for the SAGA overlay: 8-bit CLUT, orientation palette. - Effect: the palette effects of the V4SA SAGA overlay (light wave, moving highlight, moving shadow, hue, soft pulse, palette rotation). - Reset view: back to the starting camera. - Object color, Background: a few colors in one click. 4. WRITING A FORMULA ==================== Operators --------- Notation Meaning --------------- ---------------------------------- + - * / the four operations ^ power: x^2, 2^x, x^0.5 % remainder of the division ( ) parentheses < <= > >= == != comparisons: 1 if true, 0 if false Numbers are written with a decimal point: 0.5, 6.283185, 1e-3. Functions --------- * sin cos tan Meaning : trigonometry, angles in radians * asin acos atan Meaning : inverse functions * atan2(y, x) Meaning : angle of the point (x, y), from -ã to ã * sinh cosh tanh Meaning : hyperbolic functions * exp Meaning : exponential * ln Meaning : natural logarithm * log, log10 Meaning : base-10 logarithm * sqrt Meaning : square root * abs Meaning : absolute value * floor, ceil Meaning : round down, round up * pow(a, b) Meaning : a to the power b * fac(n) Meaning : factorial * ncr(n, k), npr(n, k) Meaning : combinations, permutations * min(a, b), max(a, b) Meaning : the smaller, the larger * sign(x) Meaning : -1, 0 or 1 * mod(a, b) Meaning : remainder of a by b * hypot(a, b) Meaning : û(aý + bý) * if(c, a, b) Meaning : a if c is true (non-zero), otherwise b * sum(k, start, end, term) Meaning : sum of term for integer k from start to end (full version) Constants: pi (3.14159...) and e (2.71828...). Examples -------- * sqrt(x*x+y*y) Meaning : distance to the origin * if(x*x+y*y<1, sqrt(1-x*x-y*y), 0) Meaning : a half-sphere standing on a plane * min(x, 1) Meaning : x, capped at 1 * abs(sin(3*t)) Meaning : a "bouncing" sine wave * sum(k,1,8,sin((2*k-1)*x)/(2*k-1)) Meaning : Fourier series of a square wave, 8 terms Pitfalls -------- - -x^2 means (-x)^2, that is +xý. For -xý, write -(x^2) or 0-x^2. Likewise exp(-x^2) means exp(xý): write exp(-(x^2)) or exp(-x*x). - Multiplication is always written: 2*x, not 2x; x*y, not xy. - Angles are in radians: a full turn is 6.283185 (2ã), half a turn 3.141593. In the domain fields, type the number (pi is not read there). - A division by zero or the square root of a negative number gives an impossible value: the point is dropped (the surface has a hole). Guard against it with if, for example if(r>0, sin(r)/r, 1). - For sum, the bounds are integers written as digits, and the sum has at most 1000 terms. Document variables ------------------ In the full version, Object > Variables... defines up to six variables (R = 4, r = 1.5...) usable in all formulas and in the section plane. See section 8. 5. DOCUMENT TYPES, WITH EXAMPLES ================================ Each type has its formulas, its variables and its domain. The domain is given in lines "from ... to ... points": the bounds and the number of computed points (more points: finer, but slower). Useful values: 2ã = 6.283185, ã = 3.141593, ã/2 = 1.570796, 4ã = 12.566371, 6ã = 18.849556. Types marked (*) exist only in the full version. 5.1 Curves ---------- > Explicit curve -- y(x), z(x) Two formulas in x; the curve goes through (x, y(x), z(x)). Domain: x. Put 0 in z for a plane curve. Curve y(x) z(x) domain x ------------- ------------------ ---------- ------------------- damped sine exp(-x/4)*sin(3*x) 0 0 to 12.566371, 400 Gaussian bell exp(-x*x) 0 -3 to 3, 200 space curve sin(x) cos(2*x)/2 0 to 6.283185, 300 > Parametric curve -- x(t), y(t), z(t) Three formulas in t. Domain: t. * helix x(t) : cos(t) y(t) : sin(t) z(t) : t/4 domain t : 0 to 18.849556, 400 * trefoil knot x(t) : sin(t)+2*sin(2*t) y(t) : cos(t)-2*cos(2*t) z(t) : -sin(3*t) domain t : 0 to 6.283185, 400 * Viviani's curve x(t) : 1+cos(t) y(t) : sin(t) z(t) : 2*sin(t/2) domain t : 0 to 12.566371, 400 * 3D Lissajous x(t) : sin(3*t) y(t) : sin(4*t) z(t) : sin(5*t) domain t : 0 to 6.283185, 600 * torus knot (2, 5) x(t) : (2+cos(5*t))*cos(2*t) y(t) : (2+cos(5*t))*sin(2*t) z(t) : sin(5*t) domain t : 0 to 6.283185, 600 > Polar curve -- r(t) One formula in t: the point at distance r(t) from the origin, in direction t, in a horizontal plane. Domain: t, plus the height of the plane (z plane). * circle r(t) : 1 domain t : 0 to 6.283185 * cardioid r(t) : 1+cos(t) domain t : 0 to 6.283185 * 5-petal rose r(t) : cos(5*t) domain t : 0 to 3.141593 * Archimedean spiral r(t) : t/6 domain t : 0 to 18.849556 * logarithmic spiral r(t) : exp(t/8) domain t : 0 to 18.849556 * Fay's butterfly r(t) : exp(sin(t))-2*cos(4*t)+sin((2*t-pi)/24)^5 domain t : 0 to 75.398224, 2000 Front view: Render > Camera..., yaw 0 and pitch 0. > Cylindrical curve -- r(t), z(t) Two formulas in t: distance r(t) to the vertical axis and height z(t), in direction t. Curve r(t) z(t) domain t ------------------------- ---- ------------ -------------- helix 1 t/4 0 to 18.849556 conical spiral t/6 t/6 0 to 18.849556 wavy crown 1 0.2*sin(8*t) 0 to 6.283185 spring with growing pitch 1 t*t/40 0 to 25.132741 > Spherical curve -- r(t), theta(t), phi(t) Three formulas in t: distance to the origin, angle from the pole (theta, from 0 to ã) and longitude (phi). * equator r(t) : 1 theta(t) : 1.570796 phi(t) : t domain t : 0 to 6.283185 * clelia r(t) : 1 theta(t) : t phi(t) : 8*t domain t : 0 to 3.141593, 600 * loxodrome r(t) : 1 theta(t) : pi-2*atan(exp(t/6)) phi(t) : t domain t : -30 to 30, 1500 * spiral on a growing sphere r(t) : t/6 theta(t) : t/2 phi(t) : 4*t domain t : 0 to 6.283185 > Meridian -- r(u) One formula in u: the profile of a surface of revolution, drawn as a curve (the point at distance r(u) from the axis, at height u). Domain u, plus the angle of the meridian; checkbox x axis (else z). It is the curve that the surface of revolution (5.2) turns around the axis. Profile r(u) domain u ------- ------------------- -------- vase 1+0.3*sin(3*u) -1 to 1 cone u 0 to 1 drop sqrt(1-u*u)*(1-u)/2 -1 to 1 > Tube and Frenet frame A curve can be drawn as a tube: it is an option of the document (--tube on its line, see section 9 and the examples FRENET.ARG, NOEUDTOR.ARG). In the full version, Render > Overlays... adds Frenet frames (tangent, normal, binormal) along the curve, and Render > Colors... the color by curvature or by torsion. > (*) Differential equation -- x', y', z' Three formulas in x, y, z, t: the derivatives dx/dt, dy/dt, dz/dt. The program follows the solution from a starting point (the start line of the domain), with the fourth-order Runge-Kutta method. Domain: t (duration and number of steps). * circle dx/dt : -y dy/dt : x dz/dt : 0 t : 0 to 6.283185, 200 start : 1, 0, 0 * helix dx/dt : -y dy/dt : x dz/dt : 0.2 t : 0 to 31.4, 800 start : 1, 0, 0 * Lorenz attractor dx/dt : 10*(y-x) dy/dt : x*(28-z)-y dz/dt : x*y-8/3*z t : 0 to 40, 4000 start : 1, 1, 1 * R”ssler attractor dx/dt : -y-z dy/dt : x+0.2*y dz/dt : 0.2+z*(x-5.7) t : 0 to 150, 6000 start : 1, 1, 0 * damped spiral dx/dt : -0.1*x-y dy/dt : x-0.1*y dz/dt : 0 t : 0 to 40, 800 start : 2, 0, 0 If the trajectory looks angular, increase the number of steps. > (*) Phase portrait -- x', y' Two formulas in x, y, t: dx/dt and dy/dt in the plane. One trajectory starts from each point of a grid (the x and y lines of the domain) and lasts the time of the t line; it stops at the edge of the window. * center (circles) dx/dt : -y dy/dt : x x : -2 to 2, 5 y : -2 to 2, 5 t : 0 to 6.283185, 100 * pendulum dx/dt : y dy/dt : -sin(x) x : -6 to 6, 13 y : -3 to 3, 7 t : 0 to 10, 200 * Van der Pol dx/dt : y dy/dt : (1-x*x)*y-x x : -3 to 3, 7 y : -3 to 3, 7 t : 0 to 20, 400 * saddle dx/dt : x dy/dt : -y x : -2 to 2, 9 y : -2 to 2, 9 t : 0 to 3, 100 > (*) Vector field -- Fx, Fy, Fz Three formulas in x, y, z: one arrow at each point of a grid (three domain lines; a line of a single point gives a plane). In Render > Overlays..., Field lines draws the lines that follow the field instead of the arrows. * rising vortex Fx : -y Fy : x Fz : 0.3 grid : -1 to 1 (5, 5, 3) * source Fx : x Fy : y Fz : z grid : -1 to 1 (5, 5, 5) * pendulum (plane) Fx : y Fy : -sin(x) Fz : 0 grid : x -4 to 4 (9), y -2.5 to 2.5 (7), z 0 to 0 (1) * Lorenz Fx : 10*(y-x) Fy : x*(28-z)-y Fz : x*y-8/3*z grid : -20 to 20, -25 to 25, 5 to 45 (7 each) > (*) Conformal map -- Re w, Im w Two formulas in x, y: the real part and the imaginary part of w = f(x + iy). The program draws the image by f of the vertical (orange) and horizontal (blue) lines of the domain grid. Right angles are preserved: this is what is called a conformal map. * zý Re w : x*x-y*y Im w : 2*x*y x : 0.2 to 1.2, 11 y : -1 to 1, 11 * exp z Re w : exp(x)*cos(y) Im w : exp(x)*sin(y) x : -1 to 1, 9 y : -3.141593 to 3.141593, 25 * 1/z Re w : x/(x*x+y*y) Im w : -y/(x*x+y*y) x : 0.5 to 2, 11 y : -1 to 1, 11 * zþ Re w : x^3-3*x*y*y Im w : 3*x*x*y-y^3 x : 0.2 to 1.2, 11 y : -1 to 1, 11 A front view is advised (yaw 0, pitch 0). 5.2 Surfaces ------------ > Parametric surface -- x(u,v), y(u,v), z(u,v) Three formulas in u and v. Domain: u and v. * plane x(u,v) : u y(u,v) : v z(u,v) : 0 u : -2 to 2 v : -2 to 2 * saddle x(u,v) : u y(u,v) : v z(u,v) : u*u-v*v u : -2 to 2 v : -2 to 2 * sphere x(u,v) : cos(u)*sin(v) y(u,v) : sin(u)*sin(v) z(u,v) : cos(v) u : 0 to 6.283185 v : 0 to 3.141593 * torus x(u,v) : (2+cos(v))*cos(u) y(u,v) : (2+cos(v))*sin(u) z(u,v) : sin(v) u : 0 to 6.283185 v : 0 to 6.283185 * M”bius strip x(u,v) : (1+v/2*cos(u/2))*cos(u) y(u,v) : (1+v/2*cos(u/2))*sin(u) z(u,v) : v/2*sin(u/2) u : 0 to 6.283185, 60 v : -1 to 1, 10 * helicoid x(u,v) : v*cos(u) y(u,v) : v*sin(u) z(u,v) : u/2 u : 0 to 12.566371 v : -1 to 1 * Enneper surface x(u,v) : u-u^3/3+u*v*v y(u,v) : v-v^3/3+v*u*u z(u,v) : u*u-v*v u : -2 to 2 v : -2 to 2 * seashell x(u,v) : 2*(1-exp(u/18.849556))*cos(u)*cos(v/2)^2 y(u,v) : 2*(exp(u/18.849556)-1)*sin(u)*cos(v/2)^2 z(u,v) : 1-exp(u/9.424778)-sin(v)+exp(u/18.849556)*sin(v) u : 0 to 18.849556, 80 v : 0 to 6.283185, 24 * pretzel (example) x(u,v) : (4+1.5*cos(u)+4*cos(v*0.5)^2)*cos(2*v) y(u,v) : (4+1.5*cos(u)+4*cos(v*0.5)^2)*sin(2*v) z(u,v) : 1.5*sin(u)+4*sin(v) u : 0 to 6.283185, 40 v : 0 to 6.283185, 40 > Spherical surface -- r(theta, phi) One formula in theta (angle from the pole, from 0 to ã) and phi (longitude, from 0 to 2ã): the distance to the origin in each direction. Surface r(theta, phi) ----------------- ----------------------------------- sphere 1 bumpy sphere 1+0.25*sin(3*phi)*sin(theta) flower 1+0.3*sin(5*phi)*sin(theta)^2 harmonic (lobes) abs(cos(theta))+0.3 prolate ellipsoid 1/sqrt(sin(theta)^2+cos(theta)^2/4) Advised domain: theta 0 to 3.141593 (24 to 40 points), phi 0 to 6.283185 (twice as many points). > Surface of revolution -- r(u) One formula in u: the meridian turns around the axis (z by default, x if the x axis checkbox is checked). Domain: u (along the axis) and v (the angle, usually 0 to 2ã). Surface r(u) u ---------------- -------------- ------- cylinder 1 -1 to 1 cone u 0 to 1 paraboloid sqrt(u) 0 to 2 hyperboloid sqrt(1+u*u) -2 to 2 vase 1+0.3*sin(3*u) -1 to 1 sphere sqrt(1-u*u) -1 to 1 torus (one half) 2+sqrt(1-u*u) -1 to 1 > Graph -- z = f(x, y) One formula in x and y, the height. Domain: x and y. * saddle z(x, y) : x*x-y*y domain : -2 to 2 * paraboloid z(x, y) : x*x+y*y domain : -2 to 2 * bell z(x, y) : exp(-x*x-y*y) domain : -2 to 2 * waves z(x, y) : sin(x)*cos(y) domain : -6 to 6, 60 * circular ripples z(x, y) : cos(3*sqrt(x*x+y*y))/(1+x*x+y*y) domain : -4 to 4, 60 * sombrero z(x, y) : if(x*x+y*y>0, sin(3*sqrt(x*x+y*y))/(3*sqrt(x*x+y*y)), 1) domain : -4 to 4, 60 * half-sphere z(x, y) : if(x*x+y*y<1, sqrt(1-x*x-y*y), 0) domain : -1.5 to 1.5, 40 * monkey saddle z(x, y) : x^3-3*x*y*y domain : -1 to 1 * two bumps z(x, y) : exp(-x*x-y*y)*cos(2*x)+0.4*exp(-((x-1.2)^2+(y+0.8)^2)) domain : -2.5 to 2.5, 60 The graph is ideal for contour lines and critical points (full version, Render > Overlays...). > (*) Complex function -- w = f(x + iy) Two formulas in x and y: the real part and the imaginary part of w. The height is the modulus |w| (capped), the color the argument (red for positive reals, then the whole hue circle): you see the zeros (the modulus touches 0 and all colors meet there) and the poles (the modulus rises to the cap). f(z) Re w Im w --------------------------- ---------------- -------------- z x y zý x*x-y*y 2*x*y zþ - 1 (domain -1.5 to 1.5) x^3-3*x*y*y-1 3*x*x*y-y^3 1/z x/(x*x+y*y) -y/(x*x+y*y) exp z exp(x)*cos(y) exp(x)*sin(y) sin z sin(x)*cosh(y) cos(x)*sinh(y) (zý - 1)/(zý + 1) see COMPLEXE.ARG Advised domain: -2 to 2 in x and in y, 32 to 48 points. 5.3 Implicit objects -------------------- An implicit curve or surface is the set of points where a formula equals zero: x^2+y^2-1 gives the unit circle. The program looks for this zero on a grid: the domain must contain the object, and more points give a finer drawing. > Contour -- f(x, y) = 0 One formula in x and y. Domain: x and y, plus the height of the plane. Curve f(x, y) domain ----------------------- ----------------------- --------------- circle x^2+y^2-1 -2 to 2, 40 ellipse x^2/4+y^2-1 -2.5 to 2.5, 40 lemniscate of Bernoulli (x*x+y*y)^2-2*(x*x-y*y) -2 to 2, 60 folium of Descartes x^3+y^3-3*x*y -3 to 3, 60 cardioid (x*x+y*y-x)^2-(x*x+y*y) -1 to 2.5, 60 heart curve (x*x+y*y-1)^3-x*x*y^3 -1.5 to 1.5, 60 periodic pattern sin(x)*sin(y)-0.2 -6 to 6, 80 > Slice -- f(x, y, z) = 0 in a plane One formula in x, y, z; the program draws the curve where the surface f = 0 cuts a plane where one coordinate is constant (axis: x, y or z, and its value). The two domain lines are those of the two other axes. * equator of the sphere f(x, y, z) : x^2+y^2+z^2-1 slice : z = 0 * smaller circle f(x, y, z) : x^2+y^2+z^2-1 slice : z = 0.6 * hyperbola of a saddle f(x, y, z) : x*x-y*y-z slice : z = 0.5 * slice of a torus f(x, y, z) : (x*x+y*y+z*z+3)^2-16*(x*x+y*y) slice : y = 0 (domain -3.5 to 3.5) > Intersection -- f = 0 and g = 0 Two formulas in x, y, z: the curve common to both surfaces. Domain: x, y, z. Curve f g domain --------------- ------------- ------------- --------------- equator x^2+y^2+z^2-1 z -1.5 to 1.5, 24 Viviani's curve x^2+y^2+z^2-4 (x-1)^2+y^2-1 -2.2 to 2.2, 32 two cylinders x*x+z*z-1 y*y+z*z-1 -1.5 to 1.5, 32 tilted circle x^2+y^2+z^2-1 x+y+z -1.5 to 1.5, 32 > Isosurface -- f(x, y, z) = 0 One formula in x, y, z: the closed surface where f is zero. Domain: x, y, z. This is the slowest type to compute: start with 20 points per axis, then go up. * sphere f(x, y, z) : x^2+y^2+z^2-1 domain : -1.5 to 1.5, 20 * ellipsoid f(x, y, z) : x^2/4+y^2+z^2-1 domain : x -2.5 to 2.5, y and z -1.5 to 1.5 * torus f(x, y, z) : (x*x+y*y+z*z+3)^2-16*(x*x+y*y) domain : x, y -3.5 to 3.5; z -1.5 to 1.5; 32 * rounded cube f(x, y, z) : x^4+y^4+z^4-1 domain : -1.5 to 1.5, 24 * gyroid f(x, y, z) : sin(x)*cos(y)+sin(y)*cos(z)+sin(z)*cos(x) domain : -3.2 to 3.2, 32 * Schwarz P surface f(x, y, z) : cos(x)+cos(y)+cos(z) domain : -3.2 to 3.2, 32 * one-sheet hyperboloid f(x, y, z) : x^2+y^2-z^2-0.5 domain : -1.5 to 1.5, 32 * cone f(x, y, z) : x^2+y^2-z^2 domain : -1.5 to 1.5, 32 * heart f(x, y, z) : (x*x+9/4*y*y+z*z-1)^3-x*x*z^3-9/80*y*y*z^3 domain : -1.5 to 1.5, 40 (*) Several isosurfaces: the same f at several levels, each in its own color (blue -> red), for example the spheres x^2+y^2+z^2 at levels 0.25, 1 and 2.25 (document COUPEANI.ARG, or HYPERBOL.ARG for x^2+y^2-z^2 at levels -0.5, 0, 0.5). This setting is made in the document (--iso-levels 0.25,1,2.25 on its line). 5.4 (*) STL object ------------------ File > Open... accepts an STL file (text or binary), as written by CAD and 3D printing software. The object has neither formula nor domain; all render settings apply to it. An object too large for the free memory is refused before being read. 6. THE MENUS ============ B-Math 3D --------- About Blitz Math 3D: the version number (1.0), the variant (68030 with FPU, 68060 with FPU, ColdFire V4e, or light for 68000) and the build date. File ---- * New Effect : choose a document type and its domain (section 5) * Open... Effect : open a .ARG document (or an STL object, full version) * Recent files Effect : the last four documents opened or saved * Save, Save as... Effect : write the document * Export TGA image... Effect : the image, at the size of the window * Export OBJ mesh... Effect : the mesh (surfaces, isosurfaces, STL), for a 3D modeler * Export VRML scene..., Export POV scene... Effect : a complete scene (object, camera, light, colors) for a VRML viewer or POV-Ray * Quit Edit ---- * Undo Effect : back to the document before the last change (16 steps, 4 in the light version) * Redo Effect : redoes what was undone * Copy Effect : puts the image on the clipboard (SCRAP.TGA and SCRAP.IMG) Object ------ * Formulas... Effect : the formulas of the document * Domain and mesh... Effect : the bounds and number of points, the axis, the starting point * (*) Measures... Effect : length, area, volume (closed object), bounding box, number of critical points * (*) Variables... Effect : the variables of the document (section 8) * (*) Animate a variable... Effect : varies a variable in the window (section 8) Render ------ * Camera... Effect : orientation and field of view * Light... Effect : direction, ambient light, highlights, shading * Colors... Effect : colors of the object, background, wireframe, fade, curvature * (*) Overlays... Effect : contour lines, critical points, geodesics, Frenet frames, field lines * (*) Section... Effect : the section plane * Fog... Effect : fog by distance or by altitude * Solid Effect : solid faces, on or off * Wireframe Effect : the mesh drawn, on or off Window ------ * Compute Effect : computes the image again * Close Effect : closes the document * Progress box Effect : shows a box during the computation (otherwise only the mouse pointer) * Modal boxes Effect : settings boxes as modal dialogs, even where the AES can put them in windows * Solid preview Effect : while turning: solid faces instead of the wireframe (fast machines) * Light preview Effect : while turning: fewer lines (slow machines; checked by default in the light version) * Error diffusion dither, Ordered dither (Bayer) Effect : in 16 colors or fewer, how shades are rendered * Overlay SAGA (PIP), 8-bit palette, Orientation palette Effect : display through the overlay of the Vampire V4SA (full version) These window settings last for the session; they are not saved in the document. 7. THE SETTINGS BOXES ===================== Where the AES allows it, the boxes open in windows: you can keep several of them open, change a value and click Apply to see the effect without closing the box. Camera ------ Yaw (rotation around the vertical axis) and Pitch, in degrees; Field of view (larger: stronger perspective). Initial view goes back to the starting camera. Front view: yaw 0, pitch 0. Light ----- - Direction of the light (x, y, z) and Ambient light (from 0 to 1: the part that lights even the faces in shadow). - Specular: strength and exponent (larger: smaller and sharper highlight). (*) not in the light version. - Analytic normals: shading computed from the formulas (more accurate on curved surfaces). - Smooth shading: shades flow from one facet to the next without steps. (*) not in the light version. - Ground shadow: the shadow cast by the object on a plane. Colors ------ Object, Background, Wireframe, and Fade to (a color reached with depth). A color is written: - by its name: white, black, red, green, blue, yellow, cyan, magenta, orange; - as red, green, blue from 0 to 255: 200,170,110; - in hexadecimal: #C8AA6E. With a resource in another language, the color names of that language are accepted too, and the English names always. (*) Color by curvature: the color follows the curvature of the surface (Gaussian by default, or Mean) or of the curve (curvature, or Torsion); scale sets the sensitivity. (*) Overlays ------------ What is drawn on top of the object: - Contour lines: their number and their color (the curves z = constant); - Critical points of z: minima, maxima and saddles of the surface; - Geodesics: their number -- the "straightest" paths on the surface, starting from the same point; - Frenet frames (curves): their number along the curve; - Field lines (vector field). (*) Section ----------- The plane aúx + búy + cúz = d: the side aúx + búy + cúz ó d is kept, the other is removed, which opens the object like a cutaway. Examples: * 0, 0, 1, 0 Effect : removes everything above z = 0 * 1, 0, 0, 0.5 Effect : keeps x ó 0.5 * 0, 1, 0, h Effect : cuts at y = h, where h is a variable (to animate) * -1, 0, 1.7320508, 0 Effect : a plane tilted by 60ø (Villarceau circles of the torus) The four numbers may be formulas of the document variables. Fog --- - By distance: density, start and end distances, color; - By altitude: altitude, extent, and In the valleys (the fog stays low). (*) greyed out in the light version. 8. VARIABLES AND ANIMATION ========================== Full version. Object > Variables...: six lines name = value. A variable can be used in all formulas of the document and in the section plane. Leaving a name empty removes the variable. Example, the pretzel with two parameters (BRETZVAR.ARG): variables R = 4 and r = 1.5, formulas x(u,v) = (R+r*cos(u)+R*cos(v*0.5)^2)*cos(2*v) y(u,v) = (R+r*cos(u)+R*cos(v*0.5)^2)*sin(2*v) z(u,v) = r*sin(u)+R*sin(v) Change r to 0.5: the tube gets thinner. Object > Animate a variable...: the variable, its value from, to, and the number of frames. The animation plays in the window; a click or a key stops it, and the document keeps the value of the frame shown. Export asks for a name and also writes each frame as a TGA image, numbered from 000 (ANIM000.TGA, ANIM001.TGA...), to be assembled into a movie with other software. Animation ideas: * graph a*(x*x-y*y) Variable : a from -> to : -1 -> 1: the saddle turns over * isosurface x^2+y^2-z^2-a Variable : a from -> to : -0.5 -> 0.5: from two sheets to one * section 0, 1, 0, h on an isosurface Variable : h from -> to : -1.6 -> 1.6: the plane crosses the object * polar cos(k*t) Variable : k from -> to : 1 -> 7: the petals appear * parametric cos(t), sin(t), p*t Variable : p from -> to : 0 -> 0.5: the circle stretches into a helix 9. SAVING, EXPORTING, EXCHANGING ================================ The document ------------ A document (.ARG) is a small text file: it holds the type, the formulas, the domain and the render settings. It can be read and edited with a text editor; its line starts with view, followed by the type: view graph --solid --color orange "x*x-y*y" -2 2 40 -2 2 40 400 300 Exports ------- - TGA image: the computed image, in true color, readable by most paint programs. - OBJ mesh: the geometry, for a 3D modeler or for printing. - VRML / POV-Ray scene: object, camera, light and colors; POV-Ray renders it again by ray tracing. The clipboard ------------- Edit > Copy (Ctrl+C) writes the image into the system clipboard folder (CLIPBRD) in two forms: SCRAP.TGA (true color) and SCRAP.IMG (256 colors, GEM format). Another program can then paste it. Opening from another program ---------------------------- - A document dropped on the program icon, or a double click on an associated document, opens that document at startup. - The running program also receives documents sent by another program (VA_START message: desktop, accessory...), even under TOS. - Under MagiC and MiNT, you can drop a document on the object window (drag and drop). If the current document has been modified, the program first asks whether to save it. 10. THE COMMAND LINE ==================== Full version (MATH3D.PRG, MATH3D60.PRG on a 68060 and MATH3DCF.PRG on the FireBee); under Linux, the math3d program. Without parameters, MATH3D.PRG is the GEM application described so far. With parameters, it computes an image without a window and writes it to a file: useful to make a series of images, an animation, or a large rendering. Start it from a shell (under MiNT or MagiC), or from a desktop that lets you pass parameters to a program. The light version (MATH3DL.PRG) has no command line: it only accepts view ... (open a document, see below). The form of a command --------------------- MATH3D.PRG [options] [w h] - : the word of the document type (table below); - [options]: the render settings, all optional, before the formulas; - : in double quotes, one per argument; - : the numbers of the domain, line after line (from, to, points); - : the file written, .TGA (or .PPM); - w h: the width and height of the image, 800 x 600 by default. The program answers Ecrit: (x) ("written"), or an Erreur: ... message ("error") that says what is wrong; these messages are in French. MATH3D.PRG --help gives the complete list of types and options. The types --------- Type Parameters after the options ---------------- ------------------------------------------------------- explicit y(x) z(x) ú x min max n param x(t) y(t) z(t) ú t min max n polar r(t) ú t min max n ú z plane cylindrical r(t) z(t) ú t min max n spcurve r(t) theta(t) phi(t) ú t min max n rvcurve r(u) ú u min max n ú v angle (option --axis x or z) surface x(u,v) y(u,v) z(u,v) ú u min max n ú v min max n spherical r(theta,phi) ú theta min max n ú phi min max n revolve r(u) ú u min max n ú v min max n (option --axis x or z) graph z(x,y) ú x min max n ú y min max n implicit2d f(x,y) ú x min max n ú y min max n ú z plane implicit3d slice axis (x, y or z) value ú f(x,y,z) ú two lines min max n implicit3d f(x,y,z) g(x,y,z) ú x, y, z min max n implicit3d iso f(x,y,z) ú x, y, z min max n ode dx/dt dy/dt dz/dt ú t min max n ú x0 y0 z0 phase dx/dt dy/dt ú x min max n ú y min max n ú t min max n complex Re w Im w ú x min max n ú y min max n conformal Re w Im w ú x min max n ú y min max n field Fx Fy Fz ú x, y, z min max n stl STL file For implicit3d iso, the word iso comes before the options. Examples -------- The saddle, solid orange faces, 640 x 480: MATH3D.PRG graph --solid --no-wire --color orange "x*x-y*y" -2 2 40 -2 2 40 SADDLE.TGA 640 480 (a single line; it is broken here to fit the page) The trefoil knot as a tube, colored by its torsion: MATH3D.PRG param --tube --color-curvature torsion "sin(t)+2*sin(2*t)" "cos(t)-2*cos(2*t)" "-sin(3*t)" 0 6.283185 400 TREFOIL.TGA The Lorenz attractor, yellow on a midnight blue background: MATH3D.PRG ode --color yellow --bg 16,16,28 "10*(y-x)" "x*(28-z)-y" "x*y-8/3*z" 0 40 4000 1 1 1 LORENZ.TGA A sphere as an isosurface, with highlights, and its OBJ mesh: MATH3D.PRG implicit3d iso --solid --no-wire --specular --mesh-output SPHERE.OBJ "x^2+y^2+z^2-1" -1.5 1.5 24 -1.5 1.5 24 -1.5 1.5 24 SPHERE.TGA The main options ---------------- Camera angles are in radians here (the boxes of the application use degrees). * --solid, --no-wire Effect : solid faces; without the wireframe * --color , --bg , --wire-color Effect : colors of the object, background, wireframe: orange, 200,170,110 or #C8AA6E (English names only) * --yaw , --pitch , --fov Effect : camera: yaw, pitch (defaults 0.6 and 0.5), field of view (45) * --aa Effect : antialiasing, from 1 to 4 * --light , --ambient Effect : light direction, ambient light * --specular Effect : highlights (--specular-strength, --specular-power) * --smooth-shading, --analytic-normals Effect : smooth shading; normals computed from the formulas * --fog, --height-fog Effect : fog by distance, by altitude (--fog-density, --fog-color, --fog-height...) * --ground-shadow Effect : shadow cast behind the object * --line-width , --tube Effect : line width; curves as tubes (--tube-radius, --tube-sides) * --axes, --grid, --title Effect : axes, ground grid, title in the image * --color-depth, --color-far Effect : fade with depth * --color-curvature Effect : color by curvature: gauss, mean (surfaces), curvature, torsion (curves) * --contours , --contour-color Effect : contour lines * --critical-points Effect : minima, maxima, saddles * --geodesics Effect : geodesics (--geodesic-from a,b, --geodesic-length L) * --frenet Effect : Frenet frames * --section Effect : section: keeps aúx + búy + cúz ó d * --iso-levels Effect : several isosurfaces (2 to 8) * --field-lines, --arrow-scale Effect : vector field: field lines, arrow length * --modulus-cap Effect : cap of the modulus (complex functions, conformal maps) * --var Effect : a formula variable (repeatable) * --mesh-output Effect : also writes the OBJ mesh * --vrml-output , --pov-output Effect : also writes the VRML or POV-Ray scene * --depth-output Effect : also writes the depth map (grey levels) * --pal8, --orient-pal Effect : 256-color image; palette by face orientation Animations ---------- --frames computes n frames. What varies: - the camera: --yaw-end, --pitch-end, --fov-end (with nothing else, --frames turns the object a full turn); - a variable: --var a=0 --var-end a=2, the geometry being computed again for each frame; - the fog: --fog-density-end. The output name must contain %d, replaced by the frame number (%03d: on three digits). For example, the saddle turning over in 24 frames, SAD000.TGA to SAD023.TGA: MATH3D.PRG graph --solid --no-wire --var a=-1 --var-end a=1 --frames 24 "a*(x*x-y*y)" -2 2 32 -2 2 32 SAD%03d.TGA 320 240 Argument files -------------- @FILE replaces this word by the content of the file: one or more words per line, # for a comment, quotes around a formula that contains spaces, and other @ inside. It can hold a whole command or only common settings: MATH3D.PRG graph @STUDIO.OPT "x*x-y*y" -2 2 40 -2 2 40 SADDLE.TGA The documents of the application are argument files: their line starts with view, followed by the type, the options, the formulas, the domain and the size of the window. MATH3D.PRG @SADDLE.ARG (or just the document name) opens the application with this document. To get an image from it without a window, copy the line without the word view, and add the output name before the size: the document: view graph --solid "x*x-y*y" -2 2 40 -2 2 40 400 300 the command: MATH3D.PRG graph --solid "x*x-y*y" -2 2 40 -2 2 40 SADDLE.TGA 400 300 Scenes ------ A scene describes the same rendering as key: value lines, easier to read than a long command: mode: graph solid: true no-wire: true render.color: orange render.contours: 12 expr: exp(-x*x-y*y)*cos(2*x) x_range: -2.5, 2.5, 60 y_range: -2.5, 2.5, 60 output: CONTOURS.TGA size: 640, 480 It is run with MATH3D.PRG scene CONTOURS.SCN. Each option becomes render.