bitbybit-occt
Advanced tools
Comparing version 0.9.28 to 0.9.29
@@ -211,4 +211,4 @@ import { Base } from "./inputs"; | ||
/** | ||
* Provide options without default values | ||
*/ | ||
* Provide options without default values | ||
*/ | ||
constructor(shape?: T); | ||
@@ -252,2 +252,68 @@ /** | ||
} | ||
class FaceSubdivisionControlledDto<T> { | ||
/** | ||
* Provide options without default values | ||
*/ | ||
constructor(shape?: T); | ||
/** | ||
* Brep OpenCascade geometry | ||
*/ | ||
shape?: T; | ||
/** | ||
* Number of subdivisions on U direction | ||
*/ | ||
nrDivisionsU: number; | ||
/** | ||
* Number of subdivisions on V direction | ||
*/ | ||
nrDivisionsV: number; | ||
/** | ||
* Shift half step every nth U row | ||
*/ | ||
shiftHalfStepNthU: number; | ||
/** | ||
* Offset for shift half step every nth U row | ||
*/ | ||
shiftHalfStepUOffsetN: number; | ||
/** | ||
* Removes start edge points on U | ||
*/ | ||
removeStartEdgeNthU: number; | ||
/** | ||
* Offset for remove start edge points on U | ||
*/ | ||
removeStartEdgeUOffsetN: number; | ||
/** | ||
* Removes end edge points on U | ||
*/ | ||
removeEndEdgeNthU: number; | ||
/** | ||
* Offset for remove end edge points on U | ||
*/ | ||
removeEndEdgeUOffsetN: number; | ||
/** | ||
* Shift half step every nth V row | ||
*/ | ||
shiftHalfStepNthV: number; | ||
/** | ||
* Offset for shift half step every nth V row | ||
*/ | ||
shiftHalfStepVOffsetN: number; | ||
/** | ||
* Removes start edge points on V | ||
*/ | ||
removeStartEdgeNthV: number; | ||
/** | ||
* Offset for remove start edge points on V | ||
*/ | ||
removeStartEdgeVOffsetN: number; | ||
/** | ||
* Removes end edge points on V | ||
*/ | ||
removeEndEdgeNthV: number; | ||
/** | ||
* Offset for remove end edge points on V | ||
*/ | ||
removeEndEdgeVOffsetN: number; | ||
} | ||
class FaceLinearSubdivisionDto<T> { | ||
@@ -254,0 +320,0 @@ /** |
@@ -127,4 +127,4 @@ // tslint:disable-next-line: no-namespace | ||
/** | ||
* Provide options without default values | ||
*/ | ||
* Provide options without default values | ||
*/ | ||
constructor(shape) { | ||
@@ -159,2 +159,35 @@ /** | ||
OCCT.FaceSubdivisionDto = FaceSubdivisionDto; | ||
class FaceSubdivisionControlledDto { | ||
/** | ||
* Provide options without default values | ||
*/ | ||
constructor(shape) { | ||
/** | ||
* Offset for shift half step every nth U row | ||
*/ | ||
this.shiftHalfStepUOffsetN = 0; | ||
/** | ||
* Offset for remove start edge points on U | ||
*/ | ||
this.removeStartEdgeUOffsetN = 0; | ||
/** | ||
* Offset for remove end edge points on U | ||
*/ | ||
this.removeEndEdgeUOffsetN = 0; | ||
/** | ||
* Offset for shift half step every nth V row | ||
*/ | ||
this.shiftHalfStepVOffsetN = 0; | ||
/** | ||
* Offset for remove start edge points on V | ||
*/ | ||
this.removeStartEdgeVOffsetN = 0; | ||
/** | ||
* Offset for remove end edge points on V | ||
*/ | ||
this.removeEndEdgeVOffsetN = 0; | ||
this.shape = shape; | ||
} | ||
} | ||
OCCT.FaceSubdivisionControlledDto = FaceSubdivisionControlledDto; | ||
class FaceLinearSubdivisionDto { | ||
@@ -161,0 +194,0 @@ /** |
@@ -17,2 +17,3 @@ import { Geom_Surface, OpenCascadeInstance, TopoDS_Face, TopoDS_Shape, TopoDS_Wire } from '../../../bitbybit-dev-occt/bitbybit-dev-occt'; | ||
getVMaxBound(inputs: Inputs.OCCT.ShapeDto<TopoDS_Face>): number; | ||
subdivideToPointsControlled(inputs: Inputs.OCCT.FaceSubdivisionControlledDto<TopoDS_Face>): Base.Point3[]; | ||
subdivideToPoints(inputs: Inputs.OCCT.FaceSubdivisionDto<TopoDS_Face>): Base.Point3[]; | ||
@@ -19,0 +20,0 @@ subdivideToNormals(inputs: Inputs.OCCT.FaceSubdivisionDto<TopoDS_Face>): Base.Point3[]; |
@@ -90,2 +90,45 @@ import { shapeTypeEnum, typeSpecificityEnum } from '../../occ-helper'; | ||
} | ||
subdivideToPointsControlled(inputs) { | ||
const face = inputs.shape; | ||
let handle = this.occ.BRep_Tool.Surface_2(face); | ||
var surface = handle.get(); | ||
const { uMin, uMax, vMin, vMax } = this.och.getUVBounds(face); | ||
const points = []; | ||
for (var i = 0; i < inputs.nrDivisionsU; i++) { | ||
const stepU = (uMax - uMin) / (inputs.nrDivisionsU - 1); | ||
const halfStepU = stepU / 2; | ||
const stepsU = stepU * i; | ||
for (var j = 0; j < inputs.nrDivisionsV; j++) { | ||
const stepV = (vMax - vMin) / (inputs.nrDivisionsV - 1); | ||
const halfStepV = stepV / 2; | ||
const stepsV = stepV * j; | ||
var v = vMin + stepsV; | ||
v += (inputs.shiftHalfStepNthV && (i + inputs.shiftHalfStepVOffsetN) % inputs.shiftHalfStepNthV === 0) ? halfStepV : 0; | ||
var u = uMin + stepsU; | ||
u += (inputs.shiftHalfStepNthU && (j + inputs.shiftHalfStepUOffsetN) % inputs.shiftHalfStepNthU === 0) ? halfStepU : 0; | ||
const gpPnt = this.och.gpPnt([0, 0, 0]); | ||
surface.D0(u, v, gpPnt); | ||
const pt = [gpPnt.X(), gpPnt.Y(), gpPnt.Z()]; | ||
let shouldPush = true; | ||
if (i === 0 && inputs.removeStartEdgeNthU && (j + inputs.removeStartEdgeUOffsetN) % inputs.removeStartEdgeNthU === 0) { | ||
shouldPush = false; | ||
} | ||
else if (i === inputs.nrDivisionsU - 1 && inputs.removeEndEdgeNthU && (j + inputs.removeEndEdgeUOffsetN) % inputs.removeEndEdgeNthU === 0) { | ||
shouldPush = false; | ||
} | ||
else if (j === 0 && inputs.removeStartEdgeNthV && (i + inputs.removeStartEdgeVOffsetN) % inputs.removeStartEdgeNthV === 0) { | ||
shouldPush = false; | ||
} | ||
else if (j === inputs.nrDivisionsV - 1 && inputs.removeEndEdgeNthV && (i + inputs.removeEndEdgeVOffsetN) % inputs.removeEndEdgeNthV === 0) { | ||
shouldPush = false; | ||
} | ||
if (shouldPush) { | ||
points.push(pt); | ||
} | ||
gpPnt.delete(); | ||
} | ||
} | ||
handle.delete(); | ||
return points; | ||
} | ||
subdivideToPoints(inputs) { | ||
@@ -92,0 +135,0 @@ const face = inputs.shape; |
{ | ||
"name": "bitbybit-occt", | ||
"version": "0.9.28", | ||
"version": "0.9.29", | ||
"description": "Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel. Run in Node and in Browser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13179196
18573