diff --git a/modules/brep/brep-builder.ts b/modules/brep/brep-builder.ts index b82fee53..480d458a 100644 --- a/modules/brep/brep-builder.ts +++ b/modules/brep/brep-builder.ts @@ -29,7 +29,7 @@ export default class BrepBuilder { return this._loop.halfEdges[this._loop.halfEdges.length - 1]; } - face(surface: BrepSurface): BrepBuilder { + face(surface?: BrepSurface = null): BrepBuilder { this._face = new Face(surface ? surface : null); this._shell.faces.push(this._face); this._loop = null; diff --git a/modules/brep/brep-primitives.js b/modules/brep/brep-primitives.js index 2e401bd7..159a526b 100644 --- a/modules/brep/brep-primitives.js +++ b/modules/brep/brep-primitives.js @@ -1,6 +1,6 @@ import {Point} from 'geom/point' import {Plane} from 'geom/impl/plane' -import {createPrism, enclose} from './brep-enclose' +import {createPrism, enclose} from './operations/brep-enclose' import {Circle} from '../../web/app/cad/sketch/sketchModel' import CSys from 'math/csys'; import {Matrix3x4} from 'math/matrix'; diff --git a/modules/brep/brep-enclose.js b/modules/brep/operations/brep-enclose.js similarity index 94% rename from modules/brep/brep-enclose.js rename to modules/brep/operations/brep-enclose.js index 8ee31db6..4086860f 100644 --- a/modules/brep/brep-enclose.js +++ b/modules/brep/operations/brep-enclose.js @@ -1,10 +1,10 @@ -import {Shell} from './topo/shell'; -import {Face} from './topo/face'; -import {Edge} from './topo/edge'; +import {Shell} from '../topo/shell'; +import {Face} from '../topo/face'; +import {Edge} from '../topo/edge'; import BrepCurve from 'geom/curves/brepCurve'; import {Plane} from 'geom/impl/plane'; -import * as cad_utils from '../../web/app/cad/cad-utils'; -import {createBoundingSurface} from './brep-builder'; +import * as cad_utils from '../../../web/app/cad/cad-utils'; +import {createBoundingSurface} from '../brep-builder'; import NurbsSurface from 'geom/surfaces/nurbsSurface'; import {BrepSurface} from 'geom/surfaces/brepSurface'; import {Matrix3x4} from 'math/matrix'; diff --git a/modules/brep/null-face-merge.js b/modules/brep/operations/null-face-merge.js similarity index 96% rename from modules/brep/null-face-merge.js rename to modules/brep/operations/null-face-merge.js index 9ebfb361..209d84be 100644 --- a/modules/brep/null-face-merge.js +++ b/modules/brep/operations/null-face-merge.js @@ -1,4 +1,4 @@ -import {Edge} from './topo/edge' +import {Edge} from '../topo/edge' import {equal} from "math/equality"; export default function({curve, start}) { diff --git a/modules/brep/stitching.js b/modules/brep/operations/stitching.js similarity index 97% rename from modules/brep/stitching.js rename to modules/brep/operations/stitching.js index 52737109..a7316bf0 100644 --- a/modules/brep/stitching.js +++ b/modules/brep/operations/stitching.js @@ -1,4 +1,4 @@ -import {DoubleKeyMap} from '../../web/app/utils/utils' +import {DoubleKeyMap} from '../../../web/app/utils/utils' export const FACE_CHUNK = 'stitching.face.chunk'; export const EDGE_CHUNK = 'stitching.edge.chunk'; diff --git a/modules/brep/vertexFactory.js b/modules/brep/vertexFactory.ts similarity index 69% rename from modules/brep/vertexFactory.js rename to modules/brep/vertexFactory.ts index bb2b7b8d..3c32ac4a 100644 --- a/modules/brep/vertexFactory.js +++ b/modules/brep/vertexFactory.ts @@ -1,14 +1,18 @@ import {Vertex} from './topo/vertex'; import {veqXYZ} from 'geom/tolerance'; import {Point} from 'geom/point'; +import {XYZ} from "math/xyz"; +import {VectorData} from "math/vec"; export default class VertexFactory { + vertices: Vertex[]; + constructor() { this.vertices = []; } - get(_x, _y, _z) { + get(_x: number, _y: number, _z: number): Vertex { for (let vertex of this.vertices) { let {x, y, z} = vertex.point; if (veqXYZ(_x, _y, _z, x, y, z)) { @@ -20,11 +24,11 @@ export default class VertexFactory { return v; } - getPoint({x, y, z}) { + getPoint({x, y, z}: XYZ): Vertex { return this.get(x, y, z); } - getData([x, y, z]) { + getData([x, y, z]: VectorData): Vertex { return this.get(x, y, z); } } diff --git a/web/app/cad/craft/booleanOperation.js b/web/app/cad/craft/booleanOperation.js index e299ae8a..85273dbe 100644 --- a/web/app/cad/craft/booleanOperation.js +++ b/web/app/cad/craft/booleanOperation.js @@ -1,5 +1,5 @@ import {intersect, subtract, union} from 'brep/operations/boolean'; -import {update as updateStitching} from 'brep/stitching'; +import {update as updateStitching} from 'brep/operations/stitching'; import {BREPValidator} from 'brep/brep-validator'; import {Shell} from 'brep/topo/shell'; import {MBrepShell} from '../model/mshell'; diff --git a/web/app/cad/craft/cutExtrude/cutExtrude.js b/web/app/cad/craft/cutExtrude/cutExtrude.js index da253822..0130e7cc 100644 --- a/web/app/cad/craft/cutExtrude/cutExtrude.js +++ b/web/app/cad/craft/cutExtrude/cutExtrude.js @@ -1,4 +1,4 @@ -import {enclose} from 'brep/brep-enclose' +import {enclose} from 'brep/operations/brep-enclose' import {BooleanOperation, combineShells} from '../booleanOperation' import {Matrix3x4} from 'math/matrix'; import {equal} from 'math/equality'; diff --git a/web/app/cad/exposure/exposure.js b/web/app/cad/exposure/exposure.js index f24ffb97..3dbf5be9 100644 --- a/web/app/cad/exposure/exposure.js +++ b/web/app/cad/exposure/exposure.js @@ -1,6 +1,6 @@ import * as BREPPrimitives from 'brep/brep-primitives' import BrepBuilder, {createBoundingSurface} from 'brep/brep-builder' -import {createPrism} from 'brep/brep-enclose' +import {createPrism} from 'brep/operations/brep-enclose' import * as BREPBool from 'brep/operations/boolean' import * as IO from 'brep/io/brepLoopsFormat' import {BREPValidator} from 'brep/brep-validator' diff --git a/web/app/cad/scene/selectionMarker/selectionMarker.js b/web/app/cad/scene/selectionMarker/selectionMarker.js index f74507b8..28b9e6ae 100644 --- a/web/app/cad/scene/selectionMarker/selectionMarker.js +++ b/web/app/cad/scene/selectionMarker/selectionMarker.js @@ -1,4 +1,4 @@ -import * as stitching from 'brep/stitching' +import * as stitching from 'brep/operations/stitching' import {AbstractSelectionMarker, setFacesColor} from "./abstractSelectionMarker"; export class SelectionMarker extends AbstractSelectionMarker {