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.
shape (point2d | vector2 | circle2d | ellipse2d | line2d) --
style (string) -- optional color, label, then arrows (vector) or fill color (circle/ellipse)
xrange Apas Cloud
Sets the x-axis range of the implicit default diagram.
min (number) --
max (number) --
yrange Apas Cloud
Sets the y-axis range of the implicit default diagram.
min (number) --
max (number) --
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.
points (point2d[]) -- 3 points (start, control, end) or 4 (start, 2 controls, end)
style (string) -- optional color, label
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.
a (point2d) -- start point
b (point2d) -- end point
bend (number) -- signed bow fraction; 0 is a straight segment
style (string) -- optional color, label, line type and 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.
p (point2d) -- start point
length (number) -- vector length
degrees (number) -- direction in degrees
style (string) -- optional color, label, arrows
segmentFrom Apas Cloud
Draws an unarrowed finite segment from a point with a length and direction in degrees.
p (point2d) -- start point
length (number) -- segment length
degrees (number) -- direction in degrees
style (string) -- optional color, label
diagram Apas Cloud
Creates a new, independently-named diagram: diagram() for defaults, diagram(w, h) with explicit pixel dimensions.
w (number) -- optional pixel width
h (number) -- optional pixel height
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.
d (diagram) --
shape (point2d | vector2 | circle2d | ellipse2d | line2d) --
style (string) -- optional color, label, then arrows (vector) or fill color (circle/ellipse)
vectorFromOn Apas Cloud
Draws a degree-directed vector into a named diagram.
d (diagram) --
p (point2d) -- start point
length (number) --
degrees (number) --
style (string) -- optional color, label, arrows
segmentFromOn Apas Cloud
Draws a degree-directed unarrowed segment into a named diagram.
d (diagram) --
p (point2d) -- start point
length (number) --
degrees (number) --
style (string) -- optional color, label
xrangeOn Apas Cloud
Sets the x-axis range of a named diagram.
d (diagram) --
min (number) --
max (number) --
yrangeOn Apas Cloud
Sets the y-axis range of a named diagram.
d (diagram) --
min (number) --
max (number) --
titleOn Apas Cloud
Sets the title of a named diagram.
d (diagram) --
text (string) --
curveOn Apas Cloud
Draws a quadratic or cubic Bezier curve into a named diagram (see curve() for the implicit-diagram form).
d (diagram) --
points (point2d[]) -- 3 or 4 points
style (string) -- optional color, label
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.
d (diagram) -- target diagram
a (point2d) -- start point
b (point2d) -- end point
bend (number) -- signed bow fraction; 0 is a straight segment
style (string) -- optional color, label, line type and 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.
d (diagram) -- target diagram
lineStart (point2d) -- point before the join
join (point2d) -- end of incoming segment and curve start
end (point2d) -- curve end
bend (number) -- signed extra bow
style (string) -- optional color, label, line type and 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.
d (diagram) -- target diagram
start (point2d) -- curve start
join (point2d) -- curve end and start of outgoing segment
lineEnd (point2d) -- point after the join
bend (number) -- signed extra bow
style (string) -- optional color, label, line type and 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)).
points (point2d[]) -- 3 or more points, in order
style (string) -- optional color, label, fill color
polygonOn Apas Cloud
Draws a closed N-gon (N >= 3) into a named diagram (see polygon() for the implicit-diagram form).
d (diagram) --
points (point2d[]) -- 3 or more points, in order
style (string) -- optional color, label, fill color
regularPolygon Apas Cloud
Draws a regular N-gon (N >= 3 equally-spaced vertices around a circle) into the implicit default diagram.
centre (point2d) --
radius (number) --
sides (number) -- integer, >= 3
rotation (number) -- optional degrees, default 0 (vertex 0 at +x, counter-clockwise); e.g. -90 for a pointy-top look
style (string) -- optional color, label, fill color
regularPolygonOn Apas Cloud
Draws a regular N-gon into a named diagram (see regularPolygon() for the implicit-diagram form).
d (diagram) --
centre (point2d) --
radius (number) --
sides (number) -- integer, >= 3
rotation (number) -- optional degrees, default 0
style (string) -- optional color, label, fill color
arcAt Apas Cloud
Draws a circular arc (centre, radius, start angle, sweep angle -- degrees, 0 = +x, positive = counter-clockwise) into the implicit default diagram.
centre (point2d) --
radius (number) --
startAngle (number) -- degrees
sweepAngle (number) -- degrees; sign gives the direction
style (string) -- optional color, label, line style (solid/dashed/dotted), line width
arcAtOn Apas Cloud
Draws a circular arc into a named diagram (see arcAt() for the implicit-diagram form).
d (diagram) --
centre (point2d) --
radius (number) --
startAngle (number) -- degrees
sweepAngle (number) -- degrees; sign gives the direction
style (string) -- optional color, label, line style (solid/dashed/dotted), line width
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.
d (diagram) --
centre (point2d) -- the vertex of the angle
radius (number) --
startAngle (number) -- degrees from the positive x direction
sweepAngle (number) -- degrees; the sign gives the direction, more than 360 a spiral
color (color) -- optional
lineWidth (number) -- optional (2); the arrowhead grows with it
ends (string) -- optional: "one" (the default) or "both", an arrowhead at each end, for an arc that measures a length
arcArrow Apas Cloud
Implicit-diagram version of arcArrowOn.
centre (point2d) --
radius (number) --
startAngle, sweepAngle (numbers) -- degrees
color, lineWidth () -- optional
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.
d (diagram) --
centre (point2d) --
radius (number) --
startAngle (number) -- degrees
sweepAngle (number) -- degrees; the sign gives the direction
color (color) -- optional outline colour
fill (color) -- optional fill colour
sector Apas Cloud
Implicit-diagram version of sectorOn.
centre (point2d) --
radius (number) --
startAngle, sweepAngle (numbers) -- degrees
color, fill (colors) -- optional
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.
point (point2d) -- where the text starts: the left end of its baseline
text (string) --
color (string) -- optional
fontSize (number) -- optional, pixels, default 14
rotation (number) -- optional degrees, default 0
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.
d (diagram) --
point (point2d) -- where the text starts: the left end of its baseline
text (string) --
color (string) -- optional
fontSize (number) -- optional, pixels, default 14
rotation (number) -- optional degrees, default 0
diagramAxes Apas Cloud
Shows or hides the axes of the implicit default diagram.
show (boolean) -- true or false
axesOn Apas Cloud
Shows or hides the axes of a named diagram.
d (diagram) --
show (boolean) -- true or false
diagramGrid Apas Cloud
Shows or hides the grid of the implicit default diagram.
show (boolean) -- true or false
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.
seconds (number) -- how long the whole drawing takes; optional, 4 if left out
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.
d (diagram) --
seconds (number) -- how long the whole drawing takes; optional, 4 if left out
gridOn Apas Cloud
Shows or hides the grid of a named diagram.
d (diagram) --
show (boolean) -- true or false
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.
origin (point2d) --
size (number) --
dx (number) --
dy (number) --
color (string) -- Optional stroke color; default dark ink
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.
d (diagram) -- Named target diagram
origin (point2d) --
size (number) --
dx (number) --
dy (number) --
color (string) -- Optional stroke color; default dark ink
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.
origin (point2d) --
width (number) --
height (number) --
dx (number) --
dy (number) --
color (string) -- Optional stroke color; default dark ink
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.
d (diagram) -- Named target diagram
origin (point2d) --
width (number) --
height (number) --
dx (number) --
dy (number) --
color (string) -- Optional stroke color; default dark ink
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.
base (point2d) --
radius (number) --
height (number) --
rimDepth (number) --
color (string) -- Optional stroke color; default dark ink
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.
d (diagram) -- Named target diagram
base (point2d) --
radius (number) --
height (number) --
rimDepth (number) --
color (string) -- Optional stroke color; default dark ink
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.
center (point2d) --
radius (number) --
equatorDepth (number) --
color (string) -- Optional stroke color; default dark ink
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.
d (diagram) -- Named target diagram
center (point2d) --
radius (number) --
equatorDepth (number) --
color (string) -- Optional stroke color; default dark ink
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.
a (point2d) --
b (point2d) --
t (number) --
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.
p (point2d) -- Corner or any chosen point
label (string) -- Descriptive annotation, such as +q or m
color (string) -- Optional dot/label color; default dark ink
radius (number) -- Optional dot radius in device pixels; default 7
labelDx (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelDy (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelSize (number) -- Optional font size in device pixels; default 14
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.
d (diagram) --
p (point2d) -- Corner or any chosen point
label (string) -- Descriptive annotation, such as +q or m
color (string) -- Optional dot/label color; default dark ink
radius (number) -- Optional dot radius in device pixels; default 7
labelDx (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelDy (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelSize (number) -- Optional font size in device pixels; default 14
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.
a (point2d) --
b (point2d) --
t (number) -- Fraction along the edge, from 0 to 1
label (string) -- Descriptive annotation, such as +q or m
color (string) -- Optional dot/label color; default dark ink
radius (number) -- Optional dot radius in device pixels; default 7
labelDx (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelDy (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelSize (number) -- Optional font size in device pixels; default 14
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.
d (diagram) --
a (point2d) --
b (point2d) --
t (number) -- Fraction along the edge, from 0 to 1
label (string) -- Descriptive annotation, such as +q or m
color (string) -- Optional dot/label color; default dark ink
radius (number) -- Optional dot radius in device pixels; default 7
labelDx (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelDy (number) -- Optional screen-pixel label offset; default chosen from marker type/edge direction
labelSize (number) -- Optional font size in device pixels; default 14
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.
vertex (point2d) -- Angle vertex
rayA (point2d) -- Any point defining the first ray
rayB (point2d) -- Any point defining the second ray
radius (number) -- Positive arc radius in diagram units
label (string) -- Angle text, such as θ or 30°
color (string) -- Optional arc/label color; default dark ink
direction (string) -- Optional minor, major, ccw or cw; default minor
labelOffset (number) -- Optional radial distance beyond the arc in diagram units
labelSize (number) -- Optional font size in device pixels; default 14
lineType (string) -- Optional solid, dashed or dotted; default solid
lineWidth (number) -- Optional positive line width; default 2
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.
d (diagram) -- Target diagram
vertex (point2d) -- Angle vertex
rayA (point2d) -- Any point defining the first ray
rayB (point2d) -- Any point defining the second ray
radius (number) -- Positive arc radius in diagram units
label (string) -- Angle text, such as θ or 30°
color (string) -- Optional arc/label color; default dark ink
direction (string) -- Optional minor, major, ccw or cw; default minor
labelOffset (number) -- Optional radial distance beyond the arc in diagram units
labelSize (number) -- Optional font size in device pixels; default 14
lineType (string) -- Optional solid, dashed or dotted; default solid
lineWidth (number) -- Optional positive line width; default 2
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.
vertex (point2d) -- Right-angle vertex
rayA (point2d) -- Any point defining the first ray
rayB (point2d) -- Any point defining the perpendicular second ray
size (number) -- Positive side length of the marker square in diagram units
label (string) -- Angle text, usually 90°
color (string) -- Optional square/label color; default dark ink
labelOffset (number) -- Optional radial distance beyond the outside corner in diagram units
labelSize (number) -- Optional font size in device pixels; default 14
lineType (string) -- Optional solid, dashed or dotted; default solid
lineWidth (number) -- Optional positive line width; default 2
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.
d (diagram) -- Target diagram
vertex (point2d) -- Right-angle vertex
rayA (point2d) -- Any point defining the first ray
rayB (point2d) -- Any point defining the perpendicular second ray
size (number) -- Positive side length of the marker square in diagram units
label (string) -- Angle text, usually 90°
color (string) -- Optional square/label color; default dark ink
labelOffset (number) -- Optional radial distance beyond the outside corner in diagram units
labelSize (number) -- Optional font size in device pixels; default 14
lineType (string) -- Optional solid, dashed or dotted; default solid
lineWidth (number) -- Optional positive line width; default 2
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.
centre (point2d) -- spiral centre
startRadius (number) -- initial radius
endRadius (number) -- final radius
turns (number) -- signed turn count
startDegrees (number) -- initial angle in degrees
style (string) -- optional color, label, line type and 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.
d (diagram) -- target diagram
centre (point2d) -- spiral centre
startRadius (number) -- initial radius
endRadius (number) -- final radius
turns (number) -- signed turn count
startDegrees (number) -- initial angle in degrees
style (string) -- optional color, label, line type and 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.
start (point2d) -- first attachment point
end (point2d) -- second attachment point
radius (number) -- transverse amplitude
turns (number) -- integer turn count
style (string) -- optional color, label, line type and 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.
d (diagram) -- target diagram
start (point2d) -- first attachment point
end (point2d) -- second attachment point
radius (number) -- transverse amplitude
turns (number) -- integer turn count
style (string) -- optional color, label, line type and 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.
start (point2d) -- first attachment point
end (point2d) -- second attachment point
radius (number) -- coil radius
turns (number) -- integer turn count
projectionDepth (number) -- axial projection factor 0..1
style (string) -- optional color, label, line type and 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.
d (diagram) -- target diagram
start (point2d) -- first attachment point
end (point2d) -- second attachment point
radius (number) -- coil radius
turns (number) -- integer turn count
projectionDepth (number) -- axial projection factor 0..1
style (string) -- optional color, label, line type and 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().
start (point2d) -- first attachment point
end (point2d) -- second attachment point
loopHeight (number) -- height of each loop
loops (number) -- integer loop count
style (string) -- optional color, label, line type and width
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().
d (diagram) -- target diagram
start (point2d) -- first attachment point
end (point2d) -- second attachment point
loopHeight (number) -- height of each loop
loops (number) -- integer loop count
style (string) -- optional color, label, line type and width
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
cells (number) -- number of cells, 1 to 8
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
cells (number) -- number of cells, 1 to 8
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
letter (string) -- the letter inside the circle, 1 to 3 characters
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
letter (string) -- the letter inside the circle, 1 to 3 characters
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
state (string) -- "open" or "closed"
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
state (string) -- "open" or "closed"
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
p (point2d) -- the end of the wire
label (string) -- optional name, such as "A"
side (string) -- optional: "above", "below", "left", "right" or "auto"
color (string) -- optional
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.
d (diagram) -- target diagram
p (point2d) -- the end of the wire
label (string) -- optional name, such as "A"
side (string) -- optional: "above", "below", "left", "right" or "auto"
color (string) -- optional
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.
base (point2d) -- where the base lead ends
collector (point2d) -- where the collector lead ends
emitter (point2d) -- where the emitter lead ends
kind (string) -- "npn" or "pnp"
label (string) -- optional
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
base (point2d) -- where the base lead ends
collector (point2d) -- where the collector lead ends
emitter (point2d) -- where the emitter lead ends
kind (string) -- "npn" or "pnp"
label (string) -- optional
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
kind (string) -- "and", "or", "not", "nand", "nor", "xor" or "xnor"
inputA (point2d) -- first input point
inputB (point2d) -- second input point (left out for "not")
output (point2d) -- output point
label (string) -- optional
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
kind (string) -- "and", "or", "not", "nand", "nor", "xor" or "xnor"
inputA (point2d) -- first input point
inputB (point2d) -- second input point (left out for "not")
output (point2d) -- output point
label (string) -- optional
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
pivot (point2d) -- the hinge of the blade
contactA (point2d) -- first contact
contactB (point2d) -- second contact
position (string) -- "a", "b" or "open"
label (string) -- optional
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
pivot (point2d) -- the hinge of the blade
contactA (point2d) -- first contact
contactB (point2d) -- second contact
position (string) -- "a", "b" or "open"
label (string) -- optional
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
a (point2d) -- first attachment point
b (point2d) -- second attachment point
label (string) -- optional text placed beside the symbol, clear of it; "" for none
side (string) -- optional: "above", "below", "left", "right", or "auto" (the default: outside the circuit, away from the middle of the view)
color (string) -- optional colour of the symbol and its label
lineWidth (number) -- optional, pixels, default 2
wire Apas Cloud
A wire through two or more points in order: plain segments with no arrowheads, for the corners of a circuit.
points (point2d) -- two or more points, each its own argument
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
d (diagram) -- target diagram
points (point2d) -- two or more points, each its own argument
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
junction Apas Cloud
A junction dot where wires meet, with an optional name placed beside it, clear of the dot.
p (point2d) -- where the wires meet
label (string) -- optional name, such as "A"
side (string) -- optional: "above", "below", "left", "right" or "auto"
color (string) -- optional
junctionOn Apas Cloud
Named-diagram version. A junction dot where wires meet, with an optional name placed beside it, clear of the dot.
d (diagram) -- target diagram
p (point2d) -- where the wires meet
label (string) -- optional name, such as "A"
side (string) -- optional: "above", "below", "left", "right" or "auto"
color (string) -- optional
ground Apas Cloud
The earth symbol hanging below a point: a short stem and three bars.
p (point2d) -- the earthed point
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
groundOn Apas Cloud
Named-diagram version. The earth symbol hanging below a point: a short stem and three bars.
d (diagram) -- target diagram
p (point2d) -- the earthed point
color (string) -- optional
lineWidth (number) -- optional, pixels, default 2
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.
p (point2d) -- the point being labelled
text (string) -- the label
side (string) -- optional: "above", "below", "left", "right", "center" (on the point) or "auto" (away from the middle of the view)
color (string) -- optional
fontSize (number) -- optional, pixels, default 12
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.
d (diagram) -- target diagram
p (point2d) -- the point being labelled
text (string) -- the label
side (string) -- optional: "above", "below", "left", "right", "center" (on the point) or "auto" (away from the middle of the view)
color (string) -- optional
fontSize (number) -- optional, pixels, default 12
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.
Fx (string) -- x-component expression in x and y
Fy (string) -- y-component expression in x and y
xmin (number) -- sampling region left
xmax (number) -- sampling region right
ymin (number) -- sampling region bottom
ymax (number) -- sampling region top
nx (number) -- horizontal samples, integer 2..50
ny (number) -- vertical samples, integer 2..50; at most 1600 total
mode (string) -- direction, scaled, or capped
scale (number) -- direction arrow length, otherwise magnitude multiplier
style (string) -- optional colour, then positive line width
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.
d (diagram) -- target diagram
Fx (string) -- x-component expression in x and y
Fy (string) -- y-component expression in x and y
xmin (number) -- sampling region left
xmax (number) -- sampling region right
ymin (number) -- sampling region bottom
ymax (number) -- sampling region top
nx (number) -- horizontal samples, integer 2..50
ny (number) -- vertical samples, integer 2..50; at most 1600 total
mode (string) -- direction, scaled, or capped
scale (number) -- direction arrow length, otherwise magnitude multiplier
style (string) -- optional colour, then positive line width
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.
Fx (string) -- field x-component expression
Fy (string) -- field y-component expression
seed (point2d) -- starting point inside bounds
xmin (number) -- left tracing bound
xmax (number) -- right tracing bound
ymin (number) -- bottom tracing bound
ymax (number) -- top tracing bound
step (number) -- positive distance step
maxSteps (number) -- integer steps per direction, 1..1000
options (string) -- optional direction (both default), arrow spacing (0.8 default, 0 disables), colour, line width, exclusions [cx,cy,r,...], minimum field magnitude (1e-12 default)
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.
d (diagram) -- target diagram
Fx (string) -- field x-component expression
Fy (string) -- field y-component expression
seed (point2d) -- starting point inside bounds
xmin (number) -- left tracing bound
xmax (number) -- right tracing bound
ymin (number) -- bottom tracing bound
ymax (number) -- top tracing bound
step (number) -- positive distance step
maxSteps (number) -- integer steps per direction, 1..1000
options (string) -- optional direction (both default), arrow spacing (0.8 default, 0 disables), colour, line width, exclusions [cx,cy,r,...], minimum field magnitude (1e-12 default)
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.
Fx (string) -- field x-component expression
Fy (string) -- field y-component expression
seed (point2d) -- starting point inside bounds
xmin (number) -- left tracing bound
xmax (number) -- right tracing bound
ymin (number) -- bottom tracing bound
ymax (number) -- top tracing bound
step (number) -- positive distance step
maxSteps (number) -- integer steps per direction, 1..1000
options (string) -- optional direction (both default), arrow spacing (0.8 default, 0 disables), colour, line width, exclusions [cx,cy,r,...], minimum field magnitude (1e-12 default)
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.
d (diagram) -- target diagram
Fx (string) -- field x-component expression
Fy (string) -- field y-component expression
seed (point2d) -- starting point inside bounds
xmin (number) -- left tracing bound
xmax (number) -- right tracing bound
ymin (number) -- bottom tracing bound
ymax (number) -- top tracing bound
step (number) -- positive distance step
maxSteps (number) -- integer steps per direction, 1..1000
options (string) -- optional direction (both default), arrow spacing (0.8 default, 0 disables), colour, line width, exclusions [cx,cy,r,...], minimum field magnitude (1e-12 default)
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.
centre (point2d) -- charge position
charge (number) -- nonzero signed charge; only sign affects direction
lineCount (number) -- integer 1..64, independent of magnitude
xmin (number) -- left bound
xmax (number) -- right bound
ymin (number) -- bottom bound
ymax (number) -- top bound
options (number) -- optional seedRadius (0.3), step (0.08), maxSteps (up to 200, reduced automatically for high line counts), arrowSpacing (0.8; 0 disables), colour (red positive / blue negative), lineWidth (2)
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.
d (diagram) -- target diagram
centre (point2d) -- charge position
charge (number) -- nonzero signed charge; only sign affects direction
lineCount (number) -- integer 1..64, independent of magnitude
xmin (number) -- left bound
xmax (number) -- right bound
ymin (number) -- bottom bound
ymax (number) -- top bound
options (number) -- optional seedRadius (0.3), step (0.08), maxSteps (up to 200, reduced automatically for high line counts), arrowSpacing (0.8; 0 disables), colour (red positive / blue negative), lineWidth (2)
chargeField Apas Cloud
Draw electric field arrows for point charges. Charges are [x, y, q, ...].
charges (array) -- charges
xmin (number) -- xmin
xmax (number) -- xmax
ymin (number) -- ymin
ymax (number) -- ymax
nx (number) -- nx
ny (number) -- ny
arrowLength (number) -- arrowLength
chargeFieldOn Apas Cloud
Draw electric field arrows for point charges. Charges are [x, y, q, ...].
d (diagram) -- d
charges (array) -- charges
xmin (number) -- xmin
xmax (number) -- xmax
ymin (number) -- ymin
ymax (number) -- ymax
nx (number) -- nx
ny (number) -- ny
arrowLength (number) -- arrowLength
potentialContours Apas Cloud
Draw equipotential contours for point charges at the listed levels.
charges (array) -- charges
xmin (number) -- xmin
xmax (number) -- xmax
ymin (number) -- ymin
ymax (number) -- ymax
nx (number) -- nx
ny (number) -- ny
levels (array) -- levels
potentialContoursOn Apas Cloud
Draw equipotential contours for point charges at the listed levels.
d (diagram) -- d
charges (array) -- charges
xmin (number) -- xmin
xmax (number) -- xmax
ymin (number) -- ymin
ymax (number) -- ymax
nx (number) -- nx
ny (number) -- ny
levels (array) -- levels
chargeStreamlines Apas Cloud
Trace electric field lines from seed coordinates for point charges.
charges (array) -- charges
seeds (array) -- seeds
xmin (number) -- xmin
xmax (number) -- xmax
ymin (number) -- ymin
ymax (number) -- ymax
step (number) -- step
maxSteps (number) -- maxSteps
chargeStreamlinesOn Apas Cloud
Trace electric field lines from seed coordinates for point charges.
d (diagram) -- d
charges (array) -- charges
seeds (array) -- seeds
xmin (number) -- xmin
xmax (number) -- xmax
ymin (number) -- ymin
ymax (number) -- ymax
step (number) -- step
maxSteps (number) -- maxSteps
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.
kind (string) -- gtgraphics biology motif name; see zig build biology -- --list
at (point) -- motif centre in diagram coordinates
size (number) -- positive motif radius or half-height in diagram units
biologyOn Apas Cloud
Appends a Zig biology motif to a named diagram, composing with existing drawing and circuit calls.
diagram (diagram) -- target diagram
kind (string) -- gtgraphics biology motif name
at (point) -- motif centre in diagram coordinates
size (number) -- positive motif radius or half-height in diagram units
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.
diagram (diagram) -- target diagram
centre (point) -- centre of the artwork
halfWidth (number) -- half-width of the artwork
halfHeight (number) -- half-height of the artwork
anchor, label, ... (point, string) -- one or more structure positions and their labels
biologyKey Apas Cloud
Implicit-diagram version of biologyKeyOn; places numbered biology labels in an outside key.
centre (point) -- centre of the artwork
halfWidth (number) -- half-width of the artwork
halfHeight (number) -- half-height of the artwork
anchor, label, ... (point, string) -- one or more structure positions and their labels
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.
diagram (diagram) --
cx, cy, scale (numbers) -- centre and size
outside, Aonly, both, Bonly (colors) -- region fill colors
region, text, ... (number, string) -- optional elements; a region's number is 1 for in A plus 2 for in B (0 outside both, 3 in both)
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.
diagram (diagram) --
cx, cy, scale (numbers) -- centre and size
region0, ..., region7 (colors) -- fill colors in the order of the region's number: 1 for in A plus 2 for in B plus 4 for in C
region, text, ... (number, string) -- optional elements
venn Apas Cloud
Implicit-diagram version of vennOn, including inside animation frames.
cx, cy, scale (numbers) -- centre and size
outside, Aonly, both, Bonly (colors) -- region fills
region, text, ... (number, string) -- optional elements
venn3 Apas Cloud
Implicit-diagram version of venn3On, including inside animation frames.
cx, cy, scale (numbers) -- centre and size
region0, ..., region7 (colors) -- region fills
region, text, ... (number, string) -- optional elements
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.
diagram (diagram) --
min, max, tickStep (numbers) -- visible range and tick spacing
lower, upper (numbers or infinity) -- use -inf or inf for a ray
lowerClosed, upperClosed (booleans) -- filled endpoints
color (color) -- interval color
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).
diagram (diagram) --
cx, cy, scale (numbers) -- centre and size
A, B (sets or lists) -- the two sets; numbers or text
R (relation) -- a set of ordered pairs, or a list such as [[1, 2], [2, 3]]
nameA, nameB (strings) -- optional: the names written above the ovals (A and B)
color (color) -- optional: the arrows' colour (tomato), or a list of colours, one for the arrows leaving each element of A in turn
arrowDiagram Apas Cloud
Implicit-diagram version of arrowDiagramOn, also inside animation frames.
cx, cy, scale (numbers) -- centre and size
A, B (sets or lists) --
R (relation) --
nameA, nameB, color (strings) -- optional
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.
diagram (diagram) --
xmin, xmax, ymin, ymax (numbers) -- the part of the plane shown
xstep, ystep (numbers) -- optional: the spacing of the grid lines and numbers (1 and 1); they stand at the multiples of the step, so a plane from -2.5 to 2.5 is marked at -2, -1, 1, 2
yscale (number) -- optional: how many units of x one unit of y is drawn as (1); 1/3 draws y from 0 to 9 three units tall
coordinatePlane Apas Cloud
Implicit-diagram version of coordinatePlaneOn, also inside animation frames.
xmin, xmax, ymin, ymax (numbers) --
xstep, ystep, yscale (numbers) -- optional
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.
diagram (diagram) --
f (string or function) -- "x^2 - 1", or the name of a fn of one variable
a, b (numbers) -- the values of x
color (color) -- optional (steelblue)
width (number) -- optional line width (2.5)
dash (string) -- optional: "solid", "dashed" or "dotted"
functionGraph Apas Cloud
Implicit-diagram version of functionGraphOn, also inside animation frames. Call coordinatePlane first, or set xrange and yrange.
f (string or function) --
a, b (numbers) --
color, width, dash () -- optional
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.
diagram (diagram) --
x, y (numbers) --
color (color) -- optional (steelblue)
openPoint Apas Cloud
Implicit-diagram version of openPointOn.
x, y (numbers) --
color (color) -- optional
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.
diagram (diagram) --
x, y (numbers) --
color (color) -- optional (steelblue)
closedPoint Apas Cloud
Implicit-diagram version of closedPointOn.
x, y (numbers) --
color (color) -- optional
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.
diagram (diagram) --
xevery, yevery (numbers) -- the distance from one numbered mark to the next on x and on y; 0 for none
planeNumbers Apas Cloud
Implicit-diagram version of planeNumbersOn; before coordinatePlane.
xevery, yevery (numbers) -- 0 for none
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.
diagram (diagram) --
x, y (strings) -- the positive ends
xback, yback (strings) -- optional: the negative ends
planeNames Apas Cloud
Implicit-diagram version of planeNamesOn; before coordinatePlane.
x, y (strings) --
xback, yback (strings) -- optional
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.
diagram (diagram) --
show (boolean) -- true or false
planeGrid Apas Cloud
Implicit-diagram version of planeGridOn; before coordinatePlane.
show (boolean) -- true or false
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.
d (diagram) --
x, y (numbers) -- the point, in the plane's coordinates
text (string) --
side (string) -- optional, as labelAtOn: above, below, left, right, center
color (color) -- optional
size (number) -- optional (12)
planeLabel Apas Cloud
Implicit-diagram version of planeLabelOn.
x, y (numbers) --
text (string) --
side, color, size () -- optional
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.
d (diagram) --
points (list) -- each point as [angle in degrees, name]: [[55, "P (a, b)"], [-55, "Q (a, −b)"], [0, "A (1, 0)"]]
angles (list) -- each angle as [start, sweep, letter], in degrees, anticlockwise positive: [[0, 55, "x"], [0, -55, "−x"]]; [] for none
chords (list) -- optional: pairs of point numbers to join, [[1, 2]]; points count from 1 in the order given, 0 is the centre O
fill (list) -- optional: the point numbers round a region to fill, [0, 1, 2] for the triangle O, first point, second point
unitCircle Apas Cloud
Implicit-diagram version of unitCircleOn.
points (list) -- each point as [angle in degrees, name]: [[55, "P (a, b)"], [-55, "Q (a, −b)"], [0, "A (1, 0)"]]
angles (list) -- each angle as [start, sweep, letter], in degrees, anticlockwise positive: [[0, 55, "x"], [0, -55, "−x"]]; [] for none
chords (list) -- optional: pairs of point numbers to join, [[1, 2]]; points count from 1 in the order given, 0 is the centre O
fill (list) -- optional: the point numbers round a region to fill, [0, 1, 2] for the triangle O, first point, second point
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.
d (diagram) --
f (string or function) -- the rule in x, such as "tan(x)" or "1/x", or the name of a fn
xmin, xmax, ymin, ymax (numbers) -- the part of the plane shown; write pi, never 3.14
rule (string) -- optional: what is written under the plane, such as "y = tan x"
color (color) -- optional colour of the curve
textbookGraph Apas Cloud
Implicit-diagram version of textbookGraphOn.
f (string or function) --
xmin, xmax, ymin, ymax (numbers) --
rule, color () -- optional