ApasScript.

Diagrams

These are Apas Cloud services: they run on our servers for a signed-in member. The examples below are shown already made; sign in to edit and run your own.

draw Apas Cloud

Draws a shape (point, vector, circle, ellipse, or line) or a point-to-point segment into the single implicit default diagram. Optional trailing color/label style args, plus a 4th slot that means arrows ("none"/"one"/"two") on a vector or a fill color on a closed shape (circle/ellipse). A vector, draw(v) or draw(p, v), is an arrow by default ("one"). Two points, draw(p1, p2), are a plain line with no arrowhead by default ("none"); pass "one" for an arrow from p1 to p2 or "two" for heads at both ends.

xrange Apas Cloud

Sets the x-axis range of the implicit default diagram.

yrange Apas Cloud

Sets the y-axis range of the implicit default diagram.

diagramTitle Apas Cloud

Sets the title of the implicit default diagram.

curve Apas Cloud

Draws a quadratic (3 points) or cubic (4 points) Bezier curve into the implicit default diagram.

curveBetween Apas Cloud

Draws a smooth quadratic curve between two fixed points. bend is signed and dimensionless: 0 is straight, positive bows left from a to b, negative bows right; midpoint offset is bend times half the chord length. Optional styles are color, label, line type (solid, dashed, dotted), and line width.

vectorFrom Apas Cloud

Draws a vector from a point with a length and direction in degrees. Positive angles are counter-clockwise from +x; negative angles clockwise.

segmentFrom Apas Cloud

Draws an unarrowed finite segment from a point with a length and direction in degrees.

diagram Apas Cloud

Creates a new, independently-named diagram: diagram() for defaults, diagram(w, h) with explicit pixel dimensions.

drawOn Apas Cloud

Draws a shape or a point-to-point segment into a named diagram (see draw() for the implicit-diagram form). drawOn(d, p, vec(dx, dy)) is an arrow by default; drawOn(d, p1, p2) with two points is a plain line by default, and takes "one" or "two" after the label for arrowheads.

vectorFromOn Apas Cloud

Draws a degree-directed vector into a named diagram.

segmentFromOn Apas Cloud

Draws a degree-directed unarrowed segment into a named diagram.

xrangeOn Apas Cloud

Sets the x-axis range of a named diagram.

yrangeOn Apas Cloud

Sets the y-axis range of a named diagram.

titleOn Apas Cloud

Sets the title of a named diagram.

curveOn Apas Cloud

Draws a quadratic or cubic Bezier curve into a named diagram (see curve() for the implicit-diagram form).

curveBetweenOn Apas Cloud

Named-diagram version of curveBetween; draws a smooth quadratic curve between two fixed points. bend is signed and dimensionless: 0 is straight, positive bows left from a to b, negative bows right. Optional styles are color, label, line type (solid, dashed, dotted), and line width.

curveFromLineOn Apas Cloud

Draws a cubic curve starting at join with its tangent aligned to the segment lineStart-to-join. bend adds signed bow near the end. Optional styles are color, label, line type (solid, dashed, dotted), and line width.

curveToLineOn Apas Cloud

Draws a cubic curve ending at join with its tangent aligned to the segment join-to-lineEnd. bend adds signed bow near the start. Optional styles are color, label, line type (solid, dashed, dotted), and line width.

polygon Apas Cloud

Draws a closed N-gon (N >= 3) through the given points into the implicit default diagram. Also polygon(corners) with one list of points -- e.g. a transformed shape: polygon(rotate(tri, 90)).

polygonOn Apas Cloud

Draws a closed N-gon (N >= 3) into a named diagram (see polygon() for the implicit-diagram form).

regularPolygon Apas Cloud

Draws a regular N-gon (N >= 3 equally-spaced vertices around a circle) into the implicit default diagram.

regularPolygonOn Apas Cloud

Draws a regular N-gon into a named diagram (see regularPolygon() for the implicit-diagram form).

arcAt Apas Cloud

Draws a circular arc (centre, radius, start angle, sweep angle -- degrees, 0 = +x, positive = counter-clockwise) into the implicit default diagram.

arcAtOn Apas Cloud

Draws a circular arc into a named diagram (see arcAt() for the implicit-diagram form).

arcArrowOn Apas Cloud

