mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-01-18 22:18:00 +01:00
25 lines
539 B
JavaScript
25 lines
539 B
JavaScript
module.exports = {
|
|
setupQuadratic: function(api) {
|
|
var curve = api.getDefaultQuadratic();
|
|
api.setCurve(curve);
|
|
},
|
|
|
|
setupCubic: function(api) {
|
|
var curve = api.getDefaultCubic();
|
|
api.setCurve(curve);
|
|
},
|
|
|
|
draw: function(api, curve) {
|
|
api.reset();
|
|
api.setColor("#00FF00");
|
|
api.drawbbox(curve.bbox());
|
|
api.setColor("black");
|
|
api.drawSkeleton(curve);
|
|
api.drawCurve(curve);
|
|
api.setColor("red");
|
|
curve.extrema().values.forEach(t => {
|
|
api.drawCircle(curve.get(t), 3);
|
|
});
|
|
}
|
|
};
|