geometrix 0.5.23 → 0.5.25

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 CHANGED
@@ -445,7 +445,8 @@ declare function copyLayers(iLayers: tLayers): tLayers;
445
445
  declare enum PType {
446
446
  eNumber = 0,
447
447
  eCheckbox = 1,
448
- eDropdown = 2
448
+ eDropdown = 2,
449
+ eSectionSeparator = 3
449
450
  }
450
451
  interface tParam {
451
452
  name: string;
@@ -468,6 +469,7 @@ interface tParamDef {
468
469
  paramSvg: Record<string, string>;
469
470
  sim: tSimTime;
470
471
  }
472
+ declare const zeroPDef: tParamDef;
471
473
  type tParamVal = Record<string, number>;
472
474
  type tParamChanged = Record<string, boolean>;
473
475
  interface tDesignParamOne {
@@ -503,6 +505,7 @@ declare function designParam(iparamDef: tParamDef, suffix?: string): DesignParam
503
505
  declare function pNumber(name: string, unit: string, init: number, min?: number, max?: number, step?: number): tParam;
504
506
  declare function pCheckbox(name: string, init: boolean): tParam;
505
507
  declare function pDropdown(name: string, values: string[]): tParam;
508
+ declare function pSectionSeparator(name: string): tParam;
506
509
 
507
510
  type tPosiOrien = [number, number, number];
508
511
  interface tSubInst {
@@ -581,20 +584,36 @@ declare enum EFormat {
581
584
  eJSCAD = 6,
582
585
  eZIP = 7
583
586
  }
584
- declare function fileTextContent(fgeom: tGeomFunc, paramVal: tParamVal, eFace: string, exportFormat: EFormat): string;
585
- declare function fileBinContent(fgeom: tGeomFunc, tSim: number, paramVal: tParamVal, exportFormat: EFormat): Promise<Blob>;
587
+ declare function fileTextContent(fgeom: tGeomFunc, paramVal: tParamVal, ipDef: tParamDef, eFace: string, exportFormat: EFormat): string;
588
+ declare function fileBinContent(fgeom: tGeomFunc, tSim: number, paramVal: tParamVal, ipDef: tParamDef, exportFormat: EFormat): Promise<Blob>;
586
589
  declare function fileMime(exportFormat: EFormat): string;
587
590
  declare function fileSuffix(exportFormat: EFormat): string;
588
591
  declare function fileBin(exportFormat: EFormat): boolean;
589
592
 
590
593
  interface tParamValInFile {
591
594
  lastModif: string;
595
+ partName: string;
592
596
  pVal: tParamVal;
593
597
  comment: string;
594
598
  }
595
- declare function createParamFile(lastModif: string, idparams: tParamVal, comment: string): string;
599
+ declare function createParamFile(lastModif: string, iPartName: string, idparams: tParamVal, comment: string): string;
596
600
  declare function parseParamFile(fContentStr: string): [tParamValInFile, string];
597
601
 
602
+ type tVec3 = [number, number, number];
603
+ type tVec4 = [number, number, number, number];
604
+ type tT3dMatrix = [tVec4, tVec4, tVec4, tVec4];
605
+ declare class Transform3d {
606
+ mmat: tT3dMatrix;
607
+ constructor(iMat: tT3dMatrix);
608
+ addRotation(ax: number, ay: number, az: number): void;
609
+ addTranslation(ax: number, ay: number, az: number): void;
610
+ getMatrix(): tT3dMatrix;
611
+ getRotation(): tVec3;
612
+ getTranslation(): tVec3;
613
+ transform(iv: tVec3): tVec3;
614
+ }
615
+ declare function transform3d(initM?: tT3dMatrix): Transform3d;
616
+
598
617
  /** For cli-app and ui-app */
599
618
  type tDependencies = Record<string, string>;
600
619
  /** For cli-app and ui-app */
@@ -608,4 +627,4 @@ declare function version_details(appPackage: tPackage): string[];
608
627
 
609
628
  declare function checkImpPages(pages: tAllPageDef): [boolean, string];
610
629
 
611
- export { Contour, ContourCircle, DesignParam, DxfSeg, DxfWrite, EBVolume, EExtrude, EFormat, Figure, Line, PSeg, PType, PaxPath, Point, SegDbg, SegEnum, Segment1, Segment2, ShapePoint, Vector, aBFromLaLbAa, aCFromAaAb, aCFromLaLbLc, adjustCenter, adjustInit, adjustRect, adjustScale, adjustTranslate, adjustZero, arcSeg1To2, arcSeg2To1, bisector, canvas2point, canvasTranslatePolar, checkGeom, checkImpPages, circleCenter, colors, contour, contourCircle, copyLayers, createParamFile, 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, 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 tVolume, tolerance, vector, version_details, withinHPiHPi, withinPiPi, withinZero2Pi, withinZeroPi };
630
+ 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, 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
@@ -1799,13 +1799,15 @@ var Contour = class _Contour extends AContour {
1799
1799
  const p0p2middle = p0.middlePoint(p2);
1800
1800
  const a0 = p0p2middle.angleToPoint(p0);
1801
1801
  const a1 = p0p2middle.angleToPoint(p1);
1802
- const a3 = p0p2middle.angleToPoint(p3);
1803
1802
  const a01 = withinPiPi(a1 - a0);
1804
- const a03 = withinPiPi(a3 - a0);
1805
1803
  let large = false;
1806
1804
  let ccw = false;
1807
- if (Math.sign(a03) * Math.sign(a01) > 0) {
1808
- large = true;
1805
+ if (!p0p2middle.isEqual(p3)) {
1806
+ const a3 = p0p2middle.angleToPoint(p3);
1807
+ const a03 = withinPiPi(a3 - a0);
1808
+ if (Math.sign(a03) * Math.sign(a01) > 0) {
1809
+ large = true;
1810
+ }
1809
1811
  }
1810
1812
  if (Math.sign(a01) > 0) {
1811
1813
  ccw = true;
@@ -2737,8 +2739,19 @@ var PType = /* @__PURE__ */ ((PType2) => {
2737
2739
  PType2[PType2["eNumber"] = 0] = "eNumber";
2738
2740
  PType2[PType2["eCheckbox"] = 1] = "eCheckbox";
2739
2741
  PType2[PType2["eDropdown"] = 2] = "eDropdown";
2742
+ PType2[PType2["eSectionSeparator"] = 3] = "eSectionSeparator";
2740
2743
  return PType2;
2741
2744
  })(PType || {});
2745
+ var zeroPDef = {
2746
+ partName: "",
2747
+ params: [],
2748
+ paramSvg: {},
2749
+ sim: {
2750
+ tMax: 0,
2751
+ tStep: 0,
2752
+ tUpdate: 0
2753
+ }
2754
+ };
2742
2755
  function oneDesignParam(iVal, iInit, iChg) {
2743
2756
  const oneDP = { val: iVal, init: iInit, chg: iChg };
2744
2757
  return oneDP;
@@ -2878,6 +2891,19 @@ function pDropdown(name, values) {
2878
2891
  };
2879
2892
  return rParam;
2880
2893
  }
2894
+ function pSectionSeparator(name) {
2895
+ const rParam = {
2896
+ name,
2897
+ unit: "section-separator",
2898
+ init: 0,
2899
+ min: 0,
2900
+ max: 0,
2901
+ step: 0,
2902
+ dropdown: [],
2903
+ pType: 3 /* eSectionSeparator */
2904
+ };
2905
+ return rParam;
2906
+ }
2881
2907
 
2882
2908
  // src/volume.ts
2883
2909
  var EExtrude = /* @__PURE__ */ ((EExtrude2) => {
@@ -2945,9 +2971,10 @@ var PaxWrite = class {
2945
2971
  }
2946
2972
  return figFaces;
2947
2973
  }
2948
- getPaxJson(paramVal, geome0) {
2974
+ getPaxJson(paramVal, geome0, ipDef) {
2949
2975
  const rPaxJson = {
2950
2976
  partName: geome0.partName,
2977
+ pDef: ipDef,
2951
2978
  params: paramVal,
2952
2979
  faces: this.getFigures(geome0.fig),
2953
2980
  volume: geome0.vol,
@@ -2956,8 +2983,8 @@ var PaxWrite = class {
2956
2983
  };
2957
2984
  return rPaxJson;
2958
2985
  }
2959
- getPaxStr(paramVal, geome0) {
2960
- const paxJson = this.getPaxJson(paramVal, geome0);
2986
+ getPaxStr(paramVal, geome0, ipDef) {
2987
+ const paxJson = this.getPaxJson(paramVal, geome0, ipDef);
2961
2988
  const rStr = JSON.stringify(paxJson, null, 2);
2962
2989
  return rStr;
2963
2990
  }
@@ -3254,7 +3281,7 @@ module ${inherit.outName} () {
3254
3281
  if (vol.inherits !== void 0) {
3255
3282
  const subGeoms = this.getAllSubGeoms(vol.inherits);
3256
3283
  for (const oneGeom of subGeoms) {
3257
- const paxJson = paxWrite().getPaxJson({}, oneGeom);
3284
+ const paxJson = paxWrite().getPaxJson({}, oneGeom, zeroPDef);
3258
3285
  rStr += this.getAllFigures(paxJson.faces, paxJson.partName);
3259
3286
  rStr += this.getVolume(oneGeom.vol);
3260
3287
  }
@@ -3503,7 +3530,7 @@ const ${inherit.outName} =
3503
3530
  if (vol.inherits !== void 0) {
3504
3531
  const subGeoms = this.getAllSubGeoms(vol.inherits);
3505
3532
  for (const oneGeom of subGeoms) {
3506
- const paxJson = paxWrite().getPaxJson({}, oneGeom);
3533
+ const paxJson = paxWrite().getPaxJson({}, oneGeom, zeroPDef);
3507
3534
  rStr += this.getAllFigures(paxJson.faces, paxJson.partName);
3508
3535
  rStr += this.getVolume(oneGeom.vol);
3509
3536
  }
@@ -3650,21 +3677,21 @@ function figureToDxf(aCtr) {
3650
3677
  const rDxf = dxf.stringify();
3651
3678
  return rDxf;
3652
3679
  }
3653
- function makePax(paramVal, geome0) {
3654
- const rStr = paxWrite().getPaxStr(paramVal, geome0);
3680
+ function makePax(paramVal, geome0, ipDef) {
3681
+ const rStr = paxWrite().getPaxStr(paramVal, geome0, ipDef);
3655
3682
  return rStr;
3656
3683
  }
3657
3684
  function makeOpenscad(geome0) {
3658
- const paxJson = paxWrite().getPaxJson({}, geome0);
3685
+ const paxJson = paxWrite().getPaxJson({}, geome0, zeroPDef);
3659
3686
  const rStr = oscadWrite().getExportFile(paxJson);
3660
3687
  return rStr;
3661
3688
  }
3662
3689
  function makeOpenjscad(geome0) {
3663
- const paxJson = paxWrite().getPaxJson({}, geome0);
3690
+ const paxJson = paxWrite().getPaxJson({}, geome0, zeroPDef);
3664
3691
  const rStr = ojscadWrite().getExportFile(paxJson);
3665
3692
  return rStr;
3666
3693
  }
3667
- async function makeZip(paramVal, geome0, tSim, geome1) {
3694
+ async function makeZip(paramVal, geome0, tSim, geome1, ipDef) {
3668
3695
  const zipFileWriter = new zip.BlobWriter("application/zip");
3669
3696
  const zipWriter = new zip.ZipWriter(zipFileWriter);
3670
3697
  const partName = geome0.partName;
@@ -3693,7 +3720,7 @@ async function makeZip(paramVal, geome0, tSim, geome1) {
3693
3720
  await zipWriter.add(`deco_${partName}_all_merged.svg`, svgMergedDeco);
3694
3721
  const svgMergedDecoT = new zip.TextReader(figureToSvgDeco(mergedFace));
3695
3722
  await zipWriter.add(`deco_${partName}_all_merged_t${tSim}.svg`, svgMergedDecoT);
3696
- const zPax = new zip.TextReader(makePax(paramVal, geome0));
3723
+ const zPax = new zip.TextReader(makePax(paramVal, geome0, ipDef));
3697
3724
  await zipWriter.add(`${partName}.pax.json`, zPax);
3698
3725
  const zSCad = new zip.TextReader(makeOpenscad(geome0));
3699
3726
  await zipWriter.add(`${partName}_noarc_openscad.scad`, zSCad);
@@ -3716,7 +3743,7 @@ var EFormat = /* @__PURE__ */ ((EFormat2) => {
3716
3743
  EFormat2[EFormat2["eZIP"] = 7] = "eZIP";
3717
3744
  return EFormat2;
3718
3745
  })(EFormat || {});
3719
- function fileTextContent(fgeom, paramVal, eFace, exportFormat) {
3746
+ function fileTextContent(fgeom, paramVal, ipDef, eFace, exportFormat) {
3720
3747
  const geome0 = fgeom(0, paramVal);
3721
3748
  let rFileContent = "";
3722
3749
  if (!geome0.calcErr) {
@@ -3742,7 +3769,7 @@ function fileTextContent(fgeom, paramVal, eFace, exportFormat) {
3742
3769
  const figu = mergeFaces(geome0.fig);
3743
3770
  rFileContent = figureToDxf(figu.mainList);
3744
3771
  } else if (exportFormat === 4 /* ePAX */) {
3745
- rFileContent = makePax(paramVal, geome0);
3772
+ rFileContent = makePax(paramVal, geome0, ipDef);
3746
3773
  } else if (exportFormat === 5 /* eOPENSCAD */) {
3747
3774
  rFileContent = makeOpenscad(geome0);
3748
3775
  } else if (exportFormat === 6 /* eJSCAD */) {
@@ -3755,13 +3782,13 @@ function fileTextContent(fgeom, paramVal, eFace, exportFormat) {
3755
3782
  }
3756
3783
  return rFileContent;
3757
3784
  }
3758
- async function fileBinContent(fgeom, tSim, paramVal, exportFormat) {
3785
+ async function fileBinContent(fgeom, tSim, paramVal, ipDef, exportFormat) {
3759
3786
  const geome0 = fgeom(0, paramVal);
3760
3787
  const geome1 = fgeom(tSim, paramVal);
3761
3788
  let rFileContent = new Blob();
3762
3789
  if (!geome0.calcErr && !geome1.calcErr) {
3763
3790
  if (exportFormat === 7 /* eZIP */) {
3764
- rFileContent = await makeZip(paramVal, geome0, tSim, geome1);
3791
+ rFileContent = await makeZip(paramVal, geome0, tSim, geome1, ipDef);
3765
3792
  } else {
3766
3793
  console.log(`err913: unknown exportFormat ${exportFormat}`);
3767
3794
  }
@@ -3813,9 +3840,10 @@ function fileBin(exportFormat) {
3813
3840
  }
3814
3841
 
3815
3842
  // src/paramFile.ts
3816
- function createParamFile(lastModif, idparams, comment) {
3843
+ function createParamFile(lastModif, iPartName, idparams, comment) {
3817
3844
  const allVal = {
3818
3845
  lastModif,
3846
+ partName: iPartName,
3819
3847
  pVal: idparams,
3820
3848
  comment
3821
3849
  };
@@ -3825,13 +3853,17 @@ function createParamFile(lastModif, idparams, comment) {
3825
3853
  function parseParamFile(fContentStr) {
3826
3854
  const wholeJson = JSON.parse(fContentStr);
3827
3855
  const lastModifKey = "lastModif";
3856
+ const partNameKey = "partName";
3828
3857
  const pValKey = "pVal";
3829
3858
  const commentKey = "comment";
3830
3859
  let rlog = "";
3831
- const rObj = { lastModif: "", pVal: {}, comment: "" };
3860
+ const rObj = { lastModif: "", partName: "", pVal: {}, comment: "" };
3832
3861
  if (Object.hasOwn(wholeJson, lastModifKey)) {
3833
3862
  rObj[lastModifKey] = wholeJson[lastModifKey];
3834
3863
  }
3864
+ if (Object.hasOwn(wholeJson, partNameKey)) {
3865
+ rObj[partNameKey] = wholeJson[partNameKey];
3866
+ }
3835
3867
  if (Object.hasOwn(wholeJson, pValKey)) {
3836
3868
  const paNaVa = wholeJson[pValKey];
3837
3869
  for (const paNa of Object.keys(paNaVa)) {
@@ -3853,6 +3885,167 @@ function parseParamFile(fContentStr) {
3853
3885
  return [rObj, rlog];
3854
3886
  }
3855
3887
 
3888
+ // src/transform3d.ts
3889
+ function t3dInitNull() {
3890
+ const rM = [
3891
+ [0, 0, 0, 0],
3892
+ [0, 0, 0, 0],
3893
+ [0, 0, 0, 0],
3894
+ [0, 0, 0, 0]
3895
+ ];
3896
+ return rM;
3897
+ }
3898
+ function t3dInitIdentity() {
3899
+ const rM = [
3900
+ [1, 0, 0, 0],
3901
+ [0, 1, 0, 0],
3902
+ [0, 0, 1, 0],
3903
+ [0, 0, 0, 1]
3904
+ ];
3905
+ return rM;
3906
+ }
3907
+ function t3dRotateX(ax) {
3908
+ const rM = t3dInitIdentity();
3909
+ const cos = Math.cos(ax);
3910
+ const sin = Math.sin(ax);
3911
+ rM[1][1] = cos;
3912
+ rM[2][2] = cos;
3913
+ rM[2][1] = sin;
3914
+ rM[1][2] = -sin;
3915
+ return rM;
3916
+ }
3917
+ function t3dRotateY(ay) {
3918
+ const rM = t3dInitIdentity();
3919
+ const cos = Math.cos(ay);
3920
+ const sin = Math.sin(ay);
3921
+ rM[0][0] = cos;
3922
+ rM[2][2] = cos;
3923
+ rM[0][2] = sin;
3924
+ rM[2][0] = -sin;
3925
+ return rM;
3926
+ }
3927
+ function t3dRotateZ(az) {
3928
+ const rM = t3dInitIdentity();
3929
+ const cos = Math.cos(az);
3930
+ const sin = Math.sin(az);
3931
+ rM[0][0] = cos;
3932
+ rM[1][1] = cos;
3933
+ rM[0][1] = -sin;
3934
+ rM[1][0] = sin;
3935
+ return rM;
3936
+ }
3937
+ function t3dMatMultiply(ma, mb) {
3938
+ const rM = t3dInitNull();
3939
+ for (let i = 0; i < 4; i++) {
3940
+ for (let j = 0; j < 4; j++) {
3941
+ let t = 0;
3942
+ for (let k = 0; k < 4; k++) {
3943
+ t += ma[i][k] * mb[k][j];
3944
+ }
3945
+ rM[i][j] = t;
3946
+ }
3947
+ }
3948
+ return rM;
3949
+ }
3950
+ function t3dCombine(tM) {
3951
+ let rM = t3dInitIdentity();
3952
+ for (const tmi of tM) {
3953
+ rM = t3dMatMultiply(tmi, rM);
3954
+ }
3955
+ return rM;
3956
+ }
3957
+ function t3dRotate(ax, ay, az) {
3958
+ const rM = t3dCombine([t3dRotateX(ax), t3dRotateY(ay), t3dRotateZ(az)]);
3959
+ return rM;
3960
+ }
3961
+ function t3dTranslate(ax, ay, az) {
3962
+ const rM = t3dInitIdentity();
3963
+ rM[0][3] = ax;
3964
+ rM[1][3] = ay;
3965
+ rM[2][3] = az;
3966
+ return rM;
3967
+ }
3968
+ function t3dCopyMatrix(tm) {
3969
+ const rM = t3dInitNull();
3970
+ for (let i = 0; i < 4; i++) {
3971
+ for (let j = 0; j < 4; j++) {
3972
+ rM[i][j] = tm[i][j];
3973
+ }
3974
+ }
3975
+ return rM;
3976
+ }
3977
+ function t3dApply(ma, va) {
3978
+ const vb = [va[0], va[1], va[2], 1];
3979
+ const rV = [0, 0, 0];
3980
+ for (let i = 0; i < 3; i++) {
3981
+ let t = 0;
3982
+ for (let k = 0; k < 4; k++) {
3983
+ t += ma[i][k] * vb[k];
3984
+ }
3985
+ rV[i] = t;
3986
+ }
3987
+ return rV;
3988
+ }
3989
+ function t3dGetTranslation(tm) {
3990
+ const rVT = [tm[0][3], tm[1][3], tm[2][3]];
3991
+ return rVT;
3992
+ }
3993
+ function t3dGetRotation(tm) {
3994
+ let ax = 0;
3995
+ let ay = 0;
3996
+ let az = 0;
3997
+ const tm20 = tm[2][0];
3998
+ const yota = 10 ** -5;
3999
+ if (Math.abs(tm20 - 1) < yota) {
4000
+ az = 0;
4001
+ ay = -Math.PI / 2;
4002
+ ax = -az + Math.atan2(-tm[0][1], -tm[0][2]);
4003
+ } else if (Math.abs(tm20 + 1) < yota) {
4004
+ az = 0;
4005
+ ay = Math.PI / 2;
4006
+ ax = az + Math.atan2(tm[0][1], tm[0][2]);
4007
+ } else {
4008
+ ax = Math.atan2(tm[2][1], tm[2][2]);
4009
+ ay = Math.atan2(-tm[2][0], Math.sqrt(tm[2][1] ** 2 + tm[2][2] ** 2));
4010
+ az = Math.atan2(tm[1][0], tm[0][0]);
4011
+ }
4012
+ const rVR = [ax, ay, az];
4013
+ return rVR;
4014
+ }
4015
+ var Transform3d = class {
4016
+ mmat;
4017
+ constructor(iMat) {
4018
+ this.mmat = t3dCopyMatrix(iMat);
4019
+ }
4020
+ addRotation(ax, ay, az) {
4021
+ const mR = t3dRotate(ax, ay, az);
4022
+ this.mmat = t3dCombine([this.mmat, mR]);
4023
+ }
4024
+ addTranslation(ax, ay, az) {
4025
+ const mT = t3dTranslate(ax, ay, az);
4026
+ this.mmat = t3dCombine([this.mmat, mT]);
4027
+ }
4028
+ getMatrix() {
4029
+ return this.mmat;
4030
+ }
4031
+ getRotation() {
4032
+ const rVR = t3dGetRotation(this.mmat);
4033
+ return rVR;
4034
+ }
4035
+ getTranslation() {
4036
+ const rVT = t3dGetTranslation(this.mmat);
4037
+ return rVT;
4038
+ }
4039
+ transform(iv) {
4040
+ const rV = t3dApply(this.mmat, iv);
4041
+ return rV;
4042
+ }
4043
+ };
4044
+ var initMid = t3dInitIdentity();
4045
+ function transform3d(initM = initMid) {
4046
+ return new Transform3d(initM);
4047
+ }
4048
+
3856
4049
  // src/version_details.ts
3857
4050
  function version_details(appPackage) {
3858
4051
  const rStr = [];
@@ -3906,6 +4099,7 @@ export {
3906
4099
  Segment1,
3907
4100
  Segment2,
3908
4101
  ShapePoint,
4102
+ Transform3d,
3909
4103
  Vector,
3910
4104
  aBFromLaLbAa,
3911
4105
  aCFromAaAb,
@@ -3962,6 +4156,7 @@ export {
3962
4156
  pCheckbox,
3963
4157
  pDropdown,
3964
4158
  pNumber,
4159
+ pSectionSeparator,
3965
4160
  paramListToVal,
3966
4161
  parseParamFile,
3967
4162
  paxCircle,
@@ -3976,11 +4171,13 @@ export {
3976
4171
  rightTriLbFromLaLc,
3977
4172
  roundZero,
3978
4173
  tolerance,
4174
+ transform3d,
3979
4175
  vector,
3980
4176
  version_details,
3981
4177
  withinHPiHPi,
3982
4178
  withinPiPi,
3983
4179
  withinZero2Pi,
3984
- withinZeroPi
4180
+ withinZeroPi,
4181
+ zeroPDef
3985
4182
  };
3986
4183
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geometrix",
3
- "version": "0.5.23",
3
+ "version": "0.5.25",
4
4
  "description": "The 2D geometry engine of the parametrix",
5
5
  "private": false,
6
6
  "repository": {
@@ -41,20 +41,20 @@
41
41
  "clean": "shx rm -fr dist node_modules"
42
42
  },
43
43
  "dependencies": {
44
- "@zip.js/zip.js": "^2.7.34"
44
+ "@zip.js/zip.js": "^2.7.40"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "^20.11.19",
47
+ "@types/node": "^20.11.30",
48
48
  "@typescript-eslint/eslint-plugin": "^7.0.1",
49
49
  "@typescript-eslint/parser": "^7.0.1",
50
- "eslint": "^8.56.0",
50
+ "eslint": "^8.57.0",
51
51
  "eslint-config-prettier": "^9.1.0",
52
52
  "npm-run-all": "^4.1.5",
53
53
  "prettier": "^3.2.5",
54
54
  "shx": "^0.3.4",
55
55
  "tsup": "^8.0.2",
56
- "typescript": "^5.3.3",
57
- "vitest": "^1.3.1"
56
+ "typescript": "^5.4.3",
57
+ "vitest": "^1.4.0"
58
58
  },
59
59
  "exports": {
60
60
  ".": {