An arc with an arrowhead at its end, on a named diagram: which way an angle is measured. A positive sweep turns anticlockwise, a negative one clockwise. A sweep of more than 360 degrees is drawn as a spiral that widens, so that 420 degrees is seen to be one turn and 60 degrees more. Use it for the turn from the initial side of an angle to its terminal side; angleMarkerOn draws a plain arc with a label.

arcArrow Apas Cloud

Implicit-diagram version of arcArrowOn.

sectorOn Apas Cloud

A sector of a circle on a named diagram: the two radii and the arc between them, filled when a fill colour is given. Angles are in degrees from the positive x direction; the sign of the sweep gives the direction (180/pi degrees is one radian). A sweep of 360 or more is the whole disc.

sector Apas Cloud

Implicit-diagram version of sectorOn.

text Apas Cloud

Places a standalone text label into the implicit default diagram (unlike every other shape's `label`, which is attached to a shape -- here the text IS the shape). The text starts at the point and runs to the right of it; its size is in pixels and does not change with the ranges. For a label beside a point or a circuit component, labelAt() and the component's own label argument place it clear automatically.

textOn Apas Cloud

Places a standalone text label into a named diagram (see text() for the implicit-diagram form). The text starts at the point and runs to the right of it; its size is in pixels and does not change with the ranges. For a label beside a point or a circuit component, labelAt() and the component's own label argument place it clear automatically.

diagramAxes Apas Cloud

Shows or hides the axes of the implicit default diagram.

axesOn Apas Cloud

Shows or hides the axes of a named diagram.

diagramGrid Apas Cloud

Shows or hides the grid of the implicit default diagram.

traceDraw Apas Cloud

Makes the default diagram draw itself: its shapes are drawn in one after another, in the order the script drew them, over the given number of seconds. A line grows from its first point to its second, a circle or arc sweeps round, a curve runs from start to end, and text fades in. Leave the seconds out for 4; at most 60; 0 turns it off. On a page it plays when it comes into view and again on a click. SVG, PNG and PDF output show the finished picture.

traceDrawOn Apas Cloud

Named-diagram version of traceDraw: the shapes of diagram d are drawn in one after another, in the order they were drawn, over the given number of seconds (4 if left out, at most 60, 0 turns it off). A circuit builds up branch by branch, a construction step by step.

gridOn Apas Cloud

Shows or hides the grid of a named diagram.

cube Apas Cloud

Paper-style cube in an up/right oblique view. Returns a record with diagram and exact projected vertices [A,B,C,D,E,F,G,H]. size is the front square edge; dx/dy are drawing offsets, not physical edge lengths. All dimensions must be positive. Draws into the implicit diagram.

cubeOn Apas Cloud

Paper-style cube in an up/right oblique view. Returns a record with diagram and exact projected vertices [A,B,C,D,E,F,G,H]. size is the front square edge; dx/dy are drawing offsets, not physical edge lengths. All dimensions must be positive. Draws into the named diagram.

prism Apas Cloud

Paper-style triangular prism with a centered front apex and up/right depth offset. Returns diagram and exact projected vertices [A,B,C,D,E,F]. Positive dimensions required; projected lengths are not true 3D measurements. Draws into the implicit diagram.

prismOn Apas Cloud

Paper-style triangular prism with a centered front apex and up/right depth offset. Returns diagram and exact projected vertices [A,B,C,D,E,F]. Positive dimensions required; projected lengths are not true 3D measurements. Draws into the named diagram.

cylinder Apas Cloud

Paper-style upright cylinder. Returns diagram and exact projected vertices [bottomLeft,bottomRight,topLeft,topRight,bottomCenter,topCenter]. Positive dimensions and rimDepth < radius required. Half-rims use approximate cubic ellipse guides; rimDepth controls the drawing, not physical size. Draws into the implicit diagram.

cylinderOn Apas Cloud

Paper-style upright cylinder. Returns diagram and exact projected vertices [bottomLeft,bottomRight,topLeft,topRight,bottomCenter,topCenter]. Positive dimensions and rimDepth < radius required. Half-rims use approximate cubic ellipse guides; rimDepth controls the drawing, not physical size. Draws into the named diagram.

sphere Apas Cloud

Paper-style sphere outline and equator guide. Returns diagram and exact projected vertices [center,left,right]. Positive radius and 0 < equatorDepth < radius required. The approximate cubic equator is a guide, not an edge. Draws into the implicit diagram.

sphereOn Apas Cloud

Paper-style sphere outline and equator guide. Returns diagram and exact projected vertices [center,left,right]. Positive radius and 0 < equatorDepth < radius required. The approximate cubic equator is a guide, not an edge. Draws into the named diagram.

edgePoint Apas Cloud

Exact interpolation along a straight projected edge. t in [0,1], with t=0 at a and t=1 at b. Returns point2d without drawing. Coincident endpoints and out-of-range/nonfinite t are errors. Native exact arithmetic reports overflow; physical 3D geometry is not inferred.

cornerMarker Apas Cloud

Draws a device-sized labelled dot at a corner or any supplied point. Returns the target diagram. Labels are annotations, not physics verification. Draw the solid first, then markers. Default radius is 7 px with 14 px labels. Edge labels are offset perpendicular to the edge, preferring the right side (up for horizontal edges), at radius+labelSize+6 pixels. Corner labels use offsets (radius+5, -(radius+13)). This is local placement, not whole-diagram collision detection. Optional radius, labelDx, labelDy and labelSize follow color; positive labelDy moves down. Custom offsets prevent crowding; marker coordinates stay on the requested geometry.

cornerMarkerOn Apas Cloud

Draws a device-sized labelled dot at a corner or any supplied point. Returns the target diagram. Labels are annotations, not physics verification. Draw the solid first, then markers. Default radius is 7 px with 14 px labels. Edge labels are offset perpendicular to the edge, preferring the right side (up for horizontal edges), at radius+labelSize+6 pixels. Corner labels use offsets (radius+5, -(radius+13)). This is local placement, not whole-diagram collision detection. Optional radius, labelDx, labelDy and labelSize follow color; positive labelDy moves down. Custom offsets prevent crowding; marker coordinates stay on the requested geometry.

edgeMarker Apas Cloud

Draws a device-sized labelled dot at fraction t along the straight edge. Returns the target diagram. Labels are annotations, not physics verification. Draw the solid first, then markers. Default radius is 7 px with 14 px labels. Edge labels are offset perpendicular to the edge, preferring the right side (up for horizontal edges), at radius+labelSize+6 pixels. Corner labels use offsets (radius+5, -(radius+13)). This is local placement, not whole-diagram collision detection. Optional radius, labelDx, labelDy and labelSize follow color; positive labelDy moves down. Custom offsets prevent crowding; marker coordinates stay on the requested geometry.

edgeMarkerOn Apas Cloud

Draws a device-sized labelled dot at fraction t along the straight edge. Returns the target diagram. Labels are annotations, not physics verification. Draw the solid first, then markers. Default radius is 7 px with 14 px labels. Edge labels are offset perpendicular to the edge, preferring the right side (up for horizontal edges), at radius+labelSize+6 pixels. Corner labels use offsets (radius+5, -(radius+13)). This is local placement, not whole-diagram collision detection. Optional radius, labelDx, labelDy and labelSize follow color; positive labelDy moves down. Custom offsets prevent crowding; marker coordinates stay on the requested geometry.

angleMarker Apas Cloud

Draws a labelled circular angle marker into the implicit diagram. The vertex and two points define rays; the points need not be equally distant. direction is optional: minor (default) selects the shorter signed sweep, major the reflex sweep, ccw the counter-clockwise sweep from rayA to rayB, and cw the clockwise sweep. labelOffset is the radial distance beyond the arc in diagram units (default 0.55*radius). Zero-length and collinear rays, nonpositive radius/font/line width, and a label position at or behind the vertex are errors. Returns the target diagram.

angleMarkerOn Apas Cloud

Named-diagram angle marker. The vertex and two points define rays; the points need not be equally distant. direction is optional: minor (default) selects the shorter signed sweep, major the reflex sweep, ccw the counter-clockwise sweep from rayA to rayB, and cw the clockwise sweep. labelOffset is the radial distance beyond the arc in diagram units (default 0.55*radius). Zero-length and collinear rays, nonpositive radius/font/line width, and a label position at or behind the vertex are errors. Returns the target diagram.

rightAngleMarker Apas Cloud

Draws a labelled right-angle square into the implicit diagram. The vertex and two points define the rays; the function verifies that they are perpendicular instead of merely decorating a non-right angle. labelOffset is the radial distance beyond the square's outer corner in diagram units (default 0.75*size). Zero-length rays, nonperpendicular rays, nonpositive size/font/line width, and a label position at or behind the vertex are errors. Returns the target diagram.

rightAngleMarkerOn Apas Cloud

Named-diagram right-angle square. The vertex and two points define the rays; the function verifies that they are perpendicular instead of merely decorating a non-right angle. labelOffset is the radial distance beyond the square's outer corner in diagram units (default 0.75*size). Zero-length rays, nonperpendicular rays, nonpositive size/font/line width, and a label position at or behind the vertex are errors. Returns the target diagram.

spiral Apas Cloud

Implicit-diagram version, compatible with animate(). An Archimedean spiral with linearly varying radius. Signed turns select winding direction; start angle is degrees. Radii must be nonnegative, turns nonzero with magnitude at most 100. Optional styles: color, label, line type, line width.

spiralOn Apas Cloud

Named-diagram version. An Archimedean spiral with linearly varying radius. Signed turns select winding direction; start angle is degrees. Radii must be nonnegative, turns nonzero with magnitude at most 100. Optional styles: color, label, line type, line width.

spring Apas Cloud

Implicit-diagram version, compatible with animate(). A sinusoidal side-view spring with exact attachment endpoints. Turns are integer 1..100 and radius is positive. Geometry only; no spring forces are calculated. Optional styles: color, label, line type, line width.

springOn Apas Cloud

Named-diagram version. A sinusoidal side-view spring with exact attachment endpoints. Turns are integer 1..100 and radius is positive. Geometry only; no spring forces are calculated. Optional styles: color, label, line type, line width.

coil Apas Cloud

Implicit-diagram version, compatible with animate(). A projected helical coil between exact attachment endpoints. Integer turns 1..100; positive radius; projection depth 0..1. This is drawing geometry, not a magnetic-field model. Optional styles: color, label, line type, line width.

coilOn Apas Cloud

Named-diagram version. A projected helical coil between exact attachment endpoints. Integer turns 1..100; positive radius; projection depth 0..1. This is drawing geometry, not a magnetic-field model. Optional styles: color, label, line type, line width.

inductor Apas Cloud

Implicit-diagram version, compatible with animate(). A circuit inductor made from repeated half-ellipse loops with exact attachment endpoints. Integer loops 1..100; positive height. Add lead wires separately. Optional styles: color, label, line type, line width. In a circuit, leave out the loop height and count: inductor(a, b, label, side) draws the inductor symbol in the middle of the branch with its lead wires and a label placed clear of it, like resistor().

inductorOn Apas Cloud

Named-diagram version. A circuit inductor made from repeated half-ellipse loops with exact attachment endpoints. Integer loops 1..100; positive height. Add lead wires separately. Optional styles: color, label, line type, line width. In a circuit, leave out the loop height and count: inductor(a, b, label, side) draws the inductor symbol in the middle of the branch with its lead wires and a label placed clear of it, like resistor().

resistor Apas Cloud

A resistor between two points: the zigzag symbol in the middle and lead wires out to both points, in one call. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

resistorOn Apas Cloud

Named-diagram version. A resistor between two points: the zigzag symbol in the middle and lead wires out to both points, in one call. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

variableResistor Apas Cloud

A variable resistor (rheostat) between two points: a resistor with an arrow through it, and its lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

variableResistorOn Apas Cloud

Named-diagram version. A variable resistor (rheostat) between two points: a resistor with an arrow through it, and its lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

cell Apas Cloud

A cell between two points, with its lead wires. The long thin plate (positive) is on the side of the second point, the short thick plate (negative) on the side of the first. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

cellOn Apas Cloud

Named-diagram version. A cell between two points, with its lead wires. The long thin plate (positive) is on the side of the second point, the short thick plate (negative) on the side of the first. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

battery Apas Cloud

A battery of 1 to 8 cells between two points, with its lead wires. Each cell's positive plate faces the second point. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

batteryOn Apas Cloud

Named-diagram version. A battery of 1 to 8 cells between two points, with its lead wires. Each cell's positive plate faces the second point. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

capacitor Apas Cloud

A capacitor between two points: two equal parallel plates, with lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

capacitorOn Apas Cloud

Named-diagram version. A capacitor between two points: two equal parallel plates, with lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

meter Apas Cloud

A meter between two points: a circle with a letter in it ("A" ammeter, "V" voltmeter, "G" galvanometer), with lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

meterOn Apas Cloud

Named-diagram version. A meter between two points: a circle with a letter in it ("A" ammeter, "V" voltmeter, "G" galvanometer), with lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

bulb Apas Cloud

A lamp between two points: a circle with a cross, with lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

bulbOn Apas Cloud

Named-diagram version. A lamp between two points: a circle with a cross, with lead wires. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

switchKey Apas Cloud

A switch (key) between two points, open or closed, with lead wires. The blade is hinged on the side of the first point. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

switchKeyOn Apas Cloud

Named-diagram version. A switch (key) between two points, open or closed, with lead wires. The blade is hinged on the side of the first point. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

diode Apas Cloud

A diode between two points, with its lead wires: the triangle points from the first point to the second (the direction conventional current is allowed to flow), and the bar is on the side of the second point. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

diodeOn Apas Cloud

Named-diagram version. A diode between two points, with its lead wires: the triangle points from the first point to the second (the direction conventional current is allowed to flow), and the bar is on the side of the second point. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

zenerDiode Apas Cloud

A Zener diode between two points, with its lead wires: a diode whose bar has bent ends. The triangle points from the first point to the second, so for a regulator (reverse biased) put the second point on the positive side. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

zenerDiodeOn Apas Cloud

Named-diagram version. A Zener diode between two points, with its lead wires: a diode whose bar has bent ends. The triangle points from the first point to the second, so for a regulator (reverse biased) put the second point on the positive side. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

acSource Apas Cloud

An alternating voltage source between two points, with its lead wires: a circle with one period of a sine wave in it. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

acSourceOn Apas Cloud

Named-diagram version. An alternating voltage source between two points, with its lead wires: a circle with one period of a sine wave in it. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange before drawing it.

terminal Apas Cloud

An open terminal: a small ring where a wire ends, with an optional name placed beside it. Draw it after the wire that ends there.

terminalOn Apas Cloud

Named-diagram version. An open terminal: a small ring where a wire ends, with an optional name placed beside it. Draw it after the wire that ends there.

transistor Apas Cloud

A bipolar transistor joined to three points. The symbol is drawn at the middle of the collector-emitter line, on the base's side, and leads run to all three points, so put the collector and emitter in line (one above the other) and the base to one side, level with their middle. The emitter arrow points outwards for "npn" and inwards for "pnp". The label goes on the side away from the base. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange first.

transistorOn Apas Cloud

Named-diagram version. A bipolar transistor joined to three points. The symbol is drawn at the middle of the collector-emitter line, on the base's side, and leads run to all three points, so put the collector and emitter in line (one above the other) and the base to one side, level with their middle. The emitter arrow points outwards for "npn" and inwards for "pnp". The label goes on the side away from the base. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange first.

gate Apas Cloud

A logic gate between its input points and its output point: "and", "or", "not", "nand", "nor", "xor" or "xnor". Give two input points (one for "not") and then the output point. The body is drawn midway, facing the output, and a lead runs from each point to its pin, so a gate's output point can be given again as an input of the next gate. Passing the same point twice joins both inputs to it. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange first.

gateOn Apas Cloud

Named-diagram version. A logic gate between its input points and its output point: "and", "or", "not", "nand", "nor", "xor" or "xnor". Give two input points (one for "not") and then the output point. The body is drawn midway, facing the output, and a lead runs from each point to its pin, so a gate's output point can be given again as an input of the next gate. Passing the same point twice joins both inputs to it. The symbol keeps the same size on the page whatever the ranges are, so set xrange and yrange first.

twoWaySwitch Apas Cloud

A two-way switch: a pivot and two contacts, with the blade on contact a, on contact b, or between them ("open"). The contacts are the points given; draw the wires to them separately. The label goes beside the pivot, to one side of the line from pivot to contacts.

twoWaySwitchOn Apas Cloud

Named-diagram version. A two-way switch: a pivot and two contacts, with the blade on contact a, on contact b, or between them ("open"). The contacts are the points given; draw the wires to them separately. The label goes beside the pivot, to one side of the line from pivot to contacts.

currentArrow Apas Cloud

An arrowhead half-way between two points, pointing to the second: the direction of a current on a wire. It draws no wire of its own, so draw the wire or component separately.

currentArrowOn Apas Cloud

Named-diagram version. An arrowhead half-way between two points, pointing to the second: the direction of a current on a wire. It draws no wire of its own, so draw the wire or component separately.

wire Apas Cloud

A wire through two or more points in order: plain segments with no arrowheads, for the corners of a circuit.

wireOn Apas Cloud

Named-diagram version. A wire through two or more points in order: plain segments with no arrowheads, for the corners of a circuit.

junction Apas Cloud

A junction dot where wires meet, with an optional name placed beside it, clear of the dot.

junctionOn Apas Cloud

Named-diagram version. A junction dot where wires meet, with an optional name placed beside it, clear of the dot.

ground Apas Cloud

The earth symbol hanging below a point: a short stem and three bars.

groundOn Apas Cloud

Named-diagram version. The earth symbol hanging below a point: a short stem and three bars.

labelAt Apas Cloud

Text placed beside a point instead of on it: the engine moves it to the side asked for, by half its own size plus a small gap, so it stays clear of whatever is at the point. Use it for terminal signs and names next to a drawing; text() starts the text exactly at its point.

labelAtOn Apas Cloud

Named-diagram version. Text placed beside a point instead of on it: the engine moves it to the side asked for, by half its own size plus a small gap, so it stays clear of whatever is at the point. Use it for terminal signs and names next to a drawing; text() starts the text exactly at its point.

vectorField Apas Cloud

Implicit-diagram form, compatible with animate(). Samples two vector component expressions over a grid. Arrows are centred on sample points. Direction mode uses equal arrow length; scaled mode displays magnitude times scale; capped mode caps lengths to 80% of the smaller grid spacing. Zero and nonfinite vectors and division-by-zero samples are omitted. Other expression errors reject the entire drawing. Sample x/y bindings are restored. This draws a field; it does not simulate motion.

vectorFieldOn Apas Cloud

Named-diagram form. Samples two vector component expressions over a grid. Arrows are centred on sample points. Direction mode uses equal arrow length; scaled mode displays magnitude times scale; capped mode caps lengths to 80% of the smaller grid spacing. Zero and nonfinite vectors and division-by-zero samples are omitted. Other expression errors reject the entire drawing. Sample x/y bindings are restored. This draws a field; it does not simulate motion.

fieldLine Apas Cloud

Implicit-diagram form, compatible with animation. Traces a 2D field using gtmath vector RK4 on normalized components. Directions: forward, backward, both (default). Arrows always follow the physical field direction, including backward traces. Stops at bounds, exclusion circles, division by zero, nonfinite/near-zero fields, a closed return to the seed, stalled motion or the step budget. This is a distance-based field curve; a streamline of a time-varying field is not a particle trajectory. Expressions must be side-effect free. x/y bindings are restored, and expression errors leave the diagram unchanged.

fieldLineOn Apas Cloud

Named-diagram form. Traces a 2D field using gtmath vector RK4 on normalized components. Directions: forward, backward, both (default). Arrows always follow the physical field direction, including backward traces. Stops at bounds, exclusion circles, division by zero, nonfinite/near-zero fields, a closed return to the seed, stalled motion or the step budget. This is a distance-based field curve; a streamline of a time-varying field is not a particle trajectory. Expressions must be side-effect free. x/y bindings are restored, and expression errors leave the diagram unchanged.

streamline Apas Cloud

Implicit-diagram form, compatible with animation. Traces a 2D field using gtmath vector RK4 on normalized components. Directions: forward, backward, both (default). Arrows always follow the physical field direction, including backward traces. Stops at bounds, exclusion circles, division by zero, nonfinite/near-zero fields, a closed return to the seed, stalled motion or the step budget. This is a distance-based field curve; a streamline of a time-varying field is not a particle trajectory. Expressions must be side-effect free. x/y bindings are restored, and expression errors leave the diagram unchanged.

streamlineOn Apas Cloud

Named-diagram form. Traces a 2D field using gtmath vector RK4 on normalized components. Directions: forward, backward, both (default). Arrows always follow the physical field direction, including backward traces. Stops at bounds, exclusion circles, division by zero, nonfinite/near-zero fields, a closed return to the seed, stalled motion or the step budget. This is a distance-based field curve; a streamline of a time-varying field is not a particle trajectory. Expressions must be side-effect free. x/y bindings are restored, and expression errors leave the diagram unchanged.

pointChargeLines Apas Cloud

Isolated point-charge field-line preset with evenly spaced circular seeds and a signed charge marker. Arrows point outwards for positive charge and inwards for negative charge. Charge magnitude does not encode field strength or line density; this is normalized direction geometry, not a quantitative field calculation. The seed circle must fit inside bounds. Traces start at the seed radius; marker radius is 60% of it. lineCount*maxSteps must not exceed 4000. Explicit calls on separate charges do not superpose their fields. Implicit form works in the existing recorder.

pointChargeLinesOn Apas Cloud

Isolated point-charge field-line preset with evenly spaced circular seeds and a signed charge marker. Arrows point outwards for positive charge and inwards for negative charge. Charge magnitude does not encode field strength or line density; this is normalized direction geometry, not a quantitative field calculation. The seed circle must fit inside bounds. Traces start at the seed radius; marker radius is 60% of it. lineCount*maxSteps must not exceed 4000. Explicit calls on separate charges do not superpose their fields. Implicit form works in the existing recorder.

chargeField Apas Cloud

Draw electric field arrows for point charges. Charges are [x, y, q, ...].

chargeFieldOn Apas Cloud

Draw electric field arrows for point charges. Charges are [x, y, q, ...].

potentialContours Apas Cloud

Draw equipotential contours for point charges at the listed levels.

potentialContoursOn Apas Cloud

Draw equipotential contours for point charges at the listed levels.

chargeStreamlines Apas Cloud

Trace electric field lines from seed coordinates for point charges.

chargeStreamlinesOn Apas Cloud

Trace electric field lines from seed coordinates for point charges.

biology Apas Cloud

Appends a named Zig biology motif to the implicit diagram. Motifs include animal_cell, plant_cell, nucleus, mitochondrion, chloroplast, dna_helix, bacterium and enveloped_virus. Use biologyOn to compose named diagrams.

biologyOn Apas Cloud

Appends a Zig biology motif to a named diagram, composing with existing drawing and circuit calls.

biologyKeyOn Apas Cloud

Adds numbered markers at biology structures and automatically orders a two-column key outside the art. Pass one or more anchor/label pairs. No leader lines or label boxes are drawn.

biologyKey Apas Cloud

Implicit-diagram version of biologyKeyOn; places numbered biology labels in an outside key.

vennOn Apas Cloud

A Venn diagram of two sets on a named diagram: a rectangle 5.2 by 3.2 times the scale with U in its corner, circle A outlined steelblue and B tomato with each letter inside its own part, and the four regions shaded as asked ("" leaves one clear). Optional region-number/text pairs write elements in a region, clear of the letters.

venn3On Apas Cloud

A Venn diagram of three sets, A and B above and C (seagreen) below, with each of the eight regions shaded as asked.

venn Apas Cloud

Implicit-diagram version of vennOn, including inside animation frames.

venn3 Apas Cloud

Implicit-diagram version of venn3On, including inside animation frames.

numberLineOn Apas Cloud

A number line with arrowheads, ticks and their numbers below it, and an interval marked on it: a hollow circle at an end left out, a filled one at an end taken in, an arrowhead where it runs on without end.

arrowDiagramOn Apas Cloud

An arrow diagram of a relation on a named diagram: two ovals side by side with the elements of each set written down the middle, and an arrow from x to y for each ordered pair (x, y). The elements stand one scale apart; the ovals' centres are 2.25 times the scale either side of (cx, cy).

arrowDiagram Apas Cloud

Implicit-diagram version of arrowDiagramOn, also inside animation frames.

coordinatePlaneOn Apas Cloud

A ruled coordinate plane readable on a white page, on a named diagram: a light grid, the two axes with arrowheads, numbered marks, and the letters X, Y and O. Marks a fraction of pi apart, from a fraction of pi, are named in pi (a step of pi/2 gives -π, -π/2, π/2, π, 3π/2), so a trigonometric graph is marked as a textbook prints it. Numbers that would touch one another are thinned to round ones (every second, every fifth mark). It sets the diagram's ranges (three quarters of a step of x beyond the plane all round, 20 px at least) and turns the faint built-in axes off. functionGraphOn, openPointOn and closedPointOn then draw on it. planeNumbersOn, planeNamesOn and planeGridOn, called before it, change its numbers, the names of its axes and its grid.

coordinatePlane Apas Cloud

Implicit-diagram version of coordinatePlaneOn, also inside animation frames.

functionGraphOn Apas Cloud

The graph of y = f(x) for a <= x <= b on the plane drawn by coordinatePlaneOn, or on any diagram whose two ranges are set (xrangeOn, yrangeOn), so on axes drawn by hand as well. The curve is broken where the function jumps (a step function, an asymptote) or has no value, and is cut at the top and bottom of the plane (of the picture, without a plane). f is a rule in x as text, or the name of a function defined with fn. A number of the plane (or its O) that a line drawn on the plane so far runs through is moved beside its mark, as a textbook sets -π to one side of the point where the curve crosses the axis; so draw asymptotes and other lines before the graph.

functionGraph Apas Cloud

Implicit-diagram version of functionGraphOn, also inside animation frames. Call coordinatePlane first, or set xrange and yrange.

openPointOn Apas Cloud

A hollow circle at (x, y) on the coordinate plane: the end of a piece of a graph that the graph does not reach.

openPoint Apas Cloud

Implicit-diagram version of openPointOn.

closedPointOn Apas Cloud

A filled circle at (x, y) on the coordinate plane: the end of a piece of a graph that belongs to it.

closedPoint Apas Cloud

Implicit-diagram version of closedPointOn.

planeNumbersOn Apas Cloud

How far apart the numbers of the plane are, on a named diagram; called before coordinatePlaneOn. Each distance is a whole number of the plane's steps: on a plane ruled every pi/2, planeNumbersOn(d, pi, 1) names -π, π, 2π and leaves the half marks bare. 0 is no numbers on that axis. Without this call the plane numbers every mark and thins them only where they would touch.

planeNumbers Apas Cloud

Implicit-diagram version of planeNumbersOn; before coordinatePlane.

planeNamesOn Apas Cloud

What the ends of the plane's axes are called, on a named diagram; called before coordinatePlaneOn. Two names are the positive ends (X and Y without this call); four add the negative ends, as a textbook writes X′ and Y′. An empty name leaves that end bare.

planeNames Apas Cloud

Implicit-diagram version of planeNamesOn; before coordinatePlane.

planeGridOn Apas Cloud

With false the plane drawn next on a named diagram has no grid: each mark is a short stroke across its axis, as on a textbook's axes. Called before coordinatePlaneOn.

planeGrid Apas Cloud

Implicit-diagram version of planeGridOn; before coordinatePlane.

planeLabelOn Apas Cloud

A label at the point (x, y) of the coordinate plane on a named diagram, in the plane's own coordinates. On a plane drawn with a scale for y (coordinatePlaneOn's last argument) the label stands where the graph's point (x, y) is drawn; labelAtOn takes the picture's coordinates, where y must be multiplied by that scale by hand. Use it for anything named on a plane: the rule of a curve, a point, a value on an axis.

