desi77 0.1.11 → 0.1.13

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.js CHANGED
@@ -3608,10 +3608,1086 @@ var springIntDef = {
3608
3608
  pDef: pDef11,
3609
3609
  pGeom: pGeom11
3610
3610
  };
3611
+
3612
+ // src/heliostat/heliostat.ts
3613
+ import {
3614
+ point as point6,
3615
+ contour as contour13,
3616
+ contourCircle as contourCircle10,
3617
+ ctrRectangle as ctrRectangle5,
3618
+ figure as figure10,
3619
+ degToRad as degToRad5,
3620
+ radToDeg as radToDeg8,
3621
+ ffix as ffix13,
3622
+ pNumber as pNumber12,
3623
+ pDropdown as pDropdown6,
3624
+ pSectionSeparator as pSectionSeparator12,
3625
+ EExtrude as EExtrude9,
3626
+ EBVolume as EBVolume9,
3627
+ initGeom as initGeom12
3628
+ } from "geometrix";
3629
+ import { triLALrL, triLLLrA } from "triangule";
3630
+ var pDef12 = {
3631
+ partName: "heliostat",
3632
+ params: [
3633
+ //pNumber(name, unit, init, min, max, step)
3634
+ pNumber12("L1", "mm", 4e3, 1e3, 2e4, 1),
3635
+ pNumber12("D1", "mm", 1e3, 100, 4e3, 1),
3636
+ pNumber12("D3", "mm", 600, 100, 2e3, 1),
3637
+ pNumber12("L9", "mm", 8e3, 1e3, 2e4, 1),
3638
+ pSectionSeparator12("Bottom details"),
3639
+ pNumber12("E1", "mm", 10, 1, 100, 1),
3640
+ pNumber12("E2", "mm", 10, 1, 100, 1),
3641
+ pNumber12("E3", "mm", 10, 1, 100, 1),
3642
+ pNumber12("S1", "mm", 100, 1, 500, 1),
3643
+ pNumber12("S3", "mm", 100, 1, 500, 1),
3644
+ pSectionSeparator12("Fixation"),
3645
+ pNumber12("N2", "holes", 24, 1, 500, 1),
3646
+ pNumber12("D2", "mm", 40, 1, 400, 1),
3647
+ pNumber12("W1", "mm", 20, 1, 400, 1),
3648
+ pSectionSeparator12("Door"),
3649
+ pNumber12("H1H", "mm", 1500, 100, 3e3, 1),
3650
+ pNumber12("H1W", "mm", 600, 100, 1e3, 1),
3651
+ pNumber12("H1P", "mm", 300, 100, 2e3, 1),
3652
+ pSectionSeparator12("Junction"),
3653
+ pNumber12("Z3", "mm", 200, 1, 500, 1),
3654
+ pNumber12("Z4", "mm", 200, 1, 500, 1),
3655
+ pDropdown6("gen3D", ["Both", "Top", "Bottom"]),
3656
+ pSectionSeparator12("Top-trunk"),
3657
+ pNumber12("L4", "mm", 2e3, 100, 2e4, 1),
3658
+ pNumber12("E4", "mm", 10, 1, 100, 1),
3659
+ pNumber12("E5", "mm", 10, 1, 100, 1),
3660
+ pNumber12("H6", "mm", 600, 100, 2e3, 1),
3661
+ pNumber12("E7", "mm", 10, 1, 100, 1),
3662
+ pNumber12("D7", "mm", 200, 10, 2e3, 1),
3663
+ pSectionSeparator12("Top-branch"),
3664
+ pNumber12("E6", "mm", 10, 1, 100, 1),
3665
+ pNumber12("D6", "mm", 400, 100, 2e3, 1),
3666
+ pNumber12("W8", "mm", 300, 100, 2e3, 1),
3667
+ pNumber12("L8", "mm", 2e3, 100, 2e4, 1),
3668
+ pNumber12("H8", "mm", 1e3, 100, 3e3, 1),
3669
+ pNumber12("G8", "mm", 500, 100, 2e3, 1),
3670
+ pNumber12("F8", "mm", 200, 10, 1e3, 1),
3671
+ pNumber12("a8", "degre", 140, 30, 200, 1),
3672
+ pSectionSeparator12("Top-diagonal"),
3673
+ pNumber12("D4", "mm", 300, 10, 2e3, 1),
3674
+ pNumber12("EE4", "mm", 10, 1, 100, 1),
3675
+ pNumber12("R4v", "mm", 400, 10, 5e3, 1),
3676
+ pNumber12("R4h", "mm", 400, 10, 5e3, 1)
3677
+ ],
3678
+ paramSvg: {
3679
+ L1: "heliostat_bottom.svg",
3680
+ D1: "heliostat_bottom.svg",
3681
+ D3: "heliostat_bottom.svg",
3682
+ L9: "heliostat_junction.svg",
3683
+ E1: "heliostat_bottom.svg",
3684
+ E2: "heliostat_bottom.svg",
3685
+ E3: "heliostat_bottom.svg",
3686
+ S1: "heliostat_bottom.svg",
3687
+ S3: "heliostat_bottom.svg",
3688
+ N2: "heliostat_fixation.svg",
3689
+ D2: "heliostat_fixation.svg",
3690
+ W1: "heliostat_fixation.svg",
3691
+ H1H: "heliostat_bottom.svg",
3692
+ H1W: "heliostat_bottom.svg",
3693
+ H1P: "heliostat_bottom.svg",
3694
+ Z3: "heliostat_junction.svg",
3695
+ Z4: "heliostat_junction.svg",
3696
+ gen3D: "heliostat_junction.svg",
3697
+ L4: "heliostat_top.svg",
3698
+ E4: "heliostat_top.svg",
3699
+ E5: "heliostat_top.svg",
3700
+ E6: "heliostat_top.svg",
3701
+ D6: "heliostat_top.svg",
3702
+ H6: "heliostat_top.svg",
3703
+ E7: "heliostat_top.svg",
3704
+ D7: "heliostat_top.svg",
3705
+ W8: "heliostat_top.svg",
3706
+ L8: "heliostat_top.svg",
3707
+ H8: "heliostat_hand.svg",
3708
+ G8: "heliostat_hand.svg",
3709
+ F8: "heliostat_hand.svg",
3710
+ a8: "heliostat_hand.svg",
3711
+ D4: "heliostat_top.svg",
3712
+ EE4: "heliostat_top.svg",
3713
+ R4v: "heliostat_top.svg",
3714
+ R4h: "heliostat_top.svg"
3715
+ },
3716
+ sim: {
3717
+ tMax: 180,
3718
+ tStep: 0.5,
3719
+ tUpdate: 500
3720
+ // every 0.5 second
3721
+ }
3722
+ };
3723
+ function pGeom12(t, param, suffix = "") {
3724
+ const rGeome = initGeom12(pDef12.partName + suffix);
3725
+ const figBottomDisc = figure10();
3726
+ const figBottomPole = figure10();
3727
+ const figDoor = figure10();
3728
+ const figTopPole = figure10();
3729
+ const figHorizPole = figure10();
3730
+ const figHorizPoleInt = figure10();
3731
+ const figDiag3 = figure10();
3732
+ const figDiagE = figure10();
3733
+ const figDiagI = figure10();
3734
+ const figCleanDiag = figure10();
3735
+ const figHand = figure10();
3736
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
3737
+ `;
3738
+ try {
3739
+ let ctrBottomPole2 = function(sig) {
3740
+ const rCtr = contour13(sig * R1, 0).addSegStrokeR(0, param.E1).addSegStrokeR(sig * (R3 - R1), L1b).addSegStrokeR(-sig * S3c, 0).addSegStrokeR(0, -param.E3).addSegStrokeR(sig * param.S3, 0).addSegStrokeA(sig * (R1 - S1b), param.E1).addSegStrokeR(0, -param.E1).closeSegStroke();
3741
+ return rCtr;
3742
+ }, ctrTopPole2 = function(sig) {
3743
+ const rCtr = contour13(-sig * R4e, posY4).addSegStrokeR(sig * E4b, 0).addSegStrokeR(sig * (R4i - R5b), param.L4).addSegStrokeR(sig * (R5b - R5), 0).addSegStrokeR(0, param.E5).addSegStrokeR(sig * (R5 - R5t), 0).addSegStrokeR(sig * (R5t - R7b), param.H6).addSegStrokeR(sig * (R7b - R7i), 0).addSegStrokeR(0, param.E7).addSegStrokeR(sig * (R7i - R7t), 0).closeSegStroke();
3744
+ return rCtr;
3745
+ }, ctrDiag2 = function(posX, RR, AA) {
3746
+ const rCtr = ctrRectangle5(posX - RR, posY4, 2 * RR, diagL).rotate(posX, posY4, AA);
3747
+ return rCtr;
3748
+ }, ctrCleanDiag2 = function(sig) {
3749
+ const rCtr = contour13(-sig * R4i, posY4).addSegStrokeR(sig * (R4i - R5b), param.L4).addSegStrokeR(sig * R5b, 0).addSegStrokeR(0, -param.L4 - 2 * param.D6).addSegStrokeR(-sig * R4i, 0).closeSegStroke();
3750
+ return rCtr;
3751
+ };
3752
+ var ctrBottomPole = ctrBottomPole2, ctrTopPole = ctrTopPole2, ctrDiag = ctrDiag2, ctrCleanDiag = ctrCleanDiag2;
3753
+ const pi2 = Math.PI / 2;
3754
+ const H1W2 = param.H1W / 2;
3755
+ const H1h = param.H1H - 2 * H1W2;
3756
+ const R1 = param.D1 / 2;
3757
+ const R3 = param.D3 / 2;
3758
+ const L1b = param.L1 - param.E1;
3759
+ const inclination = Math.atan2(L1b, R1 - R3);
3760
+ const S1b = param.E2 / Math.cos(pi2 - inclination);
3761
+ const S1c = param.S1 + S1b;
3762
+ const R1b = R1 - S1c;
3763
+ const R1bb = R1 - S1b;
3764
+ const S3b = param.E3 / Math.tan(inclination);
3765
+ const S3c = param.S3 + S1b - S3b;
3766
+ const R5 = R3 - S3c;
3767
+ const R2 = param.D2 / 2;
3768
+ const lFixation = R1b + param.W1 + R2;
3769
+ const aFixation = 2 * Math.PI / param.N2;
3770
+ const d5b = param.Z3 / Math.tan(inclination);
3771
+ const S5b = S3c + param.Z4 - d5b;
3772
+ const S5t = S5b - param.E5 / Math.tan(inclination);
3773
+ const d4b = param.L4 / Math.tan(inclination);
3774
+ const R5b = R5 + S5b;
3775
+ const R5t = R5 + S5t;
3776
+ const R4i = R5b + d4b;
3777
+ const E4b = param.E4 / Math.sin(inclination);
3778
+ const R4e = R4i + E4b;
3779
+ const posY4 = param.L1 + param.Z3 - param.L4;
3780
+ const R7b = R5t - param.H6 / Math.tan(inclination);
3781
+ const R7t = R7b - param.E7 / Math.tan(inclination) + E4b;
3782
+ const R7i = param.D7 / 2;
3783
+ const genTop = param.gen3D === 2 ? false : true;
3784
+ const genBottom = param.gen3D === 1 ? false : true;
3785
+ const R6e = param.D6 / 2;
3786
+ const R6i = R6e - param.E6;
3787
+ const posY6 = param.L1 + param.Z3 + param.E5 + param.H6 / 2;
3788
+ const L92 = param.L9 / 2;
3789
+ const diagHeight = param.L4 + param.E5 + param.H6 / 2;
3790
+ const diagHeight2 = diagHeight - R6e;
3791
+ const diagV = diagHeight2 / Math.sin(inclination);
3792
+ const diagH = L92 - (R4e - diagHeight2 / Math.tan(inclination));
3793
+ const triL1 = diagH - param.R4h;
3794
+ const triL2 = diagV - param.R4v;
3795
+ const [triL3, triLog1] = triLALrL(triL1, inclination, triL2);
3796
+ const [triA31, triLog2] = triLLLrA(triL1, triL2, triL3);
3797
+ rGeome.logstr += triLog1 + triLog2;
3798
+ const diagA = pi2 - triA31;
3799
+ const diagDX = diagHeight2 / Math.tan(triA31);
3800
+ const RR4e = param.D4 / 2;
3801
+ const RR4i = RR4e - param.EE4;
3802
+ const diagDX2 = RR4e / Math.cos(diagA);
3803
+ const posX4 = -L92 + param.R4h + diagDX + diagDX2;
3804
+ const diagL = diagHeight / Math.cos(diagA);
3805
+ const R8 = param.G8 / 2;
3806
+ const R82 = R8 + param.F8;
3807
+ const a82 = degToRad5(param.a8) / 2;
3808
+ const posY8 = posY6 + param.H8;
3809
+ const [t2iL3, triLog3] = triLALrL(param.H8, a82, R82);
3810
+ const [t2iA31, triLog4] = triLLLrA(param.H8, R82, t2iL3);
3811
+ rGeome.logstr += triLog3 + triLog4;
3812
+ const t3iA = Math.acos(R6e / t2iL3);
3813
+ const a62pre = t2iA31 + t3iA;
3814
+ const a62 = Math.min(pi2, a62pre);
3815
+ const L82 = param.L8 / 2;
3816
+ const posX9 = [-L92, -L82 - param.W8, L82, L92 - param.W8];
3817
+ if (R1 < R3) {
3818
+ throw `err176: D1 ${ffix13(param.D1)} is too small compare to D3 ${ffix13(param.D3)} mm`;
3819
+ }
3820
+ if (R1b < 0.1) {
3821
+ throw `err183: R1b ${ffix13(R1b)} is too small because of ${ffix13(param.E2)} or ${ffix13(param.S1)} mm`;
3822
+ }
3823
+ if (param.S1 < 2 * (param.W1 + R2)) {
3824
+ throw `err142: S1 ${ffix13(param.S1)} is too small compare to W1 ${ffix13(param.W1)} and D2 ${ffix13(2 * R2)} mm`;
3825
+ }
3826
+ if (H1h < 0.1) {
3827
+ throw `err167: H1H ${ffix13(param.H1H)} is too small compare to H1W ${ffix13(param.H1W)} mm`;
3828
+ }
3829
+ if (param.Z4 < d5b) {
3830
+ throw `err154: Z4 ${ffix13(param.Z4)} is too small compare to d5b ${ffix13(d5b)} mm`;
3831
+ }
3832
+ if (R7b < R7i) {
3833
+ throw `err169: R7b ${ffix13(2 * R7b)} is too small because to D7 ${ffix13(2 * R7i)} mm`;
3834
+ }
3835
+ if (R6i < 0.1) {
3836
+ throw `err185: R6i ${ffix13(R6i)} is too small because to E6 ${ffix13(param.E6)} mm`;
3837
+ }
3838
+ if (param.H6 < param.D6) {
3839
+ throw `err200: H6 ${ffix13(param.H6)} is too small compare to D6 ${ffix13(param.D6)} mm`;
3840
+ }
3841
+ rGeome.logstr += `Cone inclination ${ffix13(radToDeg8(inclination))}, diagonal ${ffix13(radToDeg8(diagA))} deg
3842
+ `;
3843
+ rGeome.logstr += `Diameters: D1 ${ffix13(2 * R1)}, D1b ${ffix13(2 * R1)}, D3 ${ffix13(2 * R3)}, D5 ${ffix13(2 * R5)} mm
3844
+ `;
3845
+ rGeome.logstr += `TopPole: posY4 ${ffix13(posY4)}, D4 ${ffix13(2 * R4e)} mm
3846
+ `;
3847
+ const fixationHoles = [];
3848
+ for (let ii = 0; ii < param.N2; ii++) {
3849
+ const pt = point6(0, 0).translatePolar(ii * aFixation, lFixation);
3850
+ fixationHoles.push(contourCircle10(pt.cx, pt.cy, R2));
3851
+ }
3852
+ figBottomDisc.addMainOI([
3853
+ contourCircle10(0, 0, R1),
3854
+ contourCircle10(0, 0, R1b),
3855
+ ...fixationHoles
3856
+ ]);
3857
+ figBottomDisc.addSecond(contourCircle10(0, 0, R1bb));
3858
+ figBottomDisc.addSecond(contourCircle10(0, 0, R3));
3859
+ figBottomDisc.addSecond(contourCircle10(0, 0, R5));
3860
+ figBottomPole.addMainO(ctrBottomPole2(-1));
3861
+ figBottomPole.addSecond(ctrBottomPole2(1));
3862
+ const ctrDoor = contour13(H1W2, param.H1P + H1W2).addSegStrokeR(0, H1h).addPointR(-H1W2, H1W2).addPointR(-2 * H1W2, 0).addSegArc2().addSegStrokeR(0, -H1h).addPointR(H1W2, -H1W2).addPointR(2 * H1W2, 0).addSegArc2();
3863
+ figDoor.addMainO(ctrDoor);
3864
+ figDoor.addSecond(ctrBottomPole2(1));
3865
+ figDoor.addSecond(ctrBottomPole2(-1));
3866
+ figBottomPole.addSecond(ctrDoor);
3867
+ figTopPole.addMainO(ctrTopPole2(1));
3868
+ figTopPole.addSecond(ctrTopPole2(-1));
3869
+ figTopPole.addSecond(ctrBottomPole2(1));
3870
+ figTopPole.addSecond(ctrBottomPole2(-1));
3871
+ figTopPole.addSecond(ctrDoor);
3872
+ figBottomPole.addSecond(ctrTopPole2(-1));
3873
+ figBottomPole.addSecond(ctrTopPole2(1));
3874
+ const ctrHorizExt = contourCircle10(0, posY6, R6e);
3875
+ const ctrHorizInt = contourCircle10(0, posY6, R6i);
3876
+ figHorizPole.addMainOI([ctrHorizExt, ctrHorizInt]);
3877
+ figHorizPole.addSecond(ctrTopPole2(-1));
3878
+ figHorizPole.addSecond(ctrTopPole2(1));
3879
+ figHorizPoleInt.addMainO(ctrHorizInt);
3880
+ figHorizPoleInt.addSecond(ctrHorizExt);
3881
+ figHorizPoleInt.addSecond(ctrTopPole2(-1));
3882
+ figHorizPoleInt.addSecond(ctrTopPole2(1));
3883
+ figDiag3.addMainOI([
3884
+ ctrRectangle5(-L92, posY6 - R6e, 2 * L92, 2 * R6e),
3885
+ ctrRectangle5(-L92, posY6 - R6i, 2 * L92, 2 * R6i)
3886
+ ]);
3887
+ figDiag3.addSecond(ctrTopPole2(-1));
3888
+ figDiag3.addSecond(ctrTopPole2(1));
3889
+ figDiag3.addSecond(ctrDiag2(posX4, RR4e, diagA));
3890
+ figDiag3.addSecond(ctrDiag2(posX4, RR4i, diagA));
3891
+ figDiag3.addSecond(ctrDiag2(-posX4, RR4e, -diagA));
3892
+ figDiag3.addSecond(ctrDiag2(-posX4, RR4i, -diagA));
3893
+ for (let ii = 0; ii < 4; ii++) {
3894
+ figDiag3.addSecond(ctrRectangle5(posX9[ii], posY6, param.W8, param.H8));
3895
+ }
3896
+ const ctrDiagE = contourCircle10(0, 0, RR4e);
3897
+ const ctrDiagI = contourCircle10(0, 0, RR4i);
3898
+ figDiagE.addMainOI([ctrDiagE, ctrDiagI]);
3899
+ figDiagI.addMainO(ctrDiagI);
3900
+ figDiagI.addSecond(ctrDiagE);
3901
+ figCleanDiag.addMainO(ctrCleanDiag2(1));
3902
+ figCleanDiag.addSecond(ctrTopPole2(1));
3903
+ figCleanDiag.addSecond(ctrTopPole2(-1));
3904
+ const p1 = point6(0, posY8).translatePolar(a82 - pi2, R82);
3905
+ const p2 = point6(0, posY8).translatePolar(a82 - pi2, R8);
3906
+ const p3 = point6(0, posY8).translatePolar(-a82 - pi2, R8);
3907
+ const p4 = point6(0, posY8).translatePolar(-a82 - pi2, R82);
3908
+ const p5 = point6(0, posY6).translatePolar(pi2 + a62, R6e);
3909
+ const p6 = point6(0, posY6).translatePolar(pi2 - a62, R6e);
3910
+ const ctrHand = contour13(p1.cx, p1.cy).addSegStrokeA(p2.cx, p2.cy).addPointA(0, posY8 - R8).addPointA(p3.cx, p3.cy).addSegArc2().addSegStrokeA(p4.cx, p4.cy).addSegStrokeA(p5.cx, p5.cy).addPointA(0, posY6 + R6e).addPointA(p6.cx, p6.cy).addSegArc2().closeSegStroke();
3911
+ figHand.addMainO(ctrHand);
3912
+ figHand.addSecond(contourCircle10(0, posY6, R6e));
3913
+ figHand.addSecond(contourCircle10(0, posY6, R6i));
3914
+ figHand.addSecond(contourCircle10(0, posY8, R8));
3915
+ figHand.addSecond(contourCircle10(0, posY8, R82));
3916
+ figHand.addSecond(ctrTopPole2(1));
3917
+ figHand.addSecond(ctrTopPole2(-1));
3918
+ rGeome.fig = {
3919
+ faceBottomPole: figBottomPole,
3920
+ faceDoor: figDoor,
3921
+ faceBottomDisc: figBottomDisc,
3922
+ faceTopPole: figTopPole,
3923
+ faceHorizPole: figHorizPole,
3924
+ faceHorizPoleInt: figHorizPoleInt,
3925
+ faceDiag3: figDiag3,
3926
+ faceDiagE: figDiagE,
3927
+ faceDiagI: figDiagI,
3928
+ faceCleanDiag: figCleanDiag,
3929
+ faceHand: figHand
3930
+ };
3931
+ const designName = rGeome.partName;
3932
+ const selectedList = [];
3933
+ if (genTop) {
3934
+ selectedList.push(`ipax_${designName}_topPart`);
3935
+ }
3936
+ if (genBottom) {
3937
+ selectedList.push(`ipax_${designName}_bottomPart`);
3938
+ }
3939
+ rGeome.vol = {
3940
+ extrudes: [
3941
+ {
3942
+ outName: `subpax_${designName}_bottomPole`,
3943
+ face: `${designName}_faceBottomPole`,
3944
+ extrudeMethod: EExtrude9.eRotate,
3945
+ rotate: [0, 0, 0],
3946
+ translate: [0, 0, 0]
3947
+ },
3948
+ {
3949
+ outName: `subpax_${designName}_door`,
3950
+ face: `${designName}_faceDoor`,
3951
+ extrudeMethod: EExtrude9.eLinearOrtho,
3952
+ length: 2 * R1,
3953
+ rotate: [pi2, 0, 0],
3954
+ translate: [0, 0, 0]
3955
+ },
3956
+ {
3957
+ outName: `subpax_${designName}_bottomDisc`,
3958
+ face: `${designName}_faceBottomDisc`,
3959
+ extrudeMethod: EExtrude9.eLinearOrtho,
3960
+ length: param.E1,
3961
+ rotate: [0, 0, 0],
3962
+ translate: [0, 0, 0]
3963
+ },
3964
+ {
3965
+ outName: `subpax_${designName}_topPole`,
3966
+ face: `${designName}_faceTopPole`,
3967
+ extrudeMethod: EExtrude9.eRotate,
3968
+ rotate: [0, 0, 0],
3969
+ translate: [0, 0, 0]
3970
+ },
3971
+ {
3972
+ outName: `subpax_${designName}_horizPole`,
3973
+ face: `${designName}_faceHorizPole`,
3974
+ extrudeMethod: EExtrude9.eLinearOrtho,
3975
+ length: param.L9,
3976
+ rotate: [pi2, 0, 0],
3977
+ translate: [0, L92, 0]
3978
+ },
3979
+ {
3980
+ outName: `subpax_${designName}_horizPoleInt`,
3981
+ face: `${designName}_faceHorizPoleInt`,
3982
+ extrudeMethod: EExtrude9.eLinearOrtho,
3983
+ length: param.L9,
3984
+ rotate: [pi2, 0, 0],
3985
+ translate: [0, L92, 0]
3986
+ },
3987
+ {
3988
+ outName: `subpax_${designName}_diag1e`,
3989
+ face: `${designName}_faceDiagE`,
3990
+ extrudeMethod: EExtrude9.eLinearOrtho,
3991
+ length: diagL,
3992
+ rotate: [diagA, 0, 0],
3993
+ translate: [0, posX4, posY4]
3994
+ },
3995
+ {
3996
+ outName: `subpax_${designName}_diag1i`,
3997
+ face: `${designName}_faceDiagI`,
3998
+ extrudeMethod: EExtrude9.eLinearOrtho,
3999
+ length: diagL,
4000
+ rotate: [diagA, 0, 0],
4001
+ translate: [0, posX4, posY4]
4002
+ },
4003
+ {
4004
+ outName: `subpax_${designName}_diag2e`,
4005
+ face: `${designName}_faceDiagE`,
4006
+ extrudeMethod: EExtrude9.eLinearOrtho,
4007
+ length: diagL,
4008
+ rotate: [-diagA, 0, 0],
4009
+ translate: [0, -posX4, posY4]
4010
+ },
4011
+ {
4012
+ outName: `subpax_${designName}_diag2i`,
4013
+ face: `${designName}_faceDiagI`,
4014
+ extrudeMethod: EExtrude9.eLinearOrtho,
4015
+ length: diagL,
4016
+ rotate: [-diagA, 0, 0],
4017
+ translate: [0, -posX4, posY4]
4018
+ },
4019
+ {
4020
+ outName: `subpax_${designName}_cleanDiag`,
4021
+ face: `${designName}_faceCleanDiag`,
4022
+ extrudeMethod: EExtrude9.eRotate,
4023
+ rotate: [0, 0, 0],
4024
+ translate: [0, 0, 0]
4025
+ },
4026
+ {
4027
+ outName: `subpax_${designName}_hand1`,
4028
+ face: `${designName}_faceHand`,
4029
+ extrudeMethod: EExtrude9.eLinearOrtho,
4030
+ length: param.W8,
4031
+ rotate: [pi2, 0, 0],
4032
+ translate: [0, posX9[0] + param.W8, 0]
4033
+ },
4034
+ {
4035
+ outName: `subpax_${designName}_hand2`,
4036
+ face: `${designName}_faceHand`,
4037
+ extrudeMethod: EExtrude9.eLinearOrtho,
4038
+ length: param.W8,
4039
+ rotate: [pi2, 0, 0],
4040
+ translate: [0, posX9[1] + param.W8, 0]
4041
+ },
4042
+ {
4043
+ outName: `subpax_${designName}_hand3`,
4044
+ face: `${designName}_faceHand`,
4045
+ extrudeMethod: EExtrude9.eLinearOrtho,
4046
+ length: param.W8,
4047
+ rotate: [pi2, 0, 0],
4048
+ translate: [0, posX9[2] + param.W8, 0]
4049
+ },
4050
+ {
4051
+ outName: `subpax_${designName}_hand4`,
4052
+ face: `${designName}_faceHand`,
4053
+ extrudeMethod: EExtrude9.eLinearOrtho,
4054
+ length: param.W8,
4055
+ rotate: [pi2, 0, 0],
4056
+ translate: [0, posX9[3] + param.W8, 0]
4057
+ }
4058
+ ],
4059
+ volumes: [
4060
+ {
4061
+ outName: `ipax_${designName}_bottomPolePlus`,
4062
+ boolMethod: EBVolume9.eUnion,
4063
+ inList: [`subpax_${designName}_bottomDisc`, `subpax_${designName}_bottomPole`]
4064
+ },
4065
+ {
4066
+ outName: `ipax_${designName}_bottomPart`,
4067
+ boolMethod: EBVolume9.eSubstraction,
4068
+ inList: [`ipax_${designName}_bottomPolePlus`, `subpax_${designName}_door`]
4069
+ },
4070
+ {
4071
+ outName: `ipax_${designName}_topPlus`,
4072
+ boolMethod: EBVolume9.eUnion,
4073
+ inList: [
4074
+ `subpax_${designName}_topPole`,
4075
+ `subpax_${designName}_horizPole`,
4076
+ `subpax_${designName}_diag1e`,
4077
+ `subpax_${designName}_diag2e`,
4078
+ `subpax_${designName}_hand1`,
4079
+ `subpax_${designName}_hand2`,
4080
+ `subpax_${designName}_hand3`,
4081
+ `subpax_${designName}_hand4`
4082
+ ]
4083
+ },
4084
+ {
4085
+ outName: `ipax_${designName}_topMinus`,
4086
+ boolMethod: EBVolume9.eUnion,
4087
+ inList: [
4088
+ `subpax_${designName}_horizPoleInt`,
4089
+ `subpax_${designName}_diag1i`,
4090
+ `subpax_${designName}_diag2i`,
4091
+ `subpax_${designName}_cleanDiag`
4092
+ ]
4093
+ },
4094
+ {
4095
+ outName: `ipax_${designName}_topPart`,
4096
+ boolMethod: EBVolume9.eSubstraction,
4097
+ inList: [`ipax_${designName}_topPlus`, `ipax_${designName}_topMinus`]
4098
+ },
4099
+ {
4100
+ outName: `pax_${designName}`,
4101
+ boolMethod: EBVolume9.eUnion,
4102
+ inList: selectedList
4103
+ }
4104
+ ]
4105
+ };
4106
+ rGeome.sub = {};
4107
+ rGeome.logstr += "heliostat drawn successfully!\n";
4108
+ rGeome.calcErr = false;
4109
+ } catch (emsg) {
4110
+ rGeome.logstr += emsg;
4111
+ console.log(emsg);
4112
+ }
4113
+ return rGeome;
4114
+ }
4115
+ var heliostatDef = {
4116
+ pTitle: "heliostat",
4117
+ pDescription: "the structure of an heliostat",
4118
+ pDef: pDef12,
4119
+ pGeom: pGeom12
4120
+ };
4121
+
4122
+ // src/rccar/rccar.ts
4123
+ import {
4124
+ ctrRectangle as ctrRectangle6,
4125
+ figure as figure11,
4126
+ ffix as ffix14,
4127
+ pNumber as pNumber13,
4128
+ pSectionSeparator as pSectionSeparator13,
4129
+ EExtrude as EExtrude10,
4130
+ EBVolume as EBVolume10,
4131
+ initGeom as initGeom13
4132
+ } from "geometrix";
4133
+ var pDef13 = {
4134
+ partName: "rccar",
4135
+ params: [
4136
+ //pNumber(name, unit, init, min, max, step)
4137
+ pNumber13("W1", "mm", 400, 10, 2e3, 1),
4138
+ pNumber13("L1", "mm", 1e3, 100, 8e3, 1),
4139
+ pSectionSeparator13("Platform"),
4140
+ pNumber13("E1", "mm", 10, 1, 100, 1),
4141
+ pSectionSeparator13("Angles"),
4142
+ pNumber13("a1", "degree", 45, 10, 80, 1),
4143
+ pNumber13("a2", "degree", 45, 10, 80, 1)
4144
+ ],
4145
+ paramSvg: {
4146
+ W1: "rccar_angles.svg",
4147
+ L1: "rccar_angles.svg",
4148
+ E1: "rccar_angles.svg",
4149
+ a1: "rccar_angles.svg",
4150
+ a2: "rccar_angles.svg"
4151
+ },
4152
+ sim: {
4153
+ tMax: 180,
4154
+ tStep: 0.5,
4155
+ tUpdate: 500
4156
+ // every 0.5 second
4157
+ }
4158
+ };
4159
+ function pGeom13(t, param, suffix = "") {
4160
+ const rGeome = initGeom13(pDef13.partName + suffix);
4161
+ const figPlatform = figure11();
4162
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
4163
+ `;
4164
+ try {
4165
+ const W12 = param.W1 / 2;
4166
+ const platSurface = param.L1 * param.W1 / 10 ** 6;
4167
+ if (param.L1 < param.W1) {
4168
+ throw `err176: L1 ${ffix14(param.L1)} is too small compare to W1 ${ffix14(param.W1)} mm`;
4169
+ }
4170
+ rGeome.logstr += `Platform surface: ${ffix14(platSurface)} m2
4171
+ `;
4172
+ figPlatform.addMainO(ctrRectangle6(-W12, 0, 2 * W12, param.E1));
4173
+ rGeome.fig = {
4174
+ facePlatform: figPlatform
4175
+ };
4176
+ const designName = rGeome.partName;
4177
+ rGeome.vol = {
4178
+ extrudes: [
4179
+ {
4180
+ outName: `subpax_${designName}_platform`,
4181
+ face: `${designName}_facePlatform`,
4182
+ extrudeMethod: EExtrude10.eLinearOrtho,
4183
+ length: param.L1,
4184
+ rotate: [0, 0, 0],
4185
+ translate: [0, 0, 0]
4186
+ }
4187
+ ],
4188
+ volumes: [
4189
+ {
4190
+ outName: `pax_${designName}`,
4191
+ boolMethod: EBVolume10.eUnion,
4192
+ inList: [`subpax_${designName}_platform`]
4193
+ }
4194
+ ]
4195
+ };
4196
+ rGeome.sub = {};
4197
+ rGeome.logstr += "RC-car drawn successfully!\n";
4198
+ rGeome.calcErr = false;
4199
+ } catch (emsg) {
4200
+ rGeome.logstr += emsg;
4201
+ console.log(emsg);
4202
+ }
4203
+ return rGeome;
4204
+ }
4205
+ var rccarDef = {
4206
+ pTitle: "rccar",
4207
+ pDescription: "high-level concept of the RC-car",
4208
+ pDef: pDef13,
4209
+ pGeom: pGeom13
4210
+ };
4211
+
4212
+ // src/capsule/capsule.ts
4213
+ import {
4214
+ point as point7,
4215
+ contour as contour14,
4216
+ contourCircle as contourCircle11,
4217
+ ctrRectangle as ctrRectangle7,
4218
+ figure as figure12,
4219
+ ffix as ffix15,
4220
+ pNumber as pNumber14,
4221
+ pCheckbox as pCheckbox8,
4222
+ pDropdown as pDropdown7,
4223
+ pSectionSeparator as pSectionSeparator14,
4224
+ EExtrude as EExtrude11,
4225
+ EBVolume as EBVolume11,
4226
+ initGeom as initGeom14
4227
+ } from "geometrix";
4228
+ var pDef14 = {
4229
+ partName: "capsule",
4230
+ params: [
4231
+ //pNumber(name, unit, init, min, max, step)
4232
+ pNumber14("L1", "mm", 5e3, 1e3, 2e4, 1),
4233
+ pNumber14("WW1", "mm", 1800, 100, 4e3, 1),
4234
+ pNumber14("E1", "mm", 10, 1, 100, 1),
4235
+ pSectionSeparator14("Nose"),
4236
+ pNumber14("H1", "mm", 300, 10, 4e3, 1),
4237
+ pNumber14("H2", "mm", 500, 10, 4e3, 1),
4238
+ pNumber14("H3", "mm", 1200, 10, 4e3, 1),
4239
+ pNumber14("W1", "mm", 300, 10, 4e3, 1),
4240
+ pNumber14("W3", "mm", 1500, 10, 4e3, 1),
4241
+ pNumber14("C3", "mm", 200, 1, 1e3, 1),
4242
+ pNumber14("R1", "mm", 100, 0, 500, 1),
4243
+ pNumber14("R2", "mm", 100, 0, 500, 1),
4244
+ pNumber14("R3", "mm", 100, 0, 500, 1),
4245
+ pNumber14("R4", "mm", 100, 0, 500, 1),
4246
+ pSectionSeparator14("Wheels"),
4247
+ pNumber14("H0", "mm", 600, 100, 2e3, 1),
4248
+ pNumber14("D7", "mm", 500, 10, 2e3, 1),
4249
+ pNumber14("D8", "mm", 100, 10, 2e3, 1),
4250
+ pNumber14("WW2", "mm", 1e3, 100, 4e3, 1),
4251
+ pNumber14("WW3", "mm", 100, 1, 500, 1),
4252
+ pSectionSeparator14("Wheels details"),
4253
+ pNumber14("W6", "mm", 500, 10, 2e3, 1),
4254
+ pNumber14("W7", "mm", 600, 10, 2e3, 1),
4255
+ pNumber14("W8", "mm", 300, 10, 2e3, 1),
4256
+ pNumber14("H6", "mm", 300, 10, 2e3, 1),
4257
+ pSectionSeparator14("Front window"),
4258
+ pNumber14("FH1", "mm", 600, 10, 3e3, 1),
4259
+ pNumber14("FW1", "mm", 100, 10, 3e3, 1),
4260
+ pNumber14("FR1", "mm", 100, 0, 500, 1),
4261
+ pNumber14("FH3", "mm", 100, 10, 3e3, 1),
4262
+ pNumber14("FW3", "mm", 300, 10, 3e3, 1),
4263
+ pNumber14("FR3", "mm", 100, 0, 500, 1),
4264
+ pSectionSeparator14("Top"),
4265
+ pDropdown7("topStyle", ["mirador", "sky", "roof"]),
4266
+ pNumber14("H5", "mm", 300, 10, 2e3, 1),
4267
+ pNumber14("W4", "mm", 500, 10, 5e3, 1),
4268
+ pNumber14("W5", "mm", 1e3, 10, 5e3, 1),
4269
+ pNumber14("R5", "mm", 50, 1, 500, 1),
4270
+ pNumber14("S5", "mm", 200, 10, 500, 1),
4271
+ pSectionSeparator14("Wall"),
4272
+ pCheckbox8("sideWall", true),
4273
+ pNumber14("U1", "mm", 100, 10, 1e3, 1),
4274
+ pNumber14("U2", "mm", 500, 10, 3e3, 1),
4275
+ pNumber14("U3", "mm", 400, 10, 3e3, 1),
4276
+ pNumber14("V1", "mm", 600, 10, 3e3, 1),
4277
+ pNumber14("V2", "mm", 400, 10, 3e3, 1),
4278
+ pNumber14("JR1", "mm", 100, 0, 2e3, 1),
4279
+ pNumber14("JR2", "mm", 100, 0, 2e3, 1),
4280
+ pNumber14("JR3", "mm", 100, 0, 2e3, 1),
4281
+ pNumber14("JR4", "mm", 100, 0, 2e3, 1),
4282
+ pNumber14("JR5", "mm", 100, 0, 2e3, 1),
4283
+ pNumber14("JR6", "mm", 100, 0, 2e3, 1)
4284
+ ],
4285
+ paramSvg: {
4286
+ L1: "capsule_side.svg",
4287
+ WW1: "capsule_top.svg",
4288
+ E1: "capsule_nose.svg",
4289
+ H1: "capsule_nose.svg",
4290
+ H2: "capsule_nose.svg",
4291
+ H3: "capsule_nose.svg",
4292
+ W1: "capsule_nose.svg",
4293
+ W3: "capsule_nose.svg",
4294
+ C3: "capsule_nose.svg",
4295
+ R1: "capsule_nose.svg",
4296
+ R2: "capsule_nose.svg",
4297
+ R3: "capsule_nose.svg",
4298
+ R4: "capsule_nose.svg",
4299
+ H0: "capsule_side.svg",
4300
+ D7: "capsule_side.svg",
4301
+ D8: "capsule_side.svg",
4302
+ WW2: "capsule_wheels.svg",
4303
+ WW3: "capsule_wheels.svg",
4304
+ W6: "capsule_side.svg",
4305
+ W7: "capsule_side.svg",
4306
+ W8: "capsule_side.svg",
4307
+ H6: "capsule_side.svg",
4308
+ FH1: "capsule_wheels.svg",
4309
+ FW1: "capsule_wheels.svg",
4310
+ FR1: "capsule_wheels.svg",
4311
+ FH3: "capsule_wheels.svg",
4312
+ FW3: "capsule_wheels.svg",
4313
+ FR3: "capsule_wheels.svg",
4314
+ topStyle: "capsule_side.svg",
4315
+ H5: "capsule_nose.svg",
4316
+ W4: "capsule_nose.svg",
4317
+ W5: "capsule_top.svg",
4318
+ R5: "capsule_top.svg",
4319
+ S5: "capsule_top.svg",
4320
+ sideWall: "capsule_side.svg",
4321
+ U1: "capsule_wall.svg",
4322
+ U2: "capsule_wall.svg",
4323
+ U3: "capsule_wall.svg",
4324
+ V1: "capsule_wall.svg",
4325
+ V2: "capsule_wall.svg",
4326
+ JR1: "capsule_wall.svg",
4327
+ JR2: "capsule_wall.svg",
4328
+ JR3: "capsule_wall.svg",
4329
+ JR4: "capsule_wall.svg",
4330
+ JR5: "capsule_wall.svg",
4331
+ JR6: "capsule_wall.svg"
4332
+ },
4333
+ sim: {
4334
+ tMax: 180,
4335
+ tStep: 0.5,
4336
+ tUpdate: 500
4337
+ // every 0.5 second
4338
+ }
4339
+ };
4340
+ function pGeom14(t, param, suffix = "") {
4341
+ const rGeome = initGeom14(pDef14.partName + suffix);
4342
+ const figBody = figure12();
4343
+ const figWheels = figure12();
4344
+ const figFront = figure12();
4345
+ const figTop = figure12();
4346
+ const figTopInt = figure12();
4347
+ const figTopTop = figure12();
4348
+ const figTopLeg = figure12();
4349
+ const figWall = figure12();
4350
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
4351
+ `;
4352
+ try {
4353
+ let ctrBody2 = function(withBat) {
4354
+ const rCtr = contour14(-L12, param.H0);
4355
+ if (withBat) {
4356
+ rCtr.addSegStrokeR(Wwheels, 0).addSegStrokeR(0, -Hbatterie).addSegStrokeR(Lbatterie, 0).addSegStrokeR(0, Hbatterie).addSegStrokeR(Wwheels, 0);
4357
+ } else {
4358
+ rCtr.addSegStrokeR(param.L1, 0);
4359
+ }
4360
+ rCtr.addCornerRounded(param.R1).addSegStrokeR(param.W1, param.H1).addCornerRounded(param.R2).addSegStrokeR(0, param.H2).addCornerRounded(param.R3).addPointR(p1.cx, p1.cy).addPointR(-param.W3, param.H3).addSegArc2().addCornerRounded(param.R4).addSegStrokeR(-Lroof, 0).addCornerRounded(param.R4).addPointR(p2.cx, p2.cy).addPointR(-param.W3, -param.H3).addSegArc2().addCornerRounded(param.R3).addSegStrokeR(0, -param.H2).addCornerRounded(param.R2).closeSegStroke().addCornerRounded(param.R1);
4361
+ return rCtr;
4362
+ }, ctrWheels2 = function(sign) {
4363
+ const rCtr = contour14(0, posYwheels).addSegStrokeR(sign * R7, 0).addSegStrokeR(0, param.WW3).addSegStrokeR(sign * (R8 - R7), 0).addSegStrokeR(0, 2 * WW22).addSegStrokeR(-sign * (R8 - R7), 0).addSegStrokeR(0, param.WW3).addSegStrokeR(-sign * R7, 0).closeSegStroke();
4364
+ return rCtr;
4365
+ }, makeCtrTop2 = function(radius) {
4366
+ const rCtr = contour14(-L52 + topR - radius, -R52).addPointR(radius, -radius).addSegArc(radius, false, true).addSegStrokeR(L53, 0).addPointR(radius, radius).addSegArc(radius, false, true).addSegStrokeR(0, R53).addPointR(-radius, radius).addSegArc(radius, false, true).addSegStrokeR(-L53, 0).addPointR(-radius, -radius).addSegArc(radius, false, true).closeSegStroke();
4367
+ return rCtr;
4368
+ }, ctrSideWindow2 = function(sign) {
4369
+ const p0x = sign * (Ltotal / 2 - param.U1);
4370
+ const p0y = param.H0 + param.H1 + param.H2 - UH2dy;
4371
+ const rCtr = contour14(p0x, p0y).addCornerRounded(param.JR1).addPointR(sign * p1ub.cx, p1ub.cy).addPointR(-sign * UW3b, UH3b).addSegArc2().addCornerRounded(param.JR4).addSegStrokeR(-sign * param.U2, 0).addCornerRounded(param.JR3).addSegStrokeR(0, -UH3b).addCornerRounded(param.JR2).closeSegStroke();
4372
+ return rCtr;
4373
+ }, volWheel2 = function(posX, idx) {
4374
+ return {
4375
+ outName: `subpax_${designName}_wheel${idx}`,
4376
+ face: `${designName}_faceWheels`,
4377
+ extrudeMethod: EExtrude11.eRotate,
4378
+ rotate: [0, 0, 0],
4379
+ translate: [posX, R7, 0]
4380
+ };
4381
+ }, volTopLeg2 = function(posX, posZ, rotY, idx) {
4382
+ return {
4383
+ outName: `subpax_${designName}_topLeg${idx}`,
4384
+ face: `${designName}_faceTopLeg`,
4385
+ extrudeMethod: EExtrude11.eLinearOrtho,
4386
+ length: E1,
4387
+ rotate: [0, rotY, 0],
4388
+ translate: [posX, 0, posZ]
4389
+ };
4390
+ };
4391
+ var ctrBody = ctrBody2, ctrWheels = ctrWheels2, makeCtrTop = makeCtrTop2, ctrSideWindow = ctrSideWindow2, volWheel = volWheel2, volTopLeg = volTopLeg2;
4392
+ const pi2 = Math.PI / 2;
4393
+ const platSurface = param.L1 * param.WW1 / 10 ** 6;
4394
+ const L12 = param.L1 / 2;
4395
+ const E1 = param.E1;
4396
+ const E12 = 2 * E1;
4397
+ const Wwheels = param.W6 + param.W7 + param.W8;
4398
+ const Hbatterie = param.H0 - param.H6;
4399
+ const Lbatterie = param.L1 - 2 * Wwheels;
4400
+ const Lroof = param.L1 + 2 * param.W1 - 2 * param.W3;
4401
+ const aN1 = Math.atan2(param.H3, -param.W3);
4402
+ const p1 = point7(0, 0).translate(-param.W3 / 2, param.H3 / 2).translatePolar(aN1 - pi2, param.C3);
4403
+ const aN2 = Math.atan2(-param.H3, -param.W3);
4404
+ const p2 = point7(0, 0).translate(-param.W3 / 2, -param.H3 / 2).translatePolar(aN2 - pi2, param.C3);
4405
+ const aN3 = Math.atan2(param.H1, -param.W1);
4406
+ const L1dx = E1 / Math.tan(aN3 / 2);
4407
+ const H2dy = E1 / Math.tan((3 * pi2 - aN3) / 2);
4408
+ const aN4 = pi2 + Math.atan2(param.W3, param.H3);
4409
+ const H3dy = E1 / Math.tan(aN4 / 2);
4410
+ const W3dx = E1 / Math.tan((3 * pi2 - aN4) / 2);
4411
+ const W3b = param.W3 - E1 + W3dx;
4412
+ const H3b = param.H3 - E1 + H3dy;
4413
+ const p1b = point7(0, 0).translate(-W3b / 2, H3b / 2).translatePolar(aN1 - pi2, param.C3);
4414
+ const p2b = point7(0, 0).translate(-W3b / 2, -H3b / 2).translatePolar(aN2 - pi2, param.C3);
4415
+ const iR1 = Math.max(0, param.R1 - E1);
4416
+ const iR2 = Math.max(0, param.R2 - E1);
4417
+ const iR3 = Math.max(0, param.R3 - E1);
4418
+ const iR4 = Math.max(0, param.R4 - E1);
4419
+ const UH2dy = param.U1 / Math.tan((3 * pi2 - aN3) / 2);
4420
+ const UW3b = param.W3 - param.U1 + param.U1 / Math.tan((3 * pi2 - aN4) / 2);
4421
+ const UH3b = param.H3 - param.U1 + param.U1 / Math.tan(aN4 / 2);
4422
+ const p1ub = point7(0, 0).translate(-UW3b / 2, UH3b / 2).translatePolar(aN1 - pi2, param.C3);
4423
+ const Ltotal = param.L1 + 2 * param.W1;
4424
+ const Htotal = param.H1 + param.H2 + param.H3;
4425
+ const LwallDoor = Ltotal - 2 * (param.U1 + UW3b + param.U2 + param.U3);
4426
+ const HwallDoor = Htotal - param.V1 - param.V2;
4427
+ const R7 = param.D7 / 2;
4428
+ const R8 = param.D8 / 2;
4429
+ const posXwheel1 = L12 - param.W8;
4430
+ const posXwheel2 = posXwheel1 - param.W7;
4431
+ const WW12 = param.WW1 / 2;
4432
+ const WW22 = param.WW2 / 2;
4433
+ const posYwheels = WW12 - WW22 - param.WW3;
4434
+ const posXwheels = [-posXwheel1, -posXwheel2, posXwheel1, posXwheel2];
4435
+ const posYwheels2 = -posYwheels - WW22 - param.WW3;
4436
+ const L5 = Lroof - 2 * param.W4;
4437
+ const L52 = L5 / 2;
4438
+ const posYtop = param.H0 + param.H1 + param.H2 + param.H3;
4439
+ const posYtop2 = posYtop + param.H5;
4440
+ const heightTot = posYtop2 + E1;
4441
+ const W52 = param.W5 / 2;
4442
+ const R53 = param.R5 * 3;
4443
+ const R52 = R53 / 2;
4444
+ const topR = W52 - R52;
4445
+ const L53 = L5 - 2 * topR;
4446
+ const H53 = param.H5 - 4 * param.R5;
4447
+ const posYbatterie = param.H6 + E1;
4448
+ const LbatInt = Lbatterie - 2 * E1;
4449
+ const LbatInt2 = LbatInt / 2;
4450
+ const HbatInt = Hbatterie - E1;
4451
+ const posYH3 = param.H0 + param.H1 + param.H2;
4452
+ const FWL1 = param.WW1 - 2 * param.FW1;
4453
+ const FWL3 = param.WW1 - 2 * param.FW3;
4454
+ const HfrontWin = Htotal - param.FH1 - param.FH3;
4455
+ const Ltot2 = Ltotal + 200;
4456
+ if (param.L1 - 2 * Wwheels < 2 * E1) {
4457
+ throw `err176: L1 ${ffix15(param.L1)} is too small compare to W6 ${ffix15(param.W6)}, W7 ${ffix15(param.W7)} and W8 ${ffix15(param.W8)} mm`;
4458
+ }
4459
+ if (Hbatterie < E1) {
4460
+ throw `err114: Hbatterie ${ffix15(Hbatterie)} is too small compare to E1 ${ffix15(E1)} mm`;
4461
+ }
4462
+ if (Lbatterie < 2 * E1) {
4463
+ throw `err118: Lbatterie ${ffix15(Lbatterie)} is too small compare to E1 ${ffix15(E1)} mm`;
4464
+ }
4465
+ if (L5 < 3 * param.R5 + param.W5) {
4466
+ throw `err122: L5 ${ffix15(L5)} is too small compare to W5 ${ffix15(param.W5)} and R5 ${ffix15(param.R5)} mm`;
4467
+ }
4468
+ if (H53 < 0.1) {
4469
+ throw `err220: H5 ${ffix15(param.H5)} is too small compare to R5 ${ffix15(param.R5)} mm`;
4470
+ }
4471
+ rGeome.logstr += `Platform surface: ${ffix15(platSurface)} m2, height: ${ffix15(heightTot / 1e3)} m
4472
+ `;
4473
+ rGeome.logstr += `Lroof: ${ffix15(Lroof)}, L5: ${ffix15(L5)} mm
4474
+ `;
4475
+ rGeome.logstr += `Ltotal: ${ffix15(Ltotal / 1e3)}, Htotal: ${ffix15(Htotal / 1e3)} m
4476
+ `;
4477
+ rGeome.logstr += `Batterie: LbatInt ${ffix15(LbatInt)}, HbatInt: ${ffix15(HbatInt)}, WW1 ${ffix15(param.WW1)} mm
4478
+ `;
4479
+ const ctrBodyExt = ctrBody2(true);
4480
+ const ctrBodyInt = contour14(-L12 + L1dx, param.H0 + E1).addSegStrokeR(2 * L12 - 2 * L1dx, 0).addCornerRounded(iR1).addSegStrokeR(param.W1 - E1 + L1dx, param.H1 - E1 + H2dy).addCornerRounded(iR2).addSegStrokeR(0, param.H2 - 2 * H2dy).addCornerRounded(iR3).addPointR(p1b.cx, p1b.cy).addPointR(-W3b, H3b).addSegArc2().addCornerRounded(iR4).addSegStrokeR(-Lroof + 2 * W3dx, 0).addCornerRounded(iR4).addPointR(p2b.cx, p2b.cy).addPointR(-W3b, -H3b).addSegArc2().addCornerRounded(iR3).addSegStrokeR(0, -param.H2 + 2 * H2dy).addCornerRounded(iR2).closeSegStroke().addCornerRounded(iR1);
4481
+ const ctrBatterie = ctrRectangle7(-LbatInt2, posYbatterie, LbatInt, HbatInt);
4482
+ figBody.addMainOI([ctrBodyExt, ctrBodyInt, ctrBatterie]);
4483
+ figBody.addSecond(contourCircle11(-posXwheel1, R7, R7));
4484
+ figBody.addSecond(contourCircle11(-posXwheel1, R7, R8));
4485
+ figBody.addSecond(contourCircle11(-posXwheel2, R7, R7));
4486
+ figBody.addSecond(contourCircle11(-posXwheel2, R7, R8));
4487
+ figBody.addSecond(contourCircle11(posXwheel1, R7, R7));
4488
+ figBody.addSecond(contourCircle11(posXwheel1, R7, R8));
4489
+ figBody.addSecond(contourCircle11(posXwheel2, R7, R7));
4490
+ figBody.addSecond(contourCircle11(posXwheel2, R7, R8));
4491
+ figBody.addSecond(ctrRectangle7(-L52, posYtop, L5, param.H5));
4492
+ figBody.addSecond(ctrRectangle7(-L52 - param.S5, posYtop2, L5 + 2 * param.S5, E1));
4493
+ figWheels.addMainO(ctrWheels2(1));
4494
+ figWheels.addSecond(ctrWheels2(-1));
4495
+ const ctrFront = contour14(-FWL1 / 2, param.H0 + param.FH1).addCornerRounded(param.FR1).addSegStrokeR(FWL1, 0).addCornerRounded(param.FR1).addSegStrokeR(param.FW1 - param.FW3, HfrontWin).addCornerRounded(param.FR3).addSegStrokeR(-FWL3, 0).addCornerRounded(param.FR3).closeSegStroke();
4496
+ figFront.addMainO(ctrFront);
4497
+ figFront.addSecond(ctrWheels2(1).rotate(0, 0, pi2).translate(WW12, R7));
4498
+ figFront.addSecond(ctrWheels2(-1).rotate(0, 0, pi2).translate(WW12, R7));
4499
+ figFront.addSecond(ctrRectangle7(-WW12, param.H6, param.WW1, Hbatterie));
4500
+ figFront.addSecond(ctrRectangle7(-WW12, param.H0, param.WW1, param.H1));
4501
+ figFront.addSecond(ctrRectangle7(-WW12, param.H0 + param.H1, param.WW1, param.H2));
4502
+ figFront.addSecond(ctrRectangle7(-WW12, posYH3, param.WW1, param.H3));
4503
+ figFront.addSecond(ctrRectangle7(-W52, posYtop, param.W5, param.H5));
4504
+ figFront.addSecond(ctrRectangle7(-W52 - param.S5, posYtop2, param.W5 + 2 * param.S5, E1));
4505
+ figFront.addSecond(ctrRectangle7(-WW12 + E1, param.H0 + E1, param.WW1 - E12, Htotal - E12));
4506
+ const ctrTopInt = makeCtrTop2(topR - E1);
4507
+ const ctrTopExt = makeCtrTop2(topR);
4508
+ const ctrTopTop = makeCtrTop2(topR + param.S5);
4509
+ figTop.addMainOI([ctrTopExt, ctrTopInt]);
4510
+ figTop.addSecond(ctrTopTop);
4511
+ figTop.addSecond(ctrRectangle7(-Lroof / 2, -WW12, Lroof, 2 * WW12));
4512
+ figTop.addSecond(ctrRectangle7(-Ltotal / 2, -WW12, Ltotal, 2 * WW12));
4513
+ figTop.addSecond(ctrWheels2(1).translate(posXwheels[0], posYwheels2));
4514
+ figTop.addSecond(ctrWheels2(1).translate(posXwheels[1], posYwheels2));
4515
+ figTop.addSecond(ctrWheels2(1).translate(posXwheels[2], posYwheels2));
4516
+ figTop.addSecond(ctrWheels2(1).translate(posXwheels[3], posYwheels2));
4517
+ figTop.addSecond(ctrWheels2(-1).translate(posXwheels[0], posYwheels2));
4518
+ figTop.addSecond(ctrWheels2(-1).translate(posXwheels[1], posYwheels2));
4519
+ figTop.addSecond(ctrWheels2(-1).translate(posXwheels[2], posYwheels2));
4520
+ figTop.addSecond(ctrWheels2(-1).translate(posXwheels[3], posYwheels2));
4521
+ figTopInt.addMainO(ctrTopInt);
4522
+ figTopInt.mergeFigure(figTop, true);
4523
+ figTopTop.addMainO(ctrTopTop);
4524
+ figTopTop.mergeFigure(figTop, true);
4525
+ const ctrTopLeg = contour14(-R52, posYtop).addSegStrokeR(R53, 0).addSegStrokeR(0, param.R5).addPointR(-param.R5, param.R5).addSegArc(param.R5, false, false).addSegStrokeR(0, H53).addPointR(param.R5, param.R5).addSegArc(param.R5, false, false).addSegStrokeR(0, param.R5).addSegStrokeR(-R53, 0).addSegStrokeR(0, -param.R5).addPointR(param.R5, -param.R5).addSegArc(param.R5, false, false).addSegStrokeR(0, -H53).addPointR(-param.R5, -param.R5).addSegArc(param.R5, false, false).closeSegStroke();
4526
+ figTopLeg.addMainO(ctrTopLeg);
4527
+ figFront.addSecond(ctrTopLeg);
4528
+ const ctrDoor = contour14(-LwallDoor / 2, param.H0 + param.V1).addCornerRounded(param.JR5).addSegStrokeR(LwallDoor, 0).addCornerRounded(param.JR5).addSegStrokeR(0, HwallDoor).addCornerRounded(param.JR6).addSegStrokeR(-LwallDoor, 0).addCornerRounded(param.JR6).closeSegStroke();
4529
+ figWall.addMainOI([ctrBody2(false), ctrSideWindow2(1), ctrSideWindow2(-1), ctrDoor]);
4530
+ figWall.mergeFigure(figBody, true);
4531
+ rGeome.fig = {
4532
+ faceBody: figBody,
4533
+ faceWheels: figWheels,
4534
+ faceFront: figFront,
4535
+ faceTop: figTop,
4536
+ faceTopInt: figTopInt,
4537
+ faceTopTop: figTopTop,
4538
+ faceTopLeg: figTopLeg,
4539
+ faceWall: figWall
4540
+ };
4541
+ const designName = rGeome.partName;
4542
+ const miradorList = [];
4543
+ if (param.topStyle === 0) {
4544
+ miradorList.push(
4545
+ ...[
4546
+ `subpax_${designName}_top1`,
4547
+ `subpax_${designName}_top2`,
4548
+ `subpax_${designName}_topTop`,
4549
+ `subpax_${designName}_topLeg1`,
4550
+ `subpax_${designName}_topLeg2`,
4551
+ `subpax_${designName}_topLeg3`,
4552
+ `subpax_${designName}_topLeg4`,
4553
+ `subpax_${designName}_topLeg5`,
4554
+ `subpax_${designName}_topLeg6`
4555
+ ]
4556
+ );
4557
+ }
4558
+ const roofHoleList = [];
4559
+ if (param.topStyle !== 2) {
4560
+ roofHoleList.push(`subpax_${designName}_topInt`);
4561
+ }
4562
+ const wallList = [];
4563
+ if (param.sideWall === 1) {
4564
+ wallList.push(...[`subpax_${designName}_wall1`, `subpax_${designName}_wall2`]);
4565
+ }
4566
+ rGeome.vol = {
4567
+ extrudes: [
4568
+ {
4569
+ outName: `subpax_${designName}_body`,
4570
+ face: `${designName}_faceBody`,
4571
+ extrudeMethod: EExtrude11.eLinearOrtho,
4572
+ length: param.WW1,
4573
+ rotate: [0, 0, 0],
4574
+ translate: [0, 0, 0]
4575
+ },
4576
+ volWheel2(posXwheels[0], "1"),
4577
+ volWheel2(posXwheels[1], "2"),
4578
+ volWheel2(posXwheels[2], "3"),
4579
+ volWheel2(posXwheels[3], "4"),
4580
+ {
4581
+ outName: `subpax_${designName}_frontWin`,
4582
+ face: `${designName}_faceFront`,
4583
+ extrudeMethod: EExtrude11.eLinearOrtho,
4584
+ length: Ltot2,
4585
+ rotate: [0, pi2, 0],
4586
+ translate: [-Ltot2 / 2, 0, WW12]
4587
+ },
4588
+ {
4589
+ outName: `subpax_${designName}_topInt`,
4590
+ face: `${designName}_faceTopInt`,
4591
+ extrudeMethod: EExtrude11.eLinearOrtho,
4592
+ length: 3 * E1,
4593
+ rotate: [-pi2, 0, 0],
4594
+ translate: [0, posYtop - 2 * E1, WW12]
4595
+ },
4596
+ {
4597
+ outName: `subpax_${designName}_top1`,
4598
+ face: `${designName}_faceTop`,
4599
+ extrudeMethod: EExtrude11.eLinearOrtho,
4600
+ length: param.R5,
4601
+ rotate: [-pi2, 0, 0],
4602
+ translate: [0, posYtop, WW12]
4603
+ },
4604
+ {
4605
+ outName: `subpax_${designName}_top2`,
4606
+ face: `${designName}_faceTop`,
4607
+ extrudeMethod: EExtrude11.eLinearOrtho,
4608
+ length: param.R5,
4609
+ rotate: [-pi2, 0, 0],
4610
+ translate: [0, posYtop2 - param.R5, WW12]
4611
+ },
4612
+ {
4613
+ outName: `subpax_${designName}_topTop`,
4614
+ face: `${designName}_faceTopTop`,
4615
+ extrudeMethod: EExtrude11.eLinearOrtho,
4616
+ length: E1,
4617
+ rotate: [-pi2, 0, 0],
4618
+ translate: [0, posYtop2, WW12]
4619
+ },
4620
+ volTopLeg2(-L52, WW12, pi2, "1"),
4621
+ volTopLeg2(L52 - E1, WW12, pi2, "2"),
4622
+ volTopLeg2(-L53 / 2 + R52, WW12 - W52, 0, "3"),
4623
+ volTopLeg2(-L53 / 2 + R52, WW12 + W52 - E1, 0, "4"),
4624
+ volTopLeg2(L53 / 2 - R52, WW12 - W52, 0, "5"),
4625
+ volTopLeg2(L53 / 2 - R52, WW12 + W52 - E1, 0, "6"),
4626
+ {
4627
+ outName: `subpax_${designName}_wall1`,
4628
+ face: `${designName}_faceWall`,
4629
+ extrudeMethod: EExtrude11.eLinearOrtho,
4630
+ length: E1,
4631
+ rotate: [0, 0, 0],
4632
+ translate: [0, 0, 0]
4633
+ },
4634
+ {
4635
+ outName: `subpax_${designName}_wall2`,
4636
+ face: `${designName}_faceWall`,
4637
+ extrudeMethod: EExtrude11.eLinearOrtho,
4638
+ length: E1,
4639
+ rotate: [0, 0, 0],
4640
+ translate: [0, 0, param.WW1 - E1]
4641
+ }
4642
+ ],
4643
+ volumes: [
4644
+ {
4645
+ outName: `ipax_${designName}_plus`,
4646
+ boolMethod: EBVolume11.eUnion,
4647
+ inList: [
4648
+ `subpax_${designName}_body`,
4649
+ `subpax_${designName}_wheel1`,
4650
+ `subpax_${designName}_wheel2`,
4651
+ `subpax_${designName}_wheel3`,
4652
+ `subpax_${designName}_wheel4`,
4653
+ ...miradorList,
4654
+ ...wallList
4655
+ ]
4656
+ },
4657
+ {
4658
+ outName: `ipax_${designName}_minus`,
4659
+ boolMethod: EBVolume11.eUnion,
4660
+ inList: [`subpax_${designName}_frontWin`, ...roofHoleList]
4661
+ },
4662
+ {
4663
+ outName: `pax_${designName}`,
4664
+ boolMethod: EBVolume11.eSubstraction,
4665
+ inList: [`ipax_${designName}_plus`, `ipax_${designName}_minus`]
4666
+ }
4667
+ ]
4668
+ };
4669
+ rGeome.sub = {};
4670
+ rGeome.logstr += "capsule drawn successfully!\n";
4671
+ rGeome.calcErr = false;
4672
+ } catch (emsg) {
4673
+ rGeome.logstr += emsg;
4674
+ console.log(emsg);
4675
+ }
4676
+ return rGeome;
4677
+ }
4678
+ var capsuleDef = {
4679
+ pTitle: "capsule",
4680
+ pDescription: "high-level concept of the train-capsule",
4681
+ pDef: pDef14,
4682
+ pGeom: pGeom14
4683
+ };
3611
4684
  export {
4685
+ capsuleDef,
3612
4686
  door1arcDef,
4687
+ heliostatDef,
3613
4688
  houseDef,
3614
4689
  plugTorqueDef,
4690
+ rccarDef,
3615
4691
  springIntDef,
3616
4692
  springOneDef,
3617
4693
  springSideDef,