Skip to content

Commit a15cf57

Browse files
unit tests written for occt edge api. fixed a bug of subidividing edge into points.
1 parent e861618 commit a15cf57

File tree

5 files changed

+404
-58
lines changed

5 files changed

+404
-58
lines changed

src/lib/workers/occ/occ-helper.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,17 +616,14 @@ export class OccHelper {
616616

617617
divideEdgeByParamsToPoints(inputs: Inputs.OCCT.DivideDto<TopoDS_Edge>): Inputs.Base.Point3[] {
618618
const edge = inputs.shape;
619-
const { uMin, uMax } = this.getEdgeBounds(edge);
620619
const wire = this.combineEdgesAndWiresIntoAWire({ shapes: [edge] });
621-
const curve = new this.occ.BRepAdaptor_CompCurve_2(wire, false);
622-
return this.divideCurveToNrSegments({ ...inputs, shape: curve }, uMin, uMax);
620+
return this.divideWireByParamsToPoints({ ...inputs, shape: wire });
623621
}
624622

625623
divideEdgeByEqualDistanceToPoints(inputs: Inputs.OCCT.DivideDto<TopoDS_Edge>): Base.Point3[] {
626624
const edge = inputs.shape;
627625
const wire = this.combineEdgesAndWiresIntoAWire({ shapes: [edge] });
628-
const curve = new this.occ.BRepAdaptor_CompCurve_2(wire, false);
629-
return this.divideCurveByEqualLengthDistance({ ...inputs, shape: curve });
626+
return this.divideWireByEqualDistanceToPoints({ ...inputs, shape: wire });
630627
}
631628

632629
pointOnEdgeAtParam(inputs: Inputs.OCCT.DataOnGeometryAtParamDto<TopoDS_Edge>): Base.Point3 {
@@ -922,7 +919,7 @@ export class OccHelper {
922919
const edgeHash = edge.HashCode(100000000);
923920
if (!edgeHashes.hasOwnProperty(edgeHash)) {
924921
edgeHashes[edgeHash] = edgeIndex;
925-
edgeIndex = edgeIndex += 1;
922+
edgeIndex++;
926923
callback(edgeIndex, edge);
927924
}
928925
}

0 commit comments

Comments
 (0)