organizing brep package - move extensions to brepIO

This commit is contained in:
Val Erastov (xibyte) 2020-07-20 00:36:33 -07:00
parent bf2d6386c9
commit 6956ffda32
3 changed files with 48 additions and 22 deletions

View file

@ -29,14 +29,14 @@ export default class BrepBuilder {
return this._loop.halfEdges[this._loop.halfEdges.length - 1];
}
face(surface?: BrepSurface = null): BrepBuilder {
face(surface?: BrepSurface): BrepBuilder {
this._face = new Face(surface ? surface : null);
this._shell.faces.push(this._face);
this._loop = null;
return this;
}
loop(vertices: Vertex[]): BrepBuilder {
loop(vertices?: Vertex[]): BrepBuilder {
if (this._loop === null) {
this._loop = this._face.outerLoop;
} else {

View file

@ -1,7 +1,8 @@
import BrepBuilder, {createBoundingSurfaceFrom2DPoints, createBoundingSurfaceFromBBox} from '../brep-builder';
import BrepBuilder, {createBoundingSurfaceFromBBox} from '../brep-builder';
import VertexFactory from '../vertexFactory';
import NurbsSurface from 'geom/surfaces/nurbsSurface';
import * as vec from 'math/vec';
import {Vec3} from 'math/vec';
import {BrepSurface} from 'geom/surfaces/brepSurface';
import {Plane} from 'geom/impl/plane';
import Vector from 'math/vector';
@ -10,6 +11,49 @@ import BBox from 'math/bbox';
import NurbsCurve from 'geom/curves/nurbsCurve';
import BrepCurve from 'geom/curves/brepCurve';
import {BREPData} from "../../../web/app/cad/craft/engine/brepData";
import {ProductionInfo} from "../../../web/app/cad/craft/engine/productionInfo";
import {Tessellation1D} from "../../../web/app/cad/craft/engine/tessellation";
//Extensions for topo objects
declare module '../topo/shell' {
interface Shell {
data: {
externals: {
ptr?: number
}
}
}
}
declare module '../topo/face' {
interface Face {
data: {
id: string,
productionInfo: ProductionInfo,
tessellation: {
format: string,
data: any;
}
externals: {
ref: number
}
}
}
}
declare module '../topo/edge' {
interface Edge {
data: {
tessellation: Tessellation1D<Vec3>
externals: {
ptr?: number
}
}
}
}
export function readBrep(data: BREPData) {

View file

@ -4,27 +4,9 @@ import PIP from '../../../web/app/cad/tess/pip';
import {veq} from "geom/tolerance";
import {isOnPositiveHalfPlaneFromVec} from "../operations/boolean";
import {BrepSurface} from "geom/surfaces/brepSurface";
import {edgesGenerator, Shell} from "./shell";
import {ProductionInfo} from "../../../web/app/cad/craft/engine/productionInfo";
import {Shell} from "./shell";
import {HalfEdge} from "brep/topo/edge";
declare module './face' {
interface Face {
data: {
id: string,
productionInfo: ProductionInfo,
tessellation: {
format: string,
data: any;
}
externals: {
ref: number
}
}
}
}
export class Face extends TopoObject {