mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-27 10:15:05 +02:00
full regeneration
This commit is contained in:
@@ -18,6 +18,9 @@ draw() {
|
||||
curve.drawCurve();
|
||||
curve.drawPoints();
|
||||
|
||||
// Start with complete nonsense min/max values, where
|
||||
// min is huge and max is tiny, so we can bring them
|
||||
// down and up, respectively.
|
||||
|
||||
let minx = Number.MAX_SAFE_INTEGER,
|
||||
miny = minx,
|
||||
@@ -28,6 +31,7 @@ draw() {
|
||||
noFill();
|
||||
setStroke(`red`);
|
||||
|
||||
// For each extremum, see if that changes the bbox values.
|
||||
[0, ...extrema.x, ...extrema.y, 1].forEach(t => {
|
||||
let p = curve.get(t);
|
||||
if (p.x < minx) minx = p.x;
|
||||
@@ -37,6 +41,7 @@ draw() {
|
||||
if (t > 0 && t< 1) circle(p.x, p.y, 3);
|
||||
});
|
||||
|
||||
// And we're done.
|
||||
setStroke(`#0F0`);
|
||||
rect(minx, miny, maxx - minx, maxy - miny);
|
||||
}
|
||||
|
Reference in New Issue
Block a user