added fillet support.

This commit is contained in:
Dan Marshall
2015-08-02 15:16:29 -07:00
parent 2ae5d73bec
commit 1e09af91c5
2 changed files with 232 additions and 14 deletions
+28 -3
View File
@@ -11,9 +11,13 @@ function test() {
var model: MakerJs.IModel = models[0];
function testRoot() {
makerjs.cloneObject({});
makerjs.extendObject({abc:123}, {xyz:789});
makerjs.isModel({});
makerjs.isPath({});
makerjs.isPathArc(paths.arc);
makerjs.isPathCircle(paths.circle);
makerjs.isPathLine(paths.line);
makerjs.isPoint([]);
makerjs.pathType.Circle;
makerjs.round(44.44444, .01);
@@ -24,6 +28,9 @@ function test() {
makerjs.angle.mirror(45, true, false);
makerjs.angle.noRevolutions(90);
makerjs.angle.ofArcEnd(paths.arc);
makerjs.angle.ofArcMiddle(paths.arc);
makerjs.angle.ofLineInDegrees(paths.line);
makerjs.angle.ofPointInDegrees([0,0], [1,1]);
makerjs.angle.ofPointInRadians([0,0], [1,1]);
makerjs.angle.toDegrees(Math.PI);
makerjs.angle.toRadians(90);
@@ -45,6 +52,10 @@ function test() {
function testMeasure() {
makerjs.measure.arcAngle(paths.arc);
makerjs.measure.isArcConcaveTowardsPoint(paths.arc, [0,0]);
makerjs.measure.isBetween(7, 8, 9, false);
makerjs.measure.isBetweenArcAngles(7, paths.arc, false);
makerjs.measure.isBetweenPoints([1,1], paths.line, true);
makerjs.measure.modelExtents(model).high[0];
makerjs.measure.pathExtents(paths.circle).low[0];
makerjs.measure.pathLength(paths.line);
@@ -55,6 +66,7 @@ function test() {
makerjs.model.convertUnits(model, makerjs.unitType.Centimeter);
makerjs.model.mirror(model, false, true);
makerjs.model.move(makerjs.model.originate(model, [9,9]), [0,0]);
makerjs.model.moveRelative(model, [1,1]);
makerjs.model.originate(model);
makerjs.model.rotate(makerjs.model.scale(model, 6), 45, [0,0]);
}
@@ -76,28 +88,41 @@ function test() {
}
function testPath() {
makerjs.path.breakAtPoint(paths.arc, [0,0]).type;
makerjs.path.intersection(paths.circle, paths.arc).intersectionPoints;
makerjs.path.breakAtPoint(paths.arc, [0,0]).type;
makerjs.path.dogbone(paths.line, paths.line, 7);
makerjs.path.fillet(paths.arc, paths.line, 4);
makerjs.path.intersection(paths.circle, paths.arc, { excludeTangents: true }).intersectionPoints;
makerjs.path.mirror(paths.arc, true, true);
makerjs.path.move(paths.line, [1,1]);
makerjs.path.moveRelative(paths.circle, [0,0]);
makerjs.path.rotate(paths.line, 5, [0,0]);
makerjs.path.scale(paths.arc, 8);
makerjs.path.slopeIntersectionPoint(paths.line, paths.line);
}
function testPaths() {
return {
var paths = {
arc: new makerjs.paths.Arc([0,0], 7, 0, 180),
circle: new MakerJs.paths.Circle([0,0], 5),
line: new makerjs.paths.Line([0,0], [1,1])
};
new makerjs.paths.Chord(paths.arc);
new makerjs.paths.Parallel(paths.line, 4, [1,1]);
return paths;
}
function testPoint() {
makerjs.point.add(p1, p2);
makerjs.point.areEqual(p1, p2);
makerjs.point.areEqualRounded(p1, p2);
makerjs.point.clone(p1);
makerjs.point.closest([0,0], [p1, p2]);
makerjs.point.fromAngleOnCircle(22, paths.circle);
makerjs.point.fromArc(paths.arc);
makerjs.point.fromPolar(Math.PI, 7);
makerjs.point.middle(paths.line);
makerjs.point.mirror(p1, true, false);
makerjs.point.rotate(p1, 5, p2);
makerjs.point.scale(p2, 8);