jsketcher/web/app/cad/model/msketchObject.ts
2022-06-25 15:19:47 -07:00

30 lines
No EOL
757 B
TypeScript

import {MObject} from './mobject';
import {MFace} from "./mface";
import {EntityKind} from "cad/model/entities";
import Vector from "math/vector";
import {Segment} from "cad/sketch/sketchModel";
export class MSketchObject extends MObject {
static TYPE = EntityKind.SKETCH_OBJECT;
face: MFace;
sketchPrimitive: any;
construction: boolean;
constructor(face, sketchPrimitive) {
super(MSketchObject.TYPE, sketchPrimitive.id);
this.face = face;
this.sketchPrimitive = sketchPrimitive;
this.construction = false;
}
get parent() {
return this.face;
}
toDirection(): Vector {
const tangent = (this.sketchPrimitive as Segment).tangentAtStart();
return this.face.sketchToWorldTransformation.apply(tangent);
};
}