Globals include
Flatten.js
(
docs
),
draw
, and
Math
.
[
GitHub
]
Download SVG
Reset View
A = point 0, 0 B = point 100, 0 C = point 75, -75 pts = [A, B, C] draw (polygon pts), stroke: 'cyan' for pt, i in pts edge = line pts[(i+1) % 3], pts[(i+2) % 3] proj = pt.projectionOn edge draw segment pt, proj draw proj, fill: 'purple' draw pt for pt in pts