Points, polygons and geometry helpers
examples/07-points-and-polygons.axis
"Points and polygons"
folder "Single points" { A = (-4, 2) @ color: RED, pointSize: 15, label: "A", showLabel B = (0, 5) @ color: BLUE, pointSize: 15, label: "B", showLabel C = (4, 1) @ color: GREEN, pointSize: 15, label: "C", showLabel}
// polygon takes points, or one list of points.polygon(A, B, C) @ color: PURPLE, fill, fillOpacity: 0.2, lineWidth: 3
folder "Geometry helpers" { "distance and midpoint read two points." side = distance(A, B) @ hidden M = midpoint(A, C) @ color: ORANGE, pointSize: 15, label: "midpoint", showLabel "The median from B to that midpoint." Q = [B, M] @ color: ORANGE, lines, points: false, lineStyle: DASHED}
folder "A polygon from a list" { "Building the list first keeps the shape editable in one place." S = [(-6, -2), (-2, -2), (-2, -6), (-6, -6)] @ hidden polygon(S) @ color: RED, fill, fillOpacity: 0.35}
folder "Point coordinates" { "A point's parts are read with .x and .y" D = (3, -4) @ color: BLUE, pointSize: 15, dragMode: XY "Drag D - these follow it." (D.x, 0) @ color: BLUE, pointStyle: OPEN, pointSize: 12 (0, D.y) @ color: BLUE, pointStyle: OPEN, pointSize: 12 y = D.y @ color: BLUE, lineOpacity: 0.3, lineStyle: DOTTED x = D.x @ color: BLUE, lineOpacity: 0.3, lineStyle: DOTTED}Open in playground →