rename addPolygon to addRectangle in tests

This commit is contained in:
Val Erastov 2019-02-19 11:49:29 -08:00
parent a67bd9bfe7
commit 007d67b7bb
7 changed files with 31 additions and 30 deletions

View file

@ -7,7 +7,7 @@ export function testCutMid(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(-50, -50, 50, 50);
sui.addRectangle(-50, -50, 50, 50);
ui.commitSketch();
ui.openWizard('CUT');
@ -22,7 +22,7 @@ export function testCutCOI1Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, 0, 80, 100);
sui.addRectangle(0, 0, 80, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -37,7 +37,7 @@ export function testCutCOI2Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, 0, 100, 100);
sui.addRectangle(0, 0, 100, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -52,7 +52,7 @@ export function testCutCOI3Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, -100, 100, 100);
sui.addRectangle(0, -100, 100, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -67,7 +67,7 @@ export function testCutCOI4Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(-100, -100, 100, 100);
sui.addRectangle(-100, -100, 100, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -84,7 +84,7 @@ export function testCutMidAllWay(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(-50, -50, 50, 50);
sui.addRectangle(-50, -50, 50, 50);
ui.commitSketch();
ui.openWizard('CUT');
@ -99,7 +99,7 @@ export function testCutCOI1FacesAllWay(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, 0, 80, 100);
sui.addRectangle(0, 0, 80, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -114,7 +114,7 @@ export function testCutCOI2FacesAllWay(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, 0, 100, 100);
sui.addRectangle(0, 0, 100, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -129,7 +129,7 @@ export function testCutCOI3FacesAllWay(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, -100, 100, 100);
sui.addRectangle(0, -100, 100, 100);
ui.commitSketch();
ui.openWizard('CUT');
@ -144,7 +144,7 @@ export function testCutCOI4FacesAllWay(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(-100, -100, 100, 100);
sui.addRectangle(-100, -100, 100, 100);
ui.commitSketch();
ui.openWizard('CUT');

View file

@ -7,7 +7,7 @@ export function testExtrudeMid(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(-50, -50, 50, 50);
sui.addRectangle(-50, -50, 50, 50);
ui.commitSketch();
ui.openWizard('EXTRUDE');
@ -22,7 +22,7 @@ export function testExtrudeCOI1Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, 0, 80, 100);
sui.addRectangle(0, 0, 80, 100);
ui.commitSketch();
ui.openWizard('EXTRUDE');
@ -37,7 +37,7 @@ export function testExtrudeCOI2Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, 0, 100, 100);
sui.addRectangle(0, 0, 100, 100);
ui.commitSketch();
ui.openWizard('EXTRUDE');
@ -52,7 +52,7 @@ export function testExtrudeCOI3Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(0, -100, 100, 100);
sui.addRectangle(0, -100, 100, 100);
ui.commitSketch();
ui.openWizard('EXTRUDE');
@ -67,7 +67,7 @@ export function testExtrudeCOI4Faces(env, ui) {
ui.selectFaces([0, 0, 210], [0, 0, 190]);
let sui = ui.openSketcher();
sui.addPolygon(-100, -100, 100, 100);
sui.addRectangle(-100, -100, 100, 100);
ui.commitSketch();
ui.openWizard('EXTRUDE');

View file

@ -6,7 +6,7 @@ export const TEST_MODE = 'modellerUI';
export function testExtrudePrism(env, ui) {
let sketcherUI = createPlaneAndOpenSketcher(ui);
let sketchedFace = ui.context.services.selection.face.single;
let [S1, S2, S3, S4] = sketcherUI.addPolygon(-100, -100, 100, 100);
let [S1, S2, S3, S4] = sketcherUI.addRectangle(-100, -100, 100, 100);
// let gauge = ui.prismSurfaceGauge([-100, -100, 0], [100, -100, 0], [50, 50, 0], [-50, 50, 0] );
//

View file

@ -4,7 +4,7 @@ export const TEST_MODE = 'modellerUI';
export function testLoftOver2Sections(env, ui) {
let sui = createPlaneAndOpenSketcher(ui);
sui.addPolygon(-100, -100, 100, 100);
sui.addRectangle(-100, -100, 100, 100);
ui.commitSketch();
ui.openWizard('PLANE');
@ -12,7 +12,7 @@ export function testLoftOver2Sections(env, ui) {
ui.wizardOK();
ui.selectFaces([0, 0, 290], [0, 0, 310]);
sui = ui.openSketcher();
sui.addSerpinski([-100, 0], [100, 0], 2);
sui.addRectangle([0, -100], [100, 100], [-100, 100]);
ui.commitSketch();
ui.openWizard('LOFT');

View file

@ -5,7 +5,7 @@ export const TEST_MODE = 'modellerUI';
export function testRevolveHalfWay(env, ui) {
createPlaneAndOpenSketcher(ui);
let sui = ui.openSketcher();
sui.addPolygon(20, -50, 50, 50);
sui.addRectangle(20, -50, 50, 50);
sui.changeToConstructionLayer();
sui.addSegment(0, -50, 0, 50);
ui.commitSketch();
@ -21,7 +21,7 @@ export function testRevolveHalfWay(env, ui) {
export function testRevolveAllWay(env, ui) {
createPlaneAndOpenSketcher(ui);
let sui = ui.openSketcher();
sui.addPolygon(20, -50, 50, 50);
sui.addRectangle(20, -50, 50, 50);
sui.changeToConstructionLayer();
sui.addSegment(0, -50, 0, 50);
ui.commitSketch();

View file

@ -8,7 +8,7 @@ export function createPlaneAndOpenSketcher(ui) {
export function extrudeCube(ui) {
let sketcherUI = createPlaneAndOpenSketcher(ui);
sketcherUI.addPolygon(-100, -100, 100, 100);
sketcherUI.addRectangle(-100, -100, 100, 100);
ui.commitSketch();
ui.selectFaces([0, 0, -10], [0, 0, 10]);
ui.openWizard('EXTRUDE');

View file

@ -28,7 +28,7 @@ export function createSubjectFromInPlaceSketcher(ctx) {
const addEllipticalArc = sketcher_utils.addEllipticalArc.bind(this, oldStyleSketcherApp);
const addBezier = sketcher_utils.addBezier.bind(this, oldStyleSketcherApp);
const move = sketcher_utils.moveInModel.bind(this, oldStyleSketcherApp);
function addPolygon(x0, y0, x1, y1) {
function addRectangle(x0, y0, x1, y1) {
return [
addSegment(x0, y0, x1, y0),
addSegment(x1, y0, x1, y1),
@ -40,24 +40,25 @@ export function createSubjectFromInPlaceSketcher(ctx) {
function addSerpinski([ax, ay], [bx, by], depth) {
genSerpinskiImpl(ctx.services.sketcher.inPlaceEditor.viewer, {x: ax, y: ay}, {x: bx, y: by}, depth);
let jointWidth = distance(ax, ay, bx, by) / (depth + 1) / 2;
let dx = bx - ax;
let dy = by - ay;
let D = Math.sqrt(dx*dx + dy*dy);
dx /= D;
dy /= D;
let ddx = -dy * jointWidth;
let ddy = dx * jointWidth;
genSerpinskiImpl(ctx.services.sketcher.inPlaceEditor.viewer, {x: bx-ddx, y: by-ddy}, {x: ax-ddx, y: ay-ddy}, depth);
addSegment(ax, ay, ax-ddx, ay-ddy);
addSegment(bx, by, bx-ddx, by-ddy);
}
function addPolygon(points) {
let p, q, n = points.length;
for(p = n - 1, q = 0; q < n; p = q++) {
addSegment(p, q);
}
}
function changeLayer(layerName) {
ctx.services.sketcher.inPlaceEditor.viewer.setActiveLayerName(layerName);
}
@ -71,8 +72,8 @@ export function createSubjectFromInPlaceSketcher(ctx) {
}
return {
addSegment, addPolygon, addArc, addCircle, addEllipse, addEllipticalArc, addSerpinski, addBezier,
move, changeLayer, changeToConstructionLayer, changeToDefaultLayer,
addSegment, addRectangle, addArc, addCircle, addEllipse, addEllipticalArc, addSerpinski, addBezier, addPolygon,
move, changeLayer, changeToConstructionLayer, changeToDefaultLayer
}
}