mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-23 00:45:07 +01:00
44 lines
No EOL
991 B
TypeScript
44 lines
No EOL
991 B
TypeScript
import {MObject} from './mobject';
|
|
import {MBrepShell} from "./mshell";
|
|
import {EntityKind} from "cad/model/entities";
|
|
import {Edge} from "brep/topo/edge";
|
|
import Vector from "math/vector";
|
|
|
|
export class MEdge extends MObject {
|
|
|
|
static TYPE = EntityKind.EDGE;
|
|
shell: MBrepShell;
|
|
brepEdge: Edge;
|
|
|
|
constructor(id, shell, brepEdge) {
|
|
super(MEdge.TYPE, id);
|
|
this.shell = shell;
|
|
this.brepEdge = brepEdge;
|
|
}
|
|
|
|
get adjacentFaces() {
|
|
let out = [];
|
|
let face = this.shell.brepRegistry.get(this.brepEdge.halfEdge1 && this.brepEdge.halfEdge1.loop.face);
|
|
if (face) {
|
|
out.push(face);
|
|
}
|
|
face = this.shell.brepRegistry.get(this.brepEdge.halfEdge2 && this.brepEdge.halfEdge2.loop.face);
|
|
if (face) {
|
|
out.push(face);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
get favorablePoint() {
|
|
return this.brepEdge.curve.middlePoint();
|
|
}
|
|
|
|
get parent() {
|
|
return this.shell;
|
|
}
|
|
|
|
toDirection(): Vector {
|
|
return this.brepEdge.halfEdge1.tangentAtStart();
|
|
};
|
|
|
|
} |