diff --git a/web/app/3d/craft/brep/cut-extrude.js b/web/app/3d/craft/brep/cut-extrude.js index 9636995a..710cd0b1 100644 --- a/web/app/3d/craft/brep/cut-extrude.js +++ b/web/app/3d/craft/brep/cut-extrude.js @@ -3,7 +3,7 @@ import * as math from '../../../math/math' import Vector from '../../../math/vector' import {Extruder} from '../../../brep/brep-builder' import {BREPValidator} from '../../../brep/brep-validator' -import * as approx from '../../../brep/approx' +import * as stitching from '../../../brep/stitching' import {subtract, union} from '../../../brep/operations/boolean' import {Loop} from '../../../brep/topo/loop' import {Shell} from '../../../brep/topo/shell' @@ -51,7 +51,7 @@ export function doOperation(app, params, cut) { if (cut) throw 'unable to cut plane'; result = operand; } - approx.update(result); + stitching.update(result); const newSolid = new BREPSceneSolid(result); return { outdated: [solid], @@ -113,10 +113,10 @@ export class ParametricExtruder extends Extruder { onWallCallback(wallFace, baseHalfEdge) { const conn = baseHalfEdge.vertexA.point.sketchConnectionObject; if (conn && isCurveClass(conn._class)) { - if (!conn.approxSurface) { - conn.approxSurface = new approx.ApproxSurface(); + if (!conn.stitchedSurface) { + conn.stitchedSurface = new stitching.StitchedSurface(); } - conn.approxSurface.addFace(wallFace); + conn.stitchedSurface.addFace(wallFace); } } } diff --git a/web/app/3d/scene/brep-scene-object.js b/web/app/3d/scene/brep-scene-object.js index ef8f5c63..435ddffd 100644 --- a/web/app/3d/scene/brep-scene-object.js +++ b/web/app/3d/scene/brep-scene-object.js @@ -1,5 +1,5 @@ import Vector from '../../math/vector' -import {EDGE_AUX} from '../../brep/approx' +import {EDGE_AUX} from '../../brep/stitching' import {Triangulate} from '../../3d/triangulation' import {SceneSolid, SceneFace} from './scene-object' diff --git a/web/app/3d/selection.js b/web/app/3d/selection.js index 05a0fc48..f78f1c82 100644 --- a/web/app/3d/selection.js +++ b/web/app/3d/selection.js @@ -1,5 +1,5 @@ import DPR from '../utils/dpr' -import * as approx from '../brep/approx' +import * as stitching from '../brep/stitching' class AbstractSelectionManager { @@ -81,9 +81,9 @@ export class EdgeSelectionManager extends AbstractSelectionManager { select(line) { this._clearSilent(); const edge = line.__TCAD_EDGE; - const approxCurve = edge.data[approx.EDGE_CHUNK]; - if (approxCurve) { - for (let edgeChunk of approxCurve.edges) { + const stitchedCurve = edge.data[stitching.EDGE_CHUNK]; + if (stitchedCurve) { + for (let edgeChunk of stitchedCurve.edges) { this.mark(edgeChunk.data['scene.edge']); } } else { @@ -158,9 +158,9 @@ export class SelectionManager extends AbstractSelectionManager { return sceneFace.curvedSurfaces; } if (sceneFace.brepFace) { - const approxFace = sceneFace.brepFace.data[approx.FACE_CHUNK]; - if (approxFace) { - return approxFace.faces.map(f => f.data['scene.face']); + const stitchedFace = sceneFace.brepFace.data[stitching.FACE_CHUNK]; + if (stitchedFace) { + return stitchedFace.faces.map(f => f.data['scene.face']); } } return undefined; diff --git a/web/app/brep/approx.js b/web/app/brep/stitching.js similarity index 50% rename from web/app/brep/approx.js rename to web/app/brep/stitching.js index 574c6532..eb60d4d7 100644 --- a/web/app/brep/approx.js +++ b/web/app/brep/stitching.js @@ -1,10 +1,10 @@ import {DoubleKeyMap} from '../utils/utils' -export const FACE_CHUNK = 'approx.face.chunk'; -export const EDGE_CHUNK = 'approx.edge.chunk'; -export const EDGE_AUX = 'approx.edge.aux'; +export const FACE_CHUNK = 'stitching.face.chunk'; +export const EDGE_CHUNK = 'stitching.edge.chunk'; +export const EDGE_AUX = 'stitching.edge.aux'; -export class ApproxSurface { +export class StitchedSurface { constructor() { this.faces = []; } @@ -20,7 +20,7 @@ export class ApproxSurface { } -export class ApproxCurve { +export class StitchedCurve { constructor(surface1, surface2) { this.surface1 = surface1; this.surface2 = surface2; @@ -33,7 +33,7 @@ export class ApproxCurve { } equals(other) { - return other instanceof ApproxCurve && + return other instanceof StitchedCurve && ((this.surface1 == other.surface1 && this.surface2 == other.surface2) || @@ -47,29 +47,29 @@ export class ApproxCurve { export function update(shell) { const index = new DoubleKeyMap(); for (let face of shell.faces) { - const approxSurface = face.data[FACE_CHUNK]; - if (approxSurface) { - approxSurface.clear(); + const stitchedSurface = face.data[FACE_CHUNK]; + if (stitchedSurface) { + stitchedSurface.clear(); } } for (let face of shell.faces) { - const approxSurface = face.data[FACE_CHUNK]; - if (approxSurface) { - approxSurface.addFace(face); + const stitchedSurface = face.data[FACE_CHUNK]; + if (stitchedSurface) { + stitchedSurface.addFace(face); } } for (let e of shell.edges) { const face1 = e.halfEdge1.loop.face; const face2 = e.halfEdge2.loop.face; - const approxSurface1 = face1.data[FACE_CHUNK]; - const approxSurface2 = face2.data[FACE_CHUNK]; - if (approxSurface1 !== undefined && approxSurface1 === approxSurface2) { - e.data[EDGE_AUX] = approxSurface1; - } else if (approxSurface1 !== undefined || approxSurface2 !== undefined ) { - const o1 = approxSurface1 !== undefined ? approxSurface1 : face1.surface; - const o2 = approxSurface2 !== undefined ? approxSurface2 : face2.surface; - const approxCurve = getCurve(index, o1, o2); - approxCurve.addEdge(e); + const stitchedSurface1 = face1.data[FACE_CHUNK]; + const stitchedSurface2 = face2.data[FACE_CHUNK]; + if (stitchedSurface1 !== undefined && stitchedSurface1 === stitchedSurface2) { + e.data[EDGE_AUX] = stitchedSurface1; + } else if (stitchedSurface1 !== undefined || stitchedSurface2 !== undefined ) { + const o1 = stitchedSurface1 !== undefined ? stitchedSurface1 : face1.surface; + const o2 = stitchedSurface2 !== undefined ? stitchedSurface2 : face2.surface; + const stitchedCurve = getCurve(index, o1, o2); + stitchedCurve.addEdge(e); } } } @@ -77,7 +77,7 @@ export function update(shell) { export function getCurve(index, o1, o2) { let curve = index.get(o1, o2); if (curve == null) { - curve = new ApproxCurve(o1, o2); + curve = new StitchedCurve(o1, o2); index.set(o1, o2, curve); } return curve;