All files / lib/services/shapes vertex.ts

90% Statements 9/10
100% Branches 0/0
90% Functions 9/10
88.88% Lines 8/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46                                  8x       6x       1x 1x       1x       1x       1x       1x      
import { OpenCascadeInstance, TopoDS_Vertex, TopoDS_Shape, TopoDS_Compound } from "../../../bitbybit-dev-occt/bitbybit-dev-occt";
import { OccHelper } from "../../occ-helper";
import * as Inputs from "../../api/inputs/inputs";
 
export class OCCTVertex {
 
    constructor(
        private readonly occ: OpenCascadeInstance,
        private readonly och: OccHelper
    ) {
    }
 
    vertexFromXYZ(inputs: Inputs.OCCT.XYZDto): TopoDS_Vertex {
        return this.och.entitiesService.makeVertex([inputs.x, inputs.y, inputs.z]);
    }
 
    vertexFromPoint(inputs: Inputs.OCCT.PointDto): TopoDS_Vertex {
        return this.och.entitiesService.makeVertex(inputs.point);
    }
 
    verticesFromPoints(inputs: Inputs.OCCT.PointsDto): TopoDS_Vertex[] {
        return inputs.points.map(p => this.vertexFromPoint({ point: p }));
    }
 
    verticesCompoundFromPoints(inputs: Inputs.OCCT.PointsDto): TopoDS_Compound {
        const vertexes = this.verticesFromPoints(inputs);
        return this.och.converterService.makeCompound({ shapes: vertexes });
    }
 
    getVertices(inputs: Inputs.OCCT.ShapeDto<TopoDS_Shape>): TopoDS_Vertex[] {
        return this.och.shapeGettersService.getVertices(inputs);
    }
 
    getVerticesAsPoints(inputs: Inputs.OCCT.ShapeDto<TopoDS_Shape>): Inputs.Base.Point3[] {
        return this.och.verticesService.getVerticesAsPoints(inputs);
    }
 
    verticesToPoints(inputs: Inputs.OCCT.ShapesDto<TopoDS_Vertex>): Inputs.Base.Point3[] {
        return this.och.verticesService.verticesToPoints(inputs);
    }
 
    vertexToPoint(inputs: Inputs.OCCT.ShapeDto<TopoDS_Vertex>): Inputs.Base.Point3 {
        return this.och.converterService.vertexToPoint(inputs);
    }
}