mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-30 11:40:27 +02:00
.
This commit is contained in:
@@ -19,9 +19,6 @@ setup() {
|
||||
draw() {
|
||||
clear();
|
||||
|
||||
setStroke(`lightgrey`);
|
||||
drawGrid(20);
|
||||
|
||||
setStroke(this.parameters.showCurves ? `transparent` : `#CC00CC99`);
|
||||
for (let i=0, e=points.length-1, p, n; i<e; i++) {
|
||||
p = points[i];
|
||||
|
@@ -16,7 +16,7 @@ setup() {
|
||||
});
|
||||
|
||||
points = points.concat(points.slice(0,3));
|
||||
setMovable(points);
|
||||
setMovable(points);;
|
||||
}
|
||||
|
||||
setWeight(i, v) {
|
||||
@@ -26,9 +26,6 @@ setWeight(i, v) {
|
||||
draw() {
|
||||
clear();
|
||||
|
||||
setStroke(`lightgrey`);
|
||||
drawGrid(20);
|
||||
|
||||
setStroke(`#CC00CC99`);
|
||||
for (let i=0, e=points.length-1, p, n; i<e; i++) {
|
||||
p = points[i];
|
||||
|
@@ -34,9 +34,6 @@ setKnotValue(i, v) {
|
||||
draw() {
|
||||
clear();
|
||||
|
||||
setStroke(`lightgrey`);
|
||||
drawGrid(20);
|
||||
|
||||
setStroke(`#CC00CC99`);
|
||||
for (let i=0, e=points.length-1, p, n; i<e; i++) {
|
||||
p = points[i];
|
||||
|
@@ -26,9 +26,6 @@ setKnotValue(i, v) {
|
||||
draw() {
|
||||
clear();
|
||||
|
||||
setStroke(`lightgrey`);
|
||||
drawGrid(20);
|
||||
|
||||
setStroke(`#CC00CC99`);
|
||||
for (let i=0, e=points.length-1, p, n; i<e; i++) {
|
||||
p = points[i];
|
||||
|
@@ -21,8 +21,6 @@ transformTension(v) {
|
||||
|
||||
draw() {
|
||||
clear();
|
||||
setStroke(`lightgrey`);
|
||||
drawGrid(20);
|
||||
|
||||
const p = points, n = points.length;
|
||||
for (let i=1, e=n-2; i<e; i++) {
|
||||
|
@@ -15,8 +15,6 @@ toggle() {
|
||||
|
||||
draw() {
|
||||
clear();
|
||||
setColor('lightgrey');
|
||||
drawGrid(10);
|
||||
|
||||
setColor('black');
|
||||
setFontSize(16);
|
||||
|
@@ -18,8 +18,7 @@ The following graphic applies this algorithm to a pair of cubic curves, one step
|
||||
|
||||
<graphics-element title="Curve/curve intersections" width="825" src="./curve-curve.js">
|
||||
<button class="next">Advance one step</button>
|
||||
<button class="reset">Reset</button>
|
||||
<input type="range" min="0.01" max="1" step="0.01" value="1" class="slide-control">
|
||||
<input type="range" min="0.01" max="5" step="0.01" value="1" class="slide-control">
|
||||
</graphics-element>
|
||||
|
||||
Finding self-intersections is effectively the same procedure, except that we're starting with a single curve, so we need to turn that into two separate curves first. This is trivially achieved by splitting at an inflection point, or if there are none, just splitting at `t=0.5` first, and then running the exact same algorithm as above, with all non-overlapping curve pairs getting removed at each iteration, and each successive step homing in on the curve's self-intersection points.
|
||||
|
@@ -29,12 +29,6 @@ setupEventListening() {
|
||||
this.step++;
|
||||
redraw();
|
||||
});
|
||||
|
||||
let reset = find(`.reset`);
|
||||
if (reset) reset.listen([`click`,`touchstart`], evt => {
|
||||
this.pairReset();
|
||||
redraw();
|
||||
});
|
||||
}
|
||||
|
||||
draw() {
|
||||
|
@@ -30,8 +30,6 @@ module.exports = {
|
||||
draw: function(api, curve) {
|
||||
api.setPanelCount(1);
|
||||
api.reset();
|
||||
api.setColor('lightgrey');
|
||||
api.drawGrid(10,10);
|
||||
|
||||
api.setColor('black');
|
||||
|
||||
|
@@ -23,8 +23,6 @@ bindButtons() {
|
||||
|
||||
draw() {
|
||||
clear();
|
||||
setStroke(`lightgrey`);
|
||||
drawGrid(20);
|
||||
this.drawCurve();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user