planeLabel Apas Cloud

Implicit-diagram version of planeLabelOn.

unitCircleOn Apas Cloud

The unit circle as a textbook draws it, on a named diagram, from one call: the axes with X, Y, X′, Y′ and O, the circle of radius 1 about the origin, a dot and a radius for each named point, each angle once at the centre as an arc with an arrowhead and its letter (the arcs a book repeats along the circle are not drawn), the chords between points and one filled region. It sets the diagram's ranges, so the circle is round and the names have room; call it first on its diagram. More is then drawn in the plane's own coordinates (drawOn, labelAtOn): the circle's radius is 1.

unitCircle Apas Cloud

Implicit-diagram version of unitCircleOn.

textbookGraphOn Apas Cloud

The graph of a function as a textbook prints it, on a named diagram, from one call: axes without a grid, named X, Y, X′ and Y′; the x-axis marked every π/2 when both its ends are fractions of π (every π when that would be more than 20 marks), otherwise in round numbers; a unit of y drawn as tall as the picture has room for; a dashed line at each vertical asymptote, also at the ends of the range; the curve; and its rule written under the plane. Call it first on its diagram. More curves, points and labels are then added with functionGraphOn, closedPointOn and planeLabelOn.

textbookGraph Apas Cloud

Implicit-diagram version of textbookGraphOn.