How to use the makerjs.round function in makerjs

To help you get started, weā€™ve selected a few makerjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / maker.js / demos / js / makerjs-ventgridcircle.js View on Github external
VentgridCircle.prototype.checkCircle = function (id, circle) {
        var distanceToCenter = makerjs.measure.pointDistance([0, 0], circle.origin);
        if (makerjs.round(distanceToCenter + circle.radius) <= this.radius) {
            //inside
            this.paths[id] = circle;
        }
        else if (makerjs.round(distanceToCenter - circle.radius) > this.radius) {
        }
        else {
            //border
            var arcIntersection = makerjs.path.intersection(circle, this.rim);
            if (arcIntersection && arcIntersection.path1Angles.length == 2) {
                var filterArc = new makerjs.paths.Arc(circle.origin, circle.radius, arcIntersection.path1Angles[1], arcIntersection.path1Angles[0]);
                this.paths[id] = filterArc;
                var rimArc = new makerjs.paths.Arc([0, 0], this.radius, arcIntersection.path2Angles[0], arcIntersection.path2Angles[1]);
                this.paths[id + '_rim'] = rimArc;
            }
        }
    };
github microsoft / maker.js / demos / js / makerjs-ventgridcircle.js View on Github external
VentgridCircle.prototype.checkCircle = function (id, circle) {
        var distanceToCenter = makerjs.measure.pointDistance([0, 0], circle.origin);
        if (makerjs.round(distanceToCenter + circle.radius) <= this.radius) {
            //inside
            this.paths[id] = circle;
        }
        else if (makerjs.round(distanceToCenter - circle.radius) > this.radius) {
        }
        else {
            //border
            var arcIntersection = makerjs.path.intersection(circle, this.rim);
            if (arcIntersection && arcIntersection.path1Angles.length == 2) {
                var filterArc = new makerjs.paths.Arc(circle.origin, circle.radius, arcIntersection.path1Angles[1], arcIntersection.path1Angles[0]);
                this.paths[id] = filterArc;
                var rimArc = new makerjs.paths.Arc([0, 0], this.radius, arcIntersection.path2Angles[0], arcIntersection.path2Angles[1]);
                this.paths[id + '_rim'] = rimArc;
            }
        }
    };
    return VentgridCircle;

makerjs

Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

Apache-2.0
Latest version published 6 months ago

Package Health Score

74 / 100
Full package analysis