geometrix 0.5.29 → 0.5.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +23 -1
- package/dist/index.js +33 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -615,8 +615,30 @@ declare class Transform3d {
|
|
|
615
615
|
}
|
|
616
616
|
declare function transform3d(initM?: tT3dMatrix): Transform3d;
|
|
617
617
|
|
|
618
|
+
/**
|
|
619
|
+
* The rectangle-origin is bottom-left.
|
|
620
|
+
*/
|
|
618
621
|
declare function ctrRectangle(ox: number, oy: number, width: number, height: number, cornerRounded?: number): tContour;
|
|
622
|
+
/**
|
|
623
|
+
* The rectangle-origin is bottom-left.
|
|
624
|
+
*/
|
|
619
625
|
declare function ctrRectRot(ox: number, oy: number, width: number, height: number, angle: number, cornerRounded?: number): tContour;
|
|
626
|
+
/**
|
|
627
|
+
* The rectangle-origin is middle-left.
|
|
628
|
+
*/
|
|
629
|
+
declare function ctrRectRot2(ox: number, oy: number, width: number, height: number, angle: number, cornerRounded?: number): tContour;
|
|
630
|
+
/**
|
|
631
|
+
* The trapezoid-origin is bottom-left.
|
|
632
|
+
*/
|
|
633
|
+
declare function ctrTrapezoid(ox: number, oy: number, bottomWidth: number, topWidth: number, height: number, cornerRounded?: number): tContour;
|
|
634
|
+
/**
|
|
635
|
+
* The trapezoid-origin is middle-left.
|
|
636
|
+
*/
|
|
637
|
+
declare function ctrTrapezoidRot2(ox: number, oy: number, leftSide: number, rightSide: number, Hlength: number, angle: number, cornerRounded?: number): tContour;
|
|
638
|
+
/**
|
|
639
|
+
* The oblong-origin is middle-left.
|
|
640
|
+
*/
|
|
641
|
+
declare function ctrOblong(ox: number, oy: number, Vwidth: number, Hlength: number, angle: number): tContour;
|
|
620
642
|
|
|
621
643
|
/** For cli-app and ui-app */
|
|
622
644
|
type tDependencies = Record<string, string>;
|
|
@@ -631,4 +653,4 @@ declare function version_details(appPackage: tPackage): string[];
|
|
|
631
653
|
|
|
632
654
|
declare function checkImpPages(pages: tAllPageDef): [boolean, string];
|
|
633
655
|
|
|
634
|
-
export { Contour, ContourCircle, DesignParam, DxfSeg, DxfWrite, EBVolume, EExtrude, EFormat, Figure, Line, PSeg, PType, PaxPath, Point, SegDbg, SegEnum, Segment1, Segment2, ShapePoint, Transform3d, Vector, aBFromLaLbAa, aCFromAaAb, aCFromLaLbLc, adjustCenter, adjustInit, adjustRect, adjustScale, adjustTranslate, adjustZero, arcSeg1To2, arcSeg2To1, bisector, canvas2point, canvasTranslatePolar, checkGeom, checkImpPages, circleCenter, colors, contour, contourCircle, copyLayers, createParamFile, ctrRectRot, ctrRectangle, degToRad, designParam, dxfSegArc, dxfSegCircle, dxfSegLine, dxfWriter, ffix, figure, fileBin, fileBinContent, fileMime, fileSuffix, fileTextContent, fround, gSegDbg, initGeom, initLayers, isActiveCorner, isAddPoint, isCorner, isSeg, isWithin, lbFromLaAaAb, lcFromLaLbAc, line, linePP, makeCorner, mergeFaces, oneDesignParam, orientedArc, pCheckbox, pDropdown, pNumber, pSectionSeparator, paramListToVal, parseParamFile, paxCircle, paxPath, point, point2canvas, pointMinMax, prefixLog, radToDeg, radius2canvas, rightTriLaFromLbLc, rightTriLbFromLaLc, roundZero, type tAffine, type tAllLink, type tAllPageDef, type tBVolume, type tCanvasAdjust, type tCartesian, type tContour, type tDependencies, type tDesignParamList, type tDesignParamOne, type tExtrude, type tFaces, type tGeom, type tGeomFunc, type tInherit, type tLayers, type tPackage, type tPageDef, type tParam, type tParamChanged, type tParamDef, type tParamVal, type tParamValInFile, type tPaxContour, type tPaxContourCircle, type tPaxContourPath, type tPaxSeg, type tPaxSegArc, type tPaxSegSt, type tPolar, type tPosiOrien, type tSimTime, type tSubDesign, type tSubInst, type tT3dMatrix, type tVec3, type tVec4, type tVolume, tolerance, transform3d, vector, version_details, withinHPiHPi, withinPiPi, withinZero2Pi, withinZeroPi, zeroPDef };
|
|
656
|
+
export { Contour, ContourCircle, DesignParam, DxfSeg, DxfWrite, EBVolume, EExtrude, EFormat, Figure, Line, PSeg, PType, PaxPath, Point, SegDbg, SegEnum, Segment1, Segment2, ShapePoint, Transform3d, Vector, aBFromLaLbAa, aCFromAaAb, aCFromLaLbLc, adjustCenter, adjustInit, adjustRect, adjustScale, adjustTranslate, adjustZero, arcSeg1To2, arcSeg2To1, bisector, canvas2point, canvasTranslatePolar, checkGeom, checkImpPages, circleCenter, colors, contour, contourCircle, copyLayers, createParamFile, ctrOblong, ctrRectRot, ctrRectRot2, ctrRectangle, ctrTrapezoid, ctrTrapezoidRot2, degToRad, designParam, dxfSegArc, dxfSegCircle, dxfSegLine, dxfWriter, ffix, figure, fileBin, fileBinContent, fileMime, fileSuffix, fileTextContent, fround, gSegDbg, initGeom, initLayers, isActiveCorner, isAddPoint, isCorner, isSeg, isWithin, lbFromLaAaAb, lcFromLaLbAc, line, linePP, makeCorner, mergeFaces, oneDesignParam, orientedArc, pCheckbox, pDropdown, pNumber, pSectionSeparator, paramListToVal, parseParamFile, paxCircle, paxPath, point, point2canvas, pointMinMax, prefixLog, radToDeg, radius2canvas, rightTriLaFromLbLc, rightTriLbFromLaLc, roundZero, type tAffine, type tAllLink, type tAllPageDef, type tBVolume, type tCanvasAdjust, type tCartesian, type tContour, type tDependencies, type tDesignParamList, type tDesignParamOne, type tExtrude, type tFaces, type tGeom, type tGeomFunc, type tInherit, type tLayers, type tPackage, type tPageDef, type tParam, type tParamChanged, type tParamDef, type tParamVal, type tParamValInFile, type tPaxContour, type tPaxContourCircle, type tPaxContourPath, type tPaxSeg, type tPaxSegArc, type tPaxSegSt, type tPolar, type tPosiOrien, type tSimTime, type tSubDesign, type tSubInst, type tT3dMatrix, type tVec3, type tVec4, type tVolume, tolerance, transform3d, vector, version_details, withinHPiHPi, withinPiPi, withinZero2Pi, withinZeroPi, zeroPDef };
|
package/dist/index.js
CHANGED
|
@@ -4059,6 +4059,35 @@ function ctrRectRot(ox, oy, width, height, angle, cornerRounded = 0) {
|
|
|
4059
4059
|
const rCtr = ctrRectangle(ox, oy, width, height, cornerRounded).rotate(ox, oy, angle);
|
|
4060
4060
|
return rCtr;
|
|
4061
4061
|
}
|
|
4062
|
+
function ctrRectRot2(ox, oy, width, height, angle, cornerRounded = 0) {
|
|
4063
|
+
const dpx = height / 2 * Math.sin(angle);
|
|
4064
|
+
const dpy = -height / 2 * Math.cos(angle);
|
|
4065
|
+
const rCtr = ctrRectRot(ox + dpx, oy + dpy, width, height, angle, cornerRounded);
|
|
4066
|
+
return rCtr;
|
|
4067
|
+
}
|
|
4068
|
+
function ctrTrapezoid(ox, oy, bottomWidth, topWidth, height, cornerRounded = 0) {
|
|
4069
|
+
const dw2 = (topWidth - bottomWidth) / 2;
|
|
4070
|
+
const rCtr = contour(ox, oy).addCornerRounded(cornerRounded).addSegStrokeR(bottomWidth, 0).addCornerRounded(cornerRounded).addSegStrokeR(dw2, height).addCornerRounded(cornerRounded).addSegStrokeR(-topWidth, 0).addCornerRounded(cornerRounded).closeSegStroke();
|
|
4071
|
+
return rCtr;
|
|
4072
|
+
}
|
|
4073
|
+
function ctrTrapezoidRot2(ox, oy, leftSide, rightSide, Hlength, angle, cornerRounded = 0) {
|
|
4074
|
+
const dw2 = (rightSide - leftSide) / 2;
|
|
4075
|
+
const dpx = leftSide / 2 * Math.sin(angle);
|
|
4076
|
+
const dpy = leftSide / 2 * Math.cos(angle);
|
|
4077
|
+
const ctr1 = contour(ox, oy).addCornerRounded(cornerRounded).addSegStrokeR(0, -leftSide).addCornerRounded(cornerRounded).addSegStrokeR(-dw2, Hlength).addCornerRounded(cornerRounded).addSegStrokeR(0, rightSide).addCornerRounded(cornerRounded).closeSegStroke();
|
|
4078
|
+
const rCtr = ctr1.rotate(ox, oy, angle).translate(-dpx, dpy);
|
|
4079
|
+
return rCtr;
|
|
4080
|
+
}
|
|
4081
|
+
function ctrOblong(ox, oy, Vwidth, Hlength, angle) {
|
|
4082
|
+
if (Hlength < Vwidth) {
|
|
4083
|
+
throw `err821: Hlength ${Hlength} is too small compare to Vwidth ${Vwidth}`;
|
|
4084
|
+
}
|
|
4085
|
+
const dpy = Vwidth / 2;
|
|
4086
|
+
const dpx = Hlength - Vwidth;
|
|
4087
|
+
const ctr1 = contour(dpy + dpx, -dpy).addPointA(dpy + dpx, dpy).addSegArc(dpy, false, true).addSegStrokeA(dpy, dpy).addPointA(dpy, -dpy).addSegArc(dpy, false, true).closeSegStroke();
|
|
4088
|
+
const rCtr = ctr1.rotate(0, 0, angle).translate(ox, oy);
|
|
4089
|
+
return rCtr;
|
|
4090
|
+
}
|
|
4062
4091
|
|
|
4063
4092
|
// src/version_details.ts
|
|
4064
4093
|
function version_details(appPackage) {
|
|
@@ -4137,8 +4166,12 @@ export {
|
|
|
4137
4166
|
contourCircle,
|
|
4138
4167
|
copyLayers,
|
|
4139
4168
|
createParamFile,
|
|
4169
|
+
ctrOblong,
|
|
4140
4170
|
ctrRectRot,
|
|
4171
|
+
ctrRectRot2,
|
|
4141
4172
|
ctrRectangle,
|
|
4173
|
+
ctrTrapezoid,
|
|
4174
|
+
ctrTrapezoidRot2,
|
|
4142
4175
|
degToRad,
|
|
4143
4176
|
designParam,
|
|
4144
4177
|
dxfSegArc,
|