1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-30 03:30:34 +02:00

Rational bezier (#208)

* .

* meh

* rational beziers
This commit is contained in:
Pomax
2019-08-18 17:13:27 -07:00
committed by GitHub
parent d8dffb0cda
commit 782c509850
28 changed files with 3041 additions and 2466 deletions

View File

@@ -342,6 +342,43 @@ window["Bezier Section Handlers"] = {
});
}
}
};
}())
},
"weightcontrol": {
handler: (function() { var ratios;
return {
drawCubic: function(api) {
var curve = new api.Bezier(
120, 160,
35, 200,
220, 260,
220, 40
);
api.setCurve(curve);
},
drawCurve: function(api, curve) {
api.reset();
api.drawSkeleton(curve);
api.drawCurve(curve);
},
setRatio: function(api, values) {
ratios = values;
this.update(api);
},
changeRatio: function(api, value, pos) {
ratios[pos] = parseFloat(value) || 0.00001;
this.update(api);
},
update: function(api) {
api.curve.setRatios(ratios.slice());
this.drawCurve(api, api.curve);
}
};
}())
},
@@ -626,6 +663,12 @@ var Reordering = {
var Mt = transpose(M);
var Mc = multiply(Mt, M);
var Mi = invert(Mc);
if (!Mi) {
console.error('MtM has no inverse?');
return curve;
}
var V = multiply(Mi, Mt);
// And then we map our k-order list of coordinates