mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-20 23:41:49 +02:00
code comments
This commit is contained in:
@@ -28,11 +28,15 @@ draw() {
|
||||
|
||||
plotDistanceFunction(w, h, len) {
|
||||
noFill();
|
||||
|
||||
// There is no way we're capturing the distance function as a nice
|
||||
// easy function, so instead we're going to do the next best thing:
|
||||
// sample the curve at a number of points, and then construct the
|
||||
// function plot as we walk from one sample to the next.
|
||||
let LUT = curve.getLUT(this.steps * 10);
|
||||
let d = 0;
|
||||
start();
|
||||
vertex(0,0);
|
||||
for(let i=1, e=LUT.length, p1, p2; i<e; i++) {
|
||||
for(let i=1, e=LUT.length, p1, p2, d=0; i<e; i++) {
|
||||
p1 = LUT[i-1];
|
||||
p2 = LUT[i];
|
||||
d += dist(p1.x, p1.y, p2.x, p2.y);
|
||||
|
@@ -23,9 +23,12 @@ draw() {
|
||||
scale(0.85);
|
||||
translate(30,30);
|
||||
|
||||
// This first part is the same as the previous graphic
|
||||
setFill(`black`);
|
||||
drawAxes("t", 0, 1, "d", 0, len|0, w, h);
|
||||
let LUT = this.plotDistanceFunction(w, h, len);
|
||||
|
||||
// but this part is new.
|
||||
this.drawPlotIntervals(w, h, LUT);
|
||||
|
||||
resetTransform();
|
||||
|
Reference in New Issue
Block a user