desi76 0.1.6 → 0.1.7

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
@@ -333,16 +333,18 @@ var voilaDef = {
333
333
  pGeom: pGeom2
334
334
  };
335
335
 
336
- // src/stone/stairs.ts
336
+ // src/charpente/abri.ts
337
337
  import {
338
338
  point,
339
339
  contour as contour3,
340
340
  contourCircle as contourCircle3,
341
341
  ctrRectangle as ctrRectangle2,
342
342
  figure as figure3,
343
+ degToRad,
343
344
  radToDeg,
344
345
  ffix as ffix2,
345
346
  pNumber as pNumber3,
347
+ pCheckbox,
346
348
  pDropdown,
347
349
  pSectionSeparator as pSectionSeparator3,
348
350
  EExtrude as EExtrude3,
@@ -350,22 +352,1419 @@ import {
350
352
  initGeom as initGeom3
351
353
  } from "geometrix";
352
354
  var pDef3 = {
355
+ partName: "abri",
356
+ params: [
357
+ //pNumber(name, unit, init, min, max, step)
358
+ pNumber3("Nb1", "poleTriangles", 3, 2, 20, 1),
359
+ //pNumber('Nb2', 'slotTriangles', 0, 0, 20, 1), // not yet implemented
360
+ pNumber3("Lb", "mm", 3e3, 10, 1e4, 1),
361
+ pNumber3("La", "mm", 3e3, 10, 1e4, 1),
362
+ pCheckbox("SecondPoleNorth", false),
363
+ pNumber3("KaNorth", "mm", 1e3, 10, 1e4, 1),
364
+ pNumber3("JaNorth", "mm", 1e3, 10, 1e4, 1),
365
+ pCheckbox("SecondPoleSouth", false),
366
+ pNumber3("KaSouth", "mm", 1e3, 10, 1e4, 1),
367
+ pNumber3("JaSouth", "mm", 1e3, 10, 1e4, 1),
368
+ pSectionSeparator3("West East Sides"),
369
+ pNumber3("Ra", "degree", 30, 10, 80, 0.5),
370
+ // 50 + 23.5 = 73.5 that's very steep!
371
+ pNumber3("Rt", "%", 50, 0, 100, 1),
372
+ pNumber3("ReS", "mm", 500, 1, 5e3, 1),
373
+ pNumber3("ReN", "mm", 500, 1, 5e3, 1),
374
+ pNumber3("H1", "mm", 2500, 10, 5e3, 1),
375
+ pNumber3("H2", "mm", 300, 10, 1e3, 1),
376
+ pNumber3("H3", "mm", 300, 10, 1e3, 1),
377
+ pCheckbox("bSplit", false),
378
+ pCheckbox("aSplit", false),
379
+ pNumber3("H3s", "mm", 300, 10, 1e3, 1),
380
+ pNumber3("H3arc", "mm", 0, 0, 2e3, 1),
381
+ pSectionSeparator3("plank-1"),
382
+ pNumber3("W1a", "mm", 300, 10, 1e3, 1),
383
+ pNumber3("W1b", "mm", 300, 10, 1e3, 1),
384
+ pNumber3("V1", "mm", 40, 0, 1e3, 1),
385
+ pNumber3("U1", "mm", 40, 0, 1e3, 1),
386
+ pNumber3("W2", "mm", 150, 5, 1e3, 1),
387
+ pNumber3("W3", "mm", 150, 5, 1e3, 1),
388
+ pNumber3("D2", "mm", 20, 0, 200, 1),
389
+ pNumber3("D3", "mm", 20, 0, 200, 1),
390
+ pSectionSeparator3("plank-4 plank-7"),
391
+ pNumber3("W4", "mm", 200, 1, 1e3, 1),
392
+ pNumber3("B4", "mm", 100, 0, 1e3, 1),
393
+ pNumber3("D4", "mm", 20, 0, 200, 1),
394
+ pNumber3("P41", "mm", 20, 0, 200, 1),
395
+ pNumber3("P42", "mm", 20, 0, 200, 1),
396
+ pNumber3("S4", "mm", 60, 0, 200, 1),
397
+ pNumber3("S4e", "mm", 0, 0, 20, 0.1),
398
+ pNumber3("S4e2", "mm", 0, 0, 20, 0.1),
399
+ pNumber3("Q4", "mm", 500, 0, 2e3, 1),
400
+ pNumber3("Q4Init", "mm", 50, 0, 2e3, 1),
401
+ pNumber3("dropLastN", "notch", 0, 0, 10, 1),
402
+ pNumber3("dropLastS", "notch", 0, 0, 10, 1),
403
+ pNumber3("H7", "mm", 60, 0, 200, 1),
404
+ pSectionSeparator3("plank-5 plank-8"),
405
+ pNumber3("W5a", "mm", 200, 1, 1e3, 1),
406
+ pNumber3("W5bs", "mm", 0, 0, 1e3, 1),
407
+ pNumber3("D5", "mm", 20, 0, 200, 1),
408
+ pDropdown("top_opt", ["shifted", "aligned"]),
409
+ pNumber3("G5Min", "mm", 200, 1, 1e3, 1),
410
+ pNumber3("P5", "mm", 20, 1, 200, 1),
411
+ pNumber3("W8", "mm", 200, 1, 1e3, 1),
412
+ pSectionSeparator3("plank-6"),
413
+ pNumber3("W6", "mm", 100, 1, 1e3, 1),
414
+ pNumber3("H6", "mm", 100, 1, 1e3, 1),
415
+ pDropdown("peak6", ["peak", "square"]),
416
+ pSectionSeparator3("Diagonals"),
417
+ pNumber3("dbW", "mm", 100, 1, 500, 1),
418
+ pNumber3("dbX", "mm", 500, 1, 2e3, 1),
419
+ pNumber3("dbY", "mm", 1e3, 1, 2e3, 1),
420
+ pNumber3("dbP", "mm", 50, 1, 200, 1),
421
+ pNumber3("dbPe", "mm", 0, 0, 20, 0.1),
422
+ pNumber3("dbD", "mm", 20, 1, 200, 1),
423
+ pNumber3("dbE", "mm", 50, 1, 500, 1),
424
+ pNumber3("daW", "mm", 100, 1, 500, 1),
425
+ pNumber3("daX", "mm", 500, 1, 2e3, 1),
426
+ pNumber3("daY", "mm", 1e3, 1, 2e3, 1),
427
+ pNumber3("daP", "mm", 50, 1, 200, 1),
428
+ pNumber3("daPe", "mm", 0, 0, 20, 0.1),
429
+ pNumber3("daD", "mm", 20, 1, 200, 1),
430
+ pNumber3("daE", "mm", 50, 1, 500, 1),
431
+ pNumber3("dtW", "mm", 100, 1, 500, 1),
432
+ pNumber3("dtX", "mm", 1e3, 1, 2e3, 1),
433
+ pNumber3("dtY", "mm", 1e3, 1, 2e3, 1),
434
+ pNumber3("dtP", "mm", 50, 1, 200, 1),
435
+ pNumber3("dtPe", "mm", 0, 0, 20, 0.1),
436
+ pNumber3("dtQ", "mm", 20, 1, 200, 1),
437
+ pNumber3("dtQe", "mm", 0, 0, 20, 0.1),
438
+ pNumber3("dtF", "mm", 800, 1, 4e3, 1),
439
+ pSectionSeparator3("3D Export"),
440
+ pCheckbox("d3Plank1", false),
441
+ pDropdown("d3Plank1West", ["Low", "High", "End"]),
442
+ pDropdown("d3Plank1East", ["Low", "High", "End"]),
443
+ pDropdown("d3Plank1SN", ["P1", "P2", "P3", "P4"]),
444
+ pCheckbox("d3Plank2EE", false),
445
+ pCheckbox("d3Plank2Slot", false),
446
+ pCheckbox("d3Plank2Short", false),
447
+ pCheckbox("d3Plank3EE", false),
448
+ pCheckbox("d3Plank3S", false),
449
+ pCheckbox("d3Plank3M", false),
450
+ pCheckbox("d3Plank3N", false),
451
+ pCheckbox("d3Plank4S", false),
452
+ pCheckbox("d3Plank4N", false),
453
+ pCheckbox("d3Plank5", false),
454
+ pCheckbox("d3Plank6", false),
455
+ pCheckbox("d3Plank7", false),
456
+ pCheckbox("d3Plank8S", false),
457
+ pCheckbox("d3Plank8N", false),
458
+ pCheckbox("d3PlankDiagTop", false),
459
+ pCheckbox("d3PlankDiagA", false),
460
+ pCheckbox("d3PlankDiagB", false),
461
+ pCheckbox("d3Assembly", true)
462
+ ],
463
+ paramSvg: {
464
+ Nb1: "abri_base.svg",
465
+ //Nb2: 'abri_base.svg',
466
+ Lb: "abri_base.svg",
467
+ La: "abri_base.svg",
468
+ SecondPoleNorth: "abri_base.svg",
469
+ KaNorth: "abri_base.svg",
470
+ SecondPoleSouth: "abri_base.svg",
471
+ KaSouth: "abri_base.svg",
472
+ JaNorth: "abri_base.svg",
473
+ JaSouth: "abri_base.svg",
474
+ Ra: "abri_triangle.svg",
475
+ Rt: "abri_triangle.svg",
476
+ ReS: "abri_triangle.svg",
477
+ ReN: "abri_plank4.svg",
478
+ H1: "abri_beam_heights.svg",
479
+ H2: "abri_beam_heights.svg",
480
+ H3: "abri_south_bSplit_off.svg",
481
+ bSplit: "abri_south_bSplit.svg",
482
+ aSplit: "abri_east_P1234.svg",
483
+ H3s: "abri_south_P2P3.svg",
484
+ H3arc: "abri_beam_heights.svg",
485
+ W1a: "abri_base.svg",
486
+ W1b: "abri_base.svg",
487
+ V1: "abri_base.svg",
488
+ U1: "abri_base.svg",
489
+ W2: "abri_base.svg",
490
+ W3: "abri_base.svg",
491
+ D2: "abri_base.svg",
492
+ D3: "abri_base.svg",
493
+ W4: "abri_plank4.svg",
494
+ B4: "abri_triangle.svg",
495
+ D4: "abri_plank4.svg",
496
+ P41: "abri_plank4.svg",
497
+ P42: "abri_plank4.svg",
498
+ S4: "abri_plank4.svg",
499
+ S4e: "abri_notch.svg",
500
+ S4e2: "abri_plank4.svg",
501
+ Q4: "abri_plank4.svg",
502
+ Q4Init: "abri_plank4.svg",
503
+ dropLastN: "abri_top_opt_shifted.svg",
504
+ dropLastS: "abri_top_opt_aligned.svg",
505
+ H7: "abri_triangle.svg",
506
+ W5a: "abri_triangle.svg",
507
+ W5bs: "abri_plank5b.svg",
508
+ D5: "abri_triangle.svg",
509
+ top_opt: "abri_top_opt_shifted.svg",
510
+ G5Min: "abri_triangle.svg",
511
+ P5: "abri_plank8.svg",
512
+ W8: "abri_triangle.svg",
513
+ W6: "abri_top_opt_aligned.svg",
514
+ H6: "abri_triangle.svg",
515
+ peak6: "abri_triangle.svg",
516
+ dbW: "abri_diagonal_b.svg",
517
+ dbX: "abri_diagonal_b.svg",
518
+ dbY: "abri_diagonal_b.svg",
519
+ dbP: "abri_diagonal_b.svg",
520
+ dbPe: "abri_diagonal_b.svg",
521
+ dbD: "abri_diagonal_b.svg",
522
+ dbE: "abri_diagonal_b.svg",
523
+ daW: "abri_diagonal_a.svg",
524
+ daX: "abri_diagonal_a.svg",
525
+ daY: "abri_diagonal_a.svg",
526
+ daP: "abri_diagonal_a.svg",
527
+ daPe: "abri_diagonal_a.svg",
528
+ daD: "abri_diagonal_a.svg",
529
+ daE: "abri_diagonal_a.svg",
530
+ dtW: "abri_diagonal_top.svg",
531
+ dtX: "abri_diagonal_top.svg",
532
+ dtY: "abri_diagonal_top.svg",
533
+ dtP: "abri_diagonal_top.svg",
534
+ dtPe: "abri_diagonal_top.svg",
535
+ dtQ: "abri_diagonal_top.svg",
536
+ dtQe: "abri_diagonal_top.svg",
537
+ dtF: "abri_base.svg",
538
+ d3Plank1: "abri_3d_export.svg",
539
+ d3Plank1West: "abri_south_P2P3.svg",
540
+ d3Plank1East: "abri_south_P2P3.svg",
541
+ d3Plank1SN: "abri_east_P1234.svg",
542
+ d3Plank2EE: "abri_3d_export.svg",
543
+ d3Plank2Slot: "abri_3d_export.svg",
544
+ d3Plank2Short: "abri_3d_export.svg",
545
+ d3Plank3One: "abri_3d_export.svg",
546
+ d3Plank3S: "abri_3d_export.svg",
547
+ d3Plank3M: "abri_3d_export.svg",
548
+ d3Plank3N: "abri_3d_export.svg",
549
+ d3Plank4S: "abri_3d_export.svg",
550
+ d3Plank4N: "abri_3d_export.svg",
551
+ d3Plank5: "abri_3d_export.svg",
552
+ d3Plank6: "abri_3d_export.svg",
553
+ d3Plank7: "abri_3d_export.svg",
554
+ d3Plank8S: "abri_3d_export.svg",
555
+ d3Plank8N: "abri_3d_export.svg",
556
+ d3PlankDiagTop: "abri_3d_export.svg",
557
+ d3PlankDiagA: "abri_3d_export.svg",
558
+ d3PlankDiagB: "abri_3d_export.svg",
559
+ d3Assembly: "abri_3d_export.svg"
560
+ },
561
+ sim: {
562
+ tMax: 180,
563
+ tStep: 0.5,
564
+ tUpdate: 500
565
+ // every 0.5 second
566
+ }
567
+ };
568
+ function pGeom3(t, param, suffix = "") {
569
+ const rGeome = initGeom3(pDef3.partName + suffix);
570
+ const figBase = figure3();
571
+ const figSouth = figure3();
572
+ const figEast = figure3();
573
+ const figPlank1a = figure3();
574
+ const figPlank1b = figure3();
575
+ const figPlank2EE = figure3();
576
+ const figPlank2Slot = figure3();
577
+ const figPlank2Short = figure3();
578
+ const figPlank3EE = figure3();
579
+ const figPlank3S = figure3();
580
+ const figPlank3M = figure3();
581
+ const figPlank3N = figure3();
582
+ const figPlank4S = figure3();
583
+ const figPlank4N = figure3();
584
+ const figPlank5a = figure3();
585
+ const figPlank5b = figure3();
586
+ const figPlank6b = figure3();
587
+ const figPlank6c = figure3();
588
+ const figPlank7c = figure3();
589
+ const figPlank8S = figure3();
590
+ const figPlank8N = figure3();
591
+ const figPlankDiagTop = figure3();
592
+ const figPlankDiagA = figure3();
593
+ const figPlankDiagB = figure3();
594
+ rGeome.logstr += `${rGeome.partName} simTime: ${t}
595
+ `;
596
+ try {
597
+ let JaMin2 = function(iRa) {
598
+ const rMin = H32 + W42 / Math.cos(iRa - pi2) + H32 / Math.tan(iRa);
599
+ return rMin;
600
+ }, ctrPlank1a2 = function(ix, iy, iP1234) {
601
+ const H3sc = (iP1234 === 2 || iP1234 === 3) && param.aSplit === 1 ? param.H3s : 0;
602
+ const H2s = param.bSplit === 1 ? param.H2 : 0;
603
+ const H2H3c = H2H3 + H2s;
604
+ let sideN = iP1234 === 4 ? 2 : 0;
605
+ let sideS = iP1234 === 1 ? 2 : 0;
606
+ if (param.aSplit === 1 && iP1234 === 2) {
607
+ sideN = 1;
608
+ }
609
+ if (param.aSplit === 1 && iP1234 === 3) {
610
+ sideS = 1;
611
+ }
612
+ const hh0 = param.H2 + H2s;
613
+ const hh1 = hh0 + (param.aSplit === 1 ? param.H3 : 0);
614
+ const h3Lo = param.daY + pldaP1 - pldaPe2 - hh0;
615
+ const h3Hi = param.daY + pldaP1 - pldaPe2 - hh1;
616
+ const h2 = pldaP3 + pldaPe;
617
+ const h1Lo = param.H1 - h2 - h3Lo;
618
+ const h1Hi = param.H1 - h2 - h3Hi;
619
+ const rCtr = contour3(ix, iy);
620
+ if (sideN === 2) {
621
+ rCtr.addSegStrokeR(param.H1, 0);
622
+ } else if (sideN === 1) {
623
+ rCtr.addSegStrokeR(h1Hi, 0).addSegStrokeR(0, param.daP).addSegStrokeR(h2, 0).addSegStrokeR(0, -param.daP).addSegStrokeR(h3Hi, 0);
624
+ } else {
625
+ rCtr.addSegStrokeR(h1Lo, 0).addSegStrokeR(0, param.daP).addSegStrokeR(h2, 0).addSegStrokeR(0, -param.daP).addSegStrokeR(h3Lo, 0);
626
+ }
627
+ rCtr.addSegStrokeR(0, param.V1).addSegStrokeR(H2H3c + H3sc, 0).addSegStrokeR(0, W1a2V1).addSegStrokeR(-H2H3c - H3sc, 0).addSegStrokeR(0, param.V1);
628
+ if (sideS === 2) {
629
+ rCtr.addSegStrokeR(-param.H1, 0);
630
+ } else if (sideS === 1) {
631
+ rCtr.addSegStrokeR(-h3Hi, 0).addSegStrokeR(0, -param.daP).addSegStrokeR(-h2, 0).addSegStrokeR(0, param.daP).addSegStrokeR(-h1Hi, 0);
632
+ } else {
633
+ rCtr.addSegStrokeR(-h3Lo, 0).addSegStrokeR(0, -param.daP).addSegStrokeR(-h2, 0).addSegStrokeR(0, param.daP).addSegStrokeR(-h1Lo, 0);
634
+ }
635
+ rCtr.closeSegStroke();
636
+ return rCtr;
637
+ }, ctrPlank1aPlaced2 = function(ix, iy, iP1234) {
638
+ const rCtr = ctrPlank1a2(ix, iy - param.W1a, iP1234).rotate(ix, iy, pi2);
639
+ return rCtr;
640
+ }, ctrPlank1b2 = function(ix, iy, iSideW, iSideE, iP1234) {
641
+ const H3sc = (iP1234 === 2 || iP1234 === 3) && param.aSplit === 1 ? param.H3s : 0;
642
+ const H3c2 = param.H3 + H3sc;
643
+ const H2sc = param.bSplit === 1 ? param.H2 : 0;
644
+ const H1H2sc = H1H2 + H2sc;
645
+ const h3Lo = param.dbY + pldbP1 - pldbPe2 + param.H2 + H2sc;
646
+ const h3Hi = param.dbY + pldbP1 - pldbPe2 + H2sc;
647
+ const h2 = pldbP3 + pldbPe;
648
+ const h1Lo = H1H2sc - h2 - h3Lo;
649
+ const h1Hi = H1H2sc - h2 - h3Hi;
650
+ const rCtr = contour3(ix, iy);
651
+ if (iSideE === 2) {
652
+ rCtr.addSegStrokeR(H1H2sc, 0);
653
+ } else if (iSideE === 1) {
654
+ rCtr.addSegStrokeR(h1Hi, 0).addSegStrokeR(0, param.dbP).addSegStrokeR(h2, 0).addSegStrokeR(0, -param.dbP).addSegStrokeR(h3Hi, 0);
655
+ } else {
656
+ rCtr.addSegStrokeR(h1Lo, 0).addSegStrokeR(0, param.dbP).addSegStrokeR(h2, 0).addSegStrokeR(0, -param.dbP).addSegStrokeR(h3Lo, 0);
657
+ }
658
+ rCtr.addSegStrokeR(0, param.U1).addSegStrokeR(H3c2, 0).addSegStrokeR(0, W1b2U1).addSegStrokeR(-H3c2, 0).addSegStrokeR(0, param.U1);
659
+ if (iSideW === 2) {
660
+ rCtr.addSegStrokeR(-H1H2sc, 0);
661
+ } else if (iSideW === 1) {
662
+ rCtr.addSegStrokeR(-h3Hi, 0).addSegStrokeR(0, -param.dbP).addSegStrokeR(-h2, 0).addSegStrokeR(0, param.dbP).addSegStrokeR(-h1Hi, 0);
663
+ } else {
664
+ rCtr.addSegStrokeR(-h3Lo, 0).addSegStrokeR(0, -param.dbP).addSegStrokeR(-h2, 0).addSegStrokeR(0, param.dbP).addSegStrokeR(-h1Lo, 0);
665
+ }
666
+ rCtr.closeSegStroke();
667
+ return rCtr;
668
+ }, ctrPlank1bPlaced2 = function(ix, iy, iSideW, iSideE, iP1234) {
669
+ const rCtr = ctrPlank1b2(ix, iy - param.W1b, iSideW, iSideE, iP1234).rotate(ix, iy, pi2);
670
+ return rCtr;
671
+ }, ctrPlank2EE2 = function(ix, iy) {
672
+ const rCtr = ctrRectangle2(ix, iy, pl2Lb, param.H2);
673
+ return rCtr;
674
+ }, ctrPlank2Slot2 = function(ix, iy) {
675
+ const rCtr = ctrRectangle2(ix, iy, param.Lb + 2 * (param.W1b + W3U1), param.H2);
676
+ return rCtr;
677
+ }, ctrPlank2Short2 = function(ix, iy) {
678
+ const rCtr = ctrRectangle2(ix, iy, param.W1b + 2 * W3U1, param.H2);
679
+ return rCtr;
680
+ }, ctrPlank3EE2 = function(ix, iy) {
681
+ let rCtr = contour3(ix, iy).addSegStrokeR(pl3La, 0).addSegStrokeR(0, param.H3 - pl3Ny).addSegStrokeR(-pl3Nx, pl3Ny).addSegStrokeR(-pl3La + pl3Nx + pl3Sx, 0).addSegStrokeR(-pl3Sx, -pl3Sy).closeSegStroke();
682
+ if (param.H3arc > 0) {
683
+ const lS2 = param.JaSouth + param.W1a + pl3S1 + param.W2 - param.V1;
684
+ const lN2 = param.JaNorth + param.W1a + pl3N1 + param.W2 - param.V1;
685
+ rCtr = contour3(ix, iy).addSegStrokeR(lS2, 0).addPointR(pl3x2, param.H3arc).addSegArc3(pi, false).addPointR(pl3x4, -param.H3arc).addSegArc3(0, true).addSegStrokeR(lN2, 0).addSegStrokeR(0, param.H3s - pl3Ny).addSegStrokeR(-pl3Nx, pl3Ny).addSegStrokeR(-lN2 + param.W2 + pl3Nx, 0).addPointR(-pl3x4 - param.W2, param.H3arc).addSegArc3(0, false).addPointR(-pl3x2 - param.W2, -param.H3arc).addSegArc3(pi, true).addSegStrokeR(-lS2 + param.W2 + pl3Sx, 0).addSegStrokeR(-pl3Sx, -pl3Sy).closeSegStroke();
686
+ }
687
+ return rCtr;
688
+ }, ctrPlank3S2 = function(ix, iy) {
689
+ const rCtr = contour3(ix, iy).addSegStrokeR(pl3S, 0).addSegStrokeR(0, param.H3).addSegStrokeR(-pl3S + pl3Sx, 0).addSegStrokeR(-pl3Sx, -pl3Sy).closeSegStroke();
690
+ return rCtr;
691
+ }, ctrPlank3M2 = function(ix, iy) {
692
+ let rCtr = ctrRectangle2(ix, iy, pl3M, param.H3s);
693
+ if (param.H3arc > 0) {
694
+ rCtr = contour3(ix, iy).addSegStrokeR(pl3x1, 0).addPointR(pl3x2, param.H3arc).addSegArc3(pi, false).addPointR(pl3x4, -param.H3arc).addSegArc3(0, true).addSegStrokeR(pl3x1, 0).addSegStrokeR(0, param.H3s).addSegStrokeR(-pl3x1 + param.W2, 0).addPointR(-pl3x4 - param.W2, param.H3arc).addSegArc3(0, false).addPointR(-pl3x2 - param.W2, -param.H3arc).addSegArc3(pi, true).addSegStrokeR(-pl3x1 + param.W2, 0).closeSegStroke();
695
+ }
696
+ return rCtr;
697
+ }, ctrPlank3N2 = function(ix, iy) {
698
+ const rCtr = contour3(ix, iy).addSegStrokeR(pl3N, 0).addSegStrokeR(0, param.H3 - pl3Ny).addSegStrokeR(-pl3Nx, pl3Ny).addSegStrokeR(-pl3N + pl3Nx, 0).closeSegStroke();
699
+ return rCtr;
700
+ }, ctrPlank4S2 = function(ix, iy) {
701
+ const l4x0 = param.B4 / Math.sin(Ra);
702
+ const l4y0 = param.B4 / Math.cos(Ra);
703
+ const l3x0 = H32 + H32 / Math.tan(Ra) + W42 / Math.sin(Ra);
704
+ const l3x1 = param.JaSouth + param.W1a + laSouth + topXlow - W52 - l3x0;
705
+ const l4x2 = l3x1 * Math.cos(Ra);
706
+ const l4x1 = W42 / Math.tan(Ra) + H32 / Math.sin(Ra);
707
+ const l4x3 = param.ReS - l4x0 + l4x1 + l4x2 - param.W8 - param.S4e2 / 2;
708
+ const l4x4 = param.W8 + param.S4e2;
709
+ const l4x5 = RdSouth - l4x0 - l4x3 - l4x4;
710
+ const l4a1 = pi2 - aTop / 2;
711
+ const l4x6 = H741 * Math.tan(l4a1);
712
+ const l4x7 = param.W4 * Math.tan(l4a1);
713
+ const l4x8 = l4x5 - l4x6 - l4x7;
714
+ const l4q2 = Math.sqrt(l4x7 ** 2 + param.W4 ** 2) / 2;
715
+ const l4a2 = aTop / 2;
716
+ const l4y1 = -topYmid - pl6Sy;
717
+ const l4y2 = H741 / Math.cos(Ra);
718
+ const l4q4 = RdSouth - l4qS3 - param.Q4Init - param.S4 - (n7S - 1) * step7;
719
+ const rCtr = contour3(ix, iy + l4y0).addSegStrokeR(l4x0, -l4y0).addSegStrokeR(l4x3, 0).addSegStrokeR(0, param.P42).addSegStrokeR(l4x4, 0).addSegStrokeR(0, -param.P42).addSegStrokeR(l4x8, 0).addSegStrokeRP(l4a2, l4q2).addSegStrokeRP(pi - Ra, topXmid + W62).addSegStrokeRP(pi2 - Ra, l4y1 - l4y2).addSegStrokeR(-l4q4 + param.S4e / 2, 0);
720
+ for (let ii = 0; ii < n7S - 1; ii++) {
721
+ rCtr.addSegStrokeR(0, -param.P41).addSegStrokeR(-notch7W, 0).addSegStrokeR(0, param.P41).addSegStrokeR(-param.Q4 + param.S4e, 0);
722
+ }
723
+ rCtr.addSegStrokeR(0, -param.P41).addSegStrokeR(-notch7W, 0).addSegStrokeR(0, param.P41).addSegStrokeR(-param.Q4Init + param.S4e / 2, 0).closeSegStroke();
724
+ return rCtr;
725
+ }, ctrPlank4Splaced2 = function(ix, iy) {
726
+ const rCtr = ctrPlank4S2(ix, iy).rotate(ix, iy, Ra);
727
+ return rCtr;
728
+ }, ctrPlank4N2 = function(ix, iy) {
729
+ const l4x0 = param.B4 / Math.sin(RaNorth);
730
+ const l4y0 = param.B4 / Math.cos(RaNorth);
731
+ const l3x0 = H32 + H32 / Math.tan(RaNorth) + W42 / Math.sin(RaNorth);
732
+ const l3x1 = param.JaNorth + param.W1a + laNorth - topXlow - W52 - l3x0;
733
+ const l4x2 = l3x1 * Math.cos(RaNorth);
734
+ const l4x1 = W42 / Math.tan(RaNorth) + H32 / Math.sin(RaNorth);
735
+ const l4x3 = param.ReN - l4x0 + l4x1 + l4x2 - param.W8 - param.S4e2 / 2;
736
+ const l4x4 = param.W8 + param.S4e2;
737
+ const l4x5 = RdNorth - l4x0 - l4x3 - l4x4;
738
+ const l4a1 = pi2 - aTop / 2;
739
+ const l4x6 = H741 * Math.tan(l4a1);
740
+ const l4x7 = param.W4 * Math.tan(l4a1);
741
+ const l4x8 = l4x5 - l4x6 - l4x7;
742
+ const l4x9 = l4x6 + l4x7;
743
+ const l4y1 = -topYmid - pl6Ny;
744
+ const l4y2 = H741 / Math.cos(RaNorth);
745
+ const l4q4 = RdNorth - l4qN3 - param.Q4Init - param.S4 - (n7N - 1) * step7;
746
+ const rCtr = contour3(ix + l4x9, iy).addSegStrokeR(l4x8, 0).addSegStrokeR(0, param.P42).addSegStrokeR(l4x4, 0).addSegStrokeR(0, -param.P42).addSegStrokeR(l4x3, 0).addSegStrokeR(l4x0, l4y0).addSegStrokeR(0, param.W4 - l4y0).addSegStrokeR(-param.Q4Init + param.S4e / 2, 0).addSegStrokeR(0, -param.P41).addSegStrokeR(-notch7W, 0).addSegStrokeR(0, param.P41);
747
+ for (let ii = 0; ii < n7N - 1; ii++) {
748
+ rCtr.addSegStrokeR(-param.Q4 + param.S4e, 0).addSegStrokeR(0, -param.P41).addSegStrokeR(-notch7W, 0).addSegStrokeR(0, param.P41);
749
+ }
750
+ rCtr.addSegStrokeR(-l4q4 + param.S4e / 2, 0).addSegStrokeRP(-pi2 + RaNorth, l4y1 - l4y2).addSegStrokeRP(pi + RaNorth, W62 - topXmid).closeSegStroke();
751
+ return rCtr;
752
+ }, ctrPlank4Nplaced2 = function(ix, iy) {
753
+ const rCtr = ctrPlank4N2(ix - RdNorth, iy).rotate(ix, iy, -RaNorth);
754
+ return rCtr;
755
+ }, ctrPlank5a2 = function(ix, iy) {
756
+ const ctrShifted = contour3(ix, iy).addSegStrokeR(l8N4, 0).addSegStrokeR(0, param.P5).addSegStrokeR(l8N33, 0).addSegStrokeR(0, -param.P5).addSegStrokeR(l8N32 + pl5Nl, 0).addSegStrokeR(pl5Ny, W52).addSegStrokeR(-pl5Sy, W52).addSegStrokeR(-pl5Sl - l8S32, 0).addSegStrokeR(0, -param.P5).addSegStrokeR(-l8S33, 0).addSegStrokeR(0, param.P5).addSegStrokeR(-l8S4, 0).closeSegStroke();
757
+ const ctrAligned = contour3(ix, iy).addSegStrokeR(l8N4, 0).addSegStrokeR(0, param.P5).addSegStrokeR(l8N33, 0).addSegStrokeR(0, -param.P5).addSegStrokeR(l8N32 + pl5Nl2, 0).addSegStrokeR(pl5yN, W52).addSegStrokeR(pl5yM, 0).addSegStrokeR(-pl5yS, W52).addSegStrokeR(-pl5Sl2 - l8S32, 0).addSegStrokeR(0, -param.P5).addSegStrokeR(-l8S33, 0).addSegStrokeR(0, param.P5).addSegStrokeR(-l8S4, 0).closeSegStroke();
758
+ const rCtr = param.top_opt ? ctrAligned : ctrShifted;
759
+ return rCtr;
760
+ }, ctrPlank5aPlaced2 = function(ix, iy) {
761
+ const rCtr = ctrPlank5a2(ix - pl5Lbottom, iy - param.W5a).rotate(ix, iy, pi2);
762
+ return rCtr;
763
+ }, ctrPlank5b2 = function(ix, iy) {
764
+ const l8h = Math.max(pl5Nl2 + Math.abs(pl5yM), pl5Nl + pl5Ny);
765
+ const lx1 = l8h + lp5p6 - param.dtQ - param.dtY - pldtP2 - pldtPe2;
766
+ const lx2 = l8h - lx1 - pldtP3;
767
+ const rCtr = contour3(ix, iy + param.W5bs).addSegStrokeR(l5l, 0).addSegStrokeR(0, -param.W5bs).addSegStrokeR(lx1, 0).addSegStrokeR(0, param.dtP).addSegStrokeR(pldtP3, 0).addSegStrokeR(0, -param.dtP).addSegStrokeR(lx2, 0).addSegStrokeR(0, l5W).addSegStrokeR(-lx2, 0).addSegStrokeR(0, -param.dtP).addSegStrokeR(-pldtP3, 0).addSegStrokeR(0, param.dtP).addSegStrokeR(-lx1, 0).addSegStrokeR(0, -param.W5bs).addSegStrokeR(-l5l, 0).closeSegStroke();
768
+ return rCtr;
769
+ }, ctrPlank5bPlaced2 = function(ix, iy) {
770
+ const rCtr = ctrPlank5b2(ix - l5l, iy - l5W / 2).rotate(ix, iy, pi2);
771
+ return rCtr;
772
+ }, ctrPlank6b2 = function(ix, iy) {
773
+ const rCtr = contour3(ix, iy).addSegStrokeR(param.dtF - pl6Qe2, 0).addSegStrokeR(0, param.dtQ).addSegStrokeR(pl6Q1, 0);
774
+ for (let ii = 0; ii < param.Nb1 - 1; ii++) {
775
+ rCtr.addSegStrokeR(0, -param.dtQ).addSegStrokeR(pl6Q2, 0).addSegStrokeR(0, param.dtQ).addSegStrokeR(pl6Q3, 0).addSegStrokeR(0, -param.dtQ).addSegStrokeR(pl6Q4, 0).addSegStrokeR(0, param.dtQ).addSegStrokeR(pl6Q3, 0).addSegStrokeR(0, -param.dtQ).addSegStrokeR(pl6Q2, 0).addSegStrokeR(0, param.dtQ).addSegStrokeR(pl6Q1, 0);
776
+ }
777
+ rCtr.addSegStrokeR(0, -param.dtQ).addSegStrokeR(param.dtF - pl6Qe2, 0).addSegStrokeR(0, pl6bH).addSegStrokeR(-pl6bL, 0).closeSegStroke();
778
+ return rCtr;
779
+ }, ctrPlank6c2 = function(ix, iy) {
780
+ const ctrPeak = contour3(ix, iy).addSegStrokeR(param.W6, 0).addSegStrokeR(0, param.dtQ - topYmid - pl6Ny).addSegStrokeR(-W62, pl6Ny).addSegStrokeR(-W62, -pl6Sy).closeSegStroke();
781
+ const ctrSquare = ctrRectangle2(ix, iy, param.W6, param.H6);
782
+ const rCtr = param.peak6 ? ctrSquare : ctrPeak;
783
+ return rCtr;
784
+ }, ctrPlank8S2 = function(ix, iy) {
785
+ const rCtr = contour3(ix, iy).addSegStrokeR(l8S1 + l8S2, 0).addSegStrokeRP(pi2 - Ra, param.P5).addSegStrokeRP(pi - Ra, l8S33).addSegStrokeRP(-pi2 - Ra, param.P5).addSegStrokeRP(pi - Ra, l8S32).addSegStrokeR(-l8S1, 0).closeSegStroke();
786
+ return rCtr;
787
+ }, ctrPlank8Splaced2 = function(ix, iy, ia) {
788
+ const rCtr = ctrPlank8S2(ix - l8S1, iy - param.W8).rotate(ix, iy, ia);
789
+ return rCtr;
790
+ }, ctrPlank8N2 = function(ix, iy) {
791
+ const rCtr = contour3(ix, iy).addSegStrokeR(l8N1, 0).addSegStrokeRP(RaNorth, l8N32).addSegStrokeRP(RaNorth - pi2, param.P5).addSegStrokeRP(RaNorth, l8N33).addSegStrokeRP(RaNorth + pi2, param.P5).addSegStrokeR(-l8N1 - l8N2, 0).closeSegStroke();
792
+ return rCtr;
793
+ }, ctrPlank8Nplaced2 = function(ix, iy, ia) {
794
+ const rCtr = ctrPlank8N2(ix - l8N1, iy).rotate(ix, iy, pi + ia);
795
+ return rCtr;
796
+ }, ctrPlankDiagTop2 = function(ix, iy, ik) {
797
+ const pdtx2 = Math.sqrt((param.dtY + pldtP2) ** 2 + (param.dtX + pl6Q22) ** 2);
798
+ const pdtx3 = Math.sqrt(param.dtX ** 2 + param.dtY ** 2);
799
+ const pdty1 = ik === 1 ? 0 : param.dtW;
800
+ const pdty2 = param.dtP * Math.cos(pl6da);
801
+ const rCtr = contour3(ix, iy + pdty1 + ik * pdty2).addSegStrokeRP(ik * (-pi2 + pl6da), param.dtP).addSegStrokeR(pdtx2, 0).addSegStrokeRP(ik * pl6da, param.dtQ).addSegStrokeRP(ik * (pi2 + pl6da), pl6Q23).addSegStrokeRP(ik * (pi + pl6da), param.dtQ).addSegStrokeRP(ik * (pi2 + pl6da), pl6Q21).addSegStrokeR(-pdtx3, 0).addSegStrokeRP(ik * (pi + pl6da), pldtP1).addSegStrokeRP(ik * (pi2 + pl6da), param.dtP).closeSegStroke();
802
+ return rCtr;
803
+ }, ctrPlankDiagTopPlaced2 = function(ix, iy, ia, ik) {
804
+ const pdtx4 = pldtP2 * Math.cos(pl6da) + param.dtP * Math.sin(pl6da);
805
+ const aa0 = pi2 - ik * ia;
806
+ const pdty4 = ik === 1 ? param.dtW : 0;
807
+ const rCtr = ctrPlankDiagTop2(ix - pdtx4, iy - pdty4, ik).rotate(ix, iy, aa0);
808
+ return rCtr;
809
+ }, ctrPlankDiagA2 = function(ix, iy, ik) {
810
+ const pdty1 = ik === 1 ? 0 : param.daW;
811
+ const pdtx2 = param.daE + param.H3 / (2 * Math.cos(pldaA));
812
+ const pdtx3 = param.daW / 2 * Math.tan(pldaA);
813
+ const pdtx4 = Math.sqrt(param.daX ** 2 + param.daY ** 2);
814
+ const pdtx5 = pdtx2 + pdtx3 + pdtx4;
815
+ const pdtx6 = param.daW / Math.tan(pldaA);
816
+ const pdtx7 = pdtx5 + pdtx6;
817
+ const rCtr = contour3(ix, iy + pdty1).addSegStrokeR(pdtx5, 0).addSegStrokeRP(ik * pldaA, pldaP1).addSegStrokeRP(ik * (pldaA - pi2), param.daP).addSegStrokeRP(ik * pldaA, pldaP3).addSegStrokeRP(ik * (pldaA + pi2), param.daP).addSegStrokeR(-pdtx7, 0).closeSegStroke();
818
+ return rCtr;
819
+ }, ctrPlankDiagAplaced2 = function(ix, iy, ia, ik) {
820
+ const aa0 = -pi2 - ik * ia;
821
+ const rCtr = ctrPlankDiagA2(ix - param.daE, iy - param.daW / 2, ik).rotate(ix, iy, aa0);
822
+ return rCtr;
823
+ }, ctrPlankDiagB2 = function(ix, iy, ik) {
824
+ const pdty1 = ik === 1 ? 0 : param.dbW;
825
+ const pdtx2 = param.dbE + param.H2 / (2 * Math.cos(pldbA));
826
+ const pdtx3 = param.dbW / 2 * Math.tan(pldbA);
827
+ const pdtx4 = Math.sqrt(param.dbX ** 2 + param.dbY ** 2);
828
+ const pdtx5 = pdtx2 + pdtx3 + pdtx4;
829
+ const pdtx6 = param.dbW / Math.tan(pldbA);
830
+ const pdtx7 = pdtx5 + pdtx6;
831
+ const rCtr = contour3(ix, iy + pdty1).addSegStrokeR(pdtx5, 0).addSegStrokeRP(ik * pldbA, pldbP1).addSegStrokeRP(ik * (pldbA - pi2), param.dbP).addSegStrokeRP(ik * pldbA, pldbP3).addSegStrokeRP(ik * (pldbA + pi2), param.dbP).addSegStrokeR(-pdtx7, 0).closeSegStroke();
832
+ return rCtr;
833
+ }, ctrPlankDiagBplaced2 = function(ix, iy, ia, ik) {
834
+ const aa0 = -pi2 - ik * ia;
835
+ const rCtr = ctrPlankDiagB2(ix - param.dbE, iy - param.dbW / 2, ik).rotate(ix, iy, aa0);
836
+ return rCtr;
837
+ };
838
+ var JaMin = JaMin2, ctrPlank1a = ctrPlank1a2, ctrPlank1aPlaced = ctrPlank1aPlaced2, ctrPlank1b = ctrPlank1b2, ctrPlank1bPlaced = ctrPlank1bPlaced2, ctrPlank2EE = ctrPlank2EE2, ctrPlank2Slot = ctrPlank2Slot2, ctrPlank2Short = ctrPlank2Short2, ctrPlank3EE = ctrPlank3EE2, ctrPlank3S = ctrPlank3S2, ctrPlank3M = ctrPlank3M2, ctrPlank3N = ctrPlank3N2, ctrPlank4S = ctrPlank4S2, ctrPlank4Splaced = ctrPlank4Splaced2, ctrPlank4N = ctrPlank4N2, ctrPlank4Nplaced = ctrPlank4Nplaced2, ctrPlank5a = ctrPlank5a2, ctrPlank5aPlaced = ctrPlank5aPlaced2, ctrPlank5b = ctrPlank5b2, ctrPlank5bPlaced = ctrPlank5bPlaced2, ctrPlank6b = ctrPlank6b2, ctrPlank6c = ctrPlank6c2, ctrPlank8S = ctrPlank8S2, ctrPlank8Splaced = ctrPlank8Splaced2, ctrPlank8N = ctrPlank8N2, ctrPlank8Nplaced = ctrPlank8Nplaced2, ctrPlankDiagTop = ctrPlankDiagTop2, ctrPlankDiagTopPlaced = ctrPlankDiagTopPlaced2, ctrPlankDiagA = ctrPlankDiagA2, ctrPlankDiagAplaced = ctrPlankDiagAplaced2, ctrPlankDiagB = ctrPlankDiagB2, ctrPlankDiagBplaced = ctrPlankDiagBplaced2;
839
+ const H2H3 = param.H2 + param.H3;
840
+ const W1a2V1 = param.W1a - 2 * param.V1;
841
+ const W1b2U1 = param.W1b - 2 * param.U1;
842
+ const aDist = [];
843
+ if (param.SecondPoleSouth === 1) {
844
+ aDist.push(param.KaSouth);
845
+ }
846
+ aDist.push(param.La);
847
+ if (param.SecondPoleNorth === 1) {
848
+ aDist.push(param.KaNorth);
849
+ }
850
+ const aPos = [0];
851
+ let aDistAcc = 0;
852
+ for (const iDist of aDist) {
853
+ aDistAcc += iDist + param.W1a;
854
+ aPos.push(aDistAcc);
855
+ }
856
+ const Na = aPos.length;
857
+ const la = Na * param.W1a + aDist.reduce((acc, cur) => acc + cur, 0);
858
+ const lb = param.Nb1 * param.W1b + (param.Nb1 - 1) * param.Lb;
859
+ const lbWall = lb / 1e3;
860
+ const laWall = la / 1e3;
861
+ const lbInner = lbWall - 2 * param.W1b / 1e3;
862
+ const laInner = laWall - 2 * param.W1a / 1e3;
863
+ const lbRoof = lbWall;
864
+ const laRoof = laWall + (param.JaSouth + param.JaNorth) / 1e3;
865
+ const stepX = param.W1b + param.Lb;
866
+ const W1a2 = param.W1a / 2;
867
+ const W1b2 = param.W1b / 2;
868
+ const H12c = param.H1 + param.H2 * (param.bSplit ? 2 : 1);
869
+ const H123c = H12c + param.H3;
870
+ const H22 = param.H2 / 2;
871
+ const D2H = param.H1 + H22;
872
+ const D3H = H12c + param.H3 / 2;
873
+ const R2 = param.D2 / 2;
874
+ const R3 = param.D3 / 2;
875
+ const H1H2 = param.H1 + param.H2;
876
+ const pl3La = la + param.JaSouth + param.JaNorth;
877
+ const W3U1 = param.W3 - param.U1;
878
+ const W2V1 = param.W2 - param.V1;
879
+ const W1bU1 = param.W1b - param.U1;
880
+ const W1aV1 = param.W1a - param.V1;
881
+ const pl2Lb = lb + 2 * W3U1;
882
+ const H123 = H1H2 + param.H3;
883
+ const LaMin = 2 * (param.W3 - param.U1);
884
+ const LbMin = 2 * (param.W2 - param.V1);
885
+ const H32 = param.H3 / 2;
886
+ const W42 = param.W4 / 2;
887
+ const H741 = param.H7 - param.P41;
888
+ const Ra = degToRad(param.Ra);
889
+ const pi = Math.PI;
890
+ const pi2 = pi / 2;
891
+ const laIn = la - 2 * param.W1a;
892
+ const laSouth = laIn * param.Rt / 100;
893
+ const laNorth = laIn - laSouth;
894
+ const laSideS = param.JaSouth - H32 + param.W1a;
895
+ const laSideN = param.JaNorth - H32 + param.W1a;
896
+ const W47 = W42 - param.P41 + param.H7;
897
+ const Xsouth = laSouth + laSideS;
898
+ const RdSouth1 = Xsouth / Math.cos(Ra) + W47 * Math.tan(Ra);
899
+ const RdSouth = RdSouth1 + param.ReS;
900
+ const hypS2 = RdSouth1 ** 2 + W47 ** 2;
901
+ const Ytop2 = hypS2 - Xsouth ** 2;
902
+ const Ytop = Math.sqrt(Ytop2);
903
+ const Xnorth = laNorth + laSideN;
904
+ const hypN2 = Ytop2 + Xnorth ** 2;
905
+ const hypN = Math.sqrt(hypN2);
906
+ const RdNorth1 = Math.sqrt(hypN2 - W47 ** 2);
907
+ const RdNorth = RdNorth1 + param.ReN;
908
+ const aT1 = Math.atan2(W47, RdSouth1);
909
+ const aT2 = Math.atan2(Xsouth, Ytop);
910
+ const aT3 = Math.atan2(Xnorth, Ytop);
911
+ const aT4 = Math.atan2(W47, hypN);
912
+ const aTop = aT1 + aT2 + aT3 + aT4;
913
+ const RaNorth = pi - Ra - aTop;
914
+ const p1Sx = W42 * Math.cos(Ra - pi2);
915
+ const p1Sy = W42 * Math.sin(Ra - pi2);
916
+ const R4 = param.D4 / 2;
917
+ const p2Sy = H32 + R4;
918
+ const p2Sx = p2Sy / Math.tan(Ra);
919
+ const W441 = W42 - param.P41;
920
+ const p3Sx = W441 * Math.cos(pi2 + Ra) - param.ReS * Math.cos(Ra);
921
+ const p3Sy = W441 * Math.sin(pi2 + Ra) - param.ReS * Math.sin(Ra);
922
+ const p4Sx = param.ReS * Math.cos(Ra + pi);
923
+ const p4Sy = param.ReS * Math.sin(Ra + pi);
924
+ const p1Nx = W42 * Math.cos(-pi2 - RaNorth);
925
+ const p1Ny = W42 * Math.sin(-pi2 - RaNorth);
926
+ const p2Ny = p2Sy;
927
+ const p2Nx = -p2Ny / Math.tan(RaNorth);
928
+ const p3Nx = W441 * Math.cos(pi2 - RaNorth) + param.ReN * Math.cos(RaNorth);
929
+ const p3Ny = W441 * Math.sin(pi2 - RaNorth) - param.ReN * Math.sin(RaNorth);
930
+ const p4Nx = param.ReN * Math.cos(-RaNorth);
931
+ const p4Ny = param.ReN * Math.sin(-RaNorth);
932
+ const pTopx = param.W1a + laSouth;
933
+ const H2c = param.bSplit === 1 ? param.H2 : 0;
934
+ const pTopy = H123 + H2c - H32 + Ytop;
935
+ const aMid = -RaNorth - aTop / 2;
936
+ const topD1 = (param.H7 - param.P41) / Math.sin(aTop / 2);
937
+ const topD2 = param.W4 / Math.sin(aTop / 2);
938
+ const topYmid = (topD1 + topD2 / 2) * Math.sin(aMid);
939
+ const topXmid = (topD1 + topD2 / 2) * Math.cos(aMid);
940
+ const topYlow = (topD1 + topD2) * Math.sin(aMid);
941
+ const topXlow = (topD1 + topD2) * Math.cos(aMid);
942
+ const lp5p6 = Math.abs(topD2 / 2 * Math.sin(aMid));
943
+ const pl3S1 = param.SecondPoleSouth ? param.KaSouth + param.W1a : 0;
944
+ const pl3N1 = param.SecondPoleNorth ? param.KaNorth + param.W1a : 0;
945
+ const pl3x1 = param.W1a + 2 * (param.W2 - param.V1);
946
+ const pl3x2 = laSouth - pl3S1 - param.W2 + param.V1;
947
+ const pl3x4 = laNorth - pl3N1 - param.W2 + param.V1;
948
+ const W52 = param.W5a / 2;
949
+ const pl5Sy = W52 * Math.tan(Ra);
950
+ const pl5Ny = W52 * Math.tan(RaNorth);
951
+ const ptPl5y2 = pTopy + topYlow;
952
+ const l81y = param.H3arc + (param.aSplit ? param.H3s : 0);
953
+ const H3c = (param.H3 + param.H3s) / 2;
954
+ const ptPl5y0 = H123 + H2c + l81y;
955
+ const pl5Nl = ptPl5y2 - pl5Ny - ptPl5y0;
956
+ const pl5Sl = ptPl5y2 - pl5Sy - ptPl5y0;
957
+ const R5 = param.D5 / 2;
958
+ const pl5yN = W52 * Math.tan(RaNorth);
959
+ const pl5yS = W52 * Math.tan(Ra);
960
+ const pl5yMN = (W42 + W47) / Math.cos(RaNorth);
961
+ const pl5yMS = (W42 + W47) / Math.cos(Ra);
962
+ const pl5yM = pl5yMN - pl5yMS;
963
+ const pl5Nl2 = Ytop - H32 - l81y - pl5yMN - pl5yN;
964
+ const pl5Sl2 = Ytop - H32 - l81y - pl5yMS - pl5yS;
965
+ const ptPl5x00 = param.top_opt ? pTopx - W52 : pTopx + topXlow - W52;
966
+ const W62 = param.W6 / 2;
967
+ const pl6Sy = W62 * Math.tan(Ra);
968
+ const pl6Ny = W62 * Math.tan(RaNorth);
969
+ const ptPl6x0 = pTopx - W62;
970
+ const ptPl6y0 = pTopy + topYmid;
971
+ const l4qS3 = Math.sqrt(pl6Sy ** 2 + W62 ** 2) + H741 * Math.tan(Ra);
972
+ const l4qN3 = Math.sqrt(pl6Ny ** 2 + W62 ** 2) + H741 * Math.tan(RaNorth);
973
+ const notch7W = param.S4 + param.S4e;
974
+ const step7 = param.S4 + param.Q4;
975
+ const SQ4Init = param.S4 + param.Q4Init;
976
+ const n7S = Math.floor((RdSouth - SQ4Init - l4qS3) / step7) + 1 - param.dropLastS;
977
+ const n7N = Math.floor((RdNorth - SQ4Init - l4qN3) / step7) + 1 - param.dropLastN;
978
+ const l82y = l81y + H32;
979
+ const l8S1x = Xsouth - l82y / Math.tan(Ra) - W52 + (param.top_opt ? 0 : topXlow);
980
+ const l8S1 = l8S1x * Math.sin(Ra) - W42 + param.P42;
981
+ const l8S2 = param.W8 / Math.tan(Ra);
982
+ const l8S3 = param.W8 / Math.sin(Ra);
983
+ const l8S32 = param.P5 / Math.tan(Ra);
984
+ const l8S33 = l8S3 - l8S32;
985
+ const l8N1x = Xnorth - l82y / Math.tan(RaNorth) - W52 - (param.top_opt ? 0 : topXlow);
986
+ const l8N1 = l8N1x * Math.sin(RaNorth) - W42 + param.P42;
987
+ const l8N2 = param.W8 / Math.tan(RaNorth);
988
+ const l8N3 = param.W8 / Math.sin(RaNorth);
989
+ const l8N32 = param.P5 / Math.tan(RaNorth);
990
+ const l8N33 = l8N3 - l8N32;
991
+ const pl5botMin = param.aSplit ? param.H3s : param.H3;
992
+ const pl5Lbottom = Math.max(Math.max(l8N3, l8S3) + param.G5Min, pl5botMin);
993
+ const l8S4 = pl5Lbottom - l8S3;
994
+ const l8N4 = pl5Lbottom - l8N3;
995
+ const l5l = l8N4 + l8N33 + l8N32;
996
+ const l5W = param.W1b + 2 * (param.W5bs - param.U1);
997
+ const pl3Sx0 = -param.JaSouth;
998
+ const pl3S = param.JaSouth + 2 * param.W1a + param.KaSouth + param.W2 - param.V1;
999
+ const pl3Mx0 = param.W1a + param.KaSouth - param.W2 + param.V1;
1000
+ const pl3M = 2 * (param.W1a + param.W2 - param.V1) + param.La;
1001
+ const pl3Nx0 = 2 * param.W1a + param.KaSouth + param.La - param.W2 + param.V1;
1002
+ const pl3N = param.W2 - param.V1 + 2 * param.W1a + param.KaNorth + param.JaNorth;
1003
+ const d3P1P1234 = 1 + param.d3Plank1SN;
1004
+ const d3P1P23 = d3P1P1234 === 2 || d3P1P1234 === 3 ? true : false;
1005
+ const pl3Nz1 = W441 / Math.cos(RaNorth);
1006
+ const pl3Nz2 = H32 - pl3Nz1;
1007
+ const pl3Nz3 = pl3Nz2 / Math.tan(RaNorth);
1008
+ const pl3Nx = Math.max(H32 + pl3Nz3, 1);
1009
+ const pl3Ny = Math.min(pl3Nx * Math.tan(RaNorth), 2 * H32 - 1);
1010
+ const pl3Sz1 = W441 / Math.cos(Ra);
1011
+ const pl3Sz2 = H32 - pl3Sz1;
1012
+ const pl3Sz3 = pl3Sz2 / Math.tan(Ra);
1013
+ const pl3Sx = Math.max(H32 + pl3Sz3, 1);
1014
+ const pl3Sy = Math.min(pl3Sx * Math.tan(Ra), 2 * H32 - 1);
1015
+ const pl6Qe = param.dtQe;
1016
+ const pl6Qe2 = pl6Qe / 2;
1017
+ const pl6bL = lb + 2 * (param.W5bs + param.dtF - param.U1);
1018
+ const pl6bH = param.dtQ - topYmid;
1019
+ const pl6da = Math.atan2(param.dtX, param.dtY);
1020
+ const pl6Q21 = param.dtQ * Math.tan(pl6da);
1021
+ const pl6Q22 = param.dtW / Math.cos(pl6da);
1022
+ const pl6Q23 = pl6Q22 - pl6Q21;
1023
+ const pl6Q1 = l5W + pl6Qe;
1024
+ const pl6Q2 = param.dtX + pl6Q21 - pl6Qe;
1025
+ const pl6Q3 = pl6Q23 + pl6Qe;
1026
+ const pl6Q4 = param.Lb + 2 * (param.U1 - pl6Q2 - pl6Q3 - param.W5bs) - pl6Qe;
1027
+ const pldtPe = param.dtPe;
1028
+ const pldtPe2 = pldtPe / 2;
1029
+ const pldtP1 = param.dtP / Math.tan(pl6da);
1030
+ const pldtP2 = param.dtW / Math.sin(pl6da);
1031
+ const pldtP3 = pldtP2 - pldtP1 + pldtPe;
1032
+ const daR = param.daD / 2;
1033
+ const pldaPe = param.daPe;
1034
+ const pldaPe2 = pldaPe / 2;
1035
+ const pldaA = Math.atan2(param.daX, param.daY);
1036
+ const pldaX = param.daX + param.daW / (2 * Math.cos(pldaA)) + H32 * Math.tan(pldaA);
1037
+ const pldaP1 = param.daP / Math.tan(pldaA);
1038
+ const pldaP2 = param.daW / Math.sin(pldaA);
1039
+ const pldaP3 = pldaP2 - pldaP1;
1040
+ const dbR = param.dbD / 2;
1041
+ const pldbPe = param.dbPe;
1042
+ const pldbPe2 = pldbPe / 2;
1043
+ const pldbA = Math.atan2(param.dbX, param.dbY);
1044
+ const pldbX = param.dbX + param.dbW / (2 * Math.cos(pldbA)) + H22 * Math.tan(pldbA);
1045
+ const pldbP1 = param.dbP / Math.tan(pldbA);
1046
+ const pldbP2 = param.dbW / Math.sin(pldbA);
1047
+ const pldbP3 = pldbP2 - pldbP1;
1048
+ const pl4W = param.W1b - 2 * param.U1;
1049
+ const pl5aW = pl4W + 2 * param.W5bs;
1050
+ const pl5bW = param.W5a;
1051
+ if (param.aSplit === 1 && param.SecondPoleNorth + param.SecondPoleSouth < 2) {
1052
+ throw `err296: aSplit ${param.aSplit} is active but inactive SecondPoleNorth ${param.SecondPoleNorth} or SecondPoleSouth ${param.SecondPoleSouth}`;
1053
+ }
1054
+ if (W1a2V1 < 1) {
1055
+ throw `err096: W1a ${param.W1a} is too small compare to V1 ${param.V1} mm`;
1056
+ }
1057
+ if (W1b2U1 < 1) {
1058
+ throw `err099: W1b ${param.W1b} is too small compare to U1 ${param.U1} mm`;
1059
+ }
1060
+ if (param.JaSouth < JaMin2(Ra)) {
1061
+ throw `err191: JaSouth ${ffix2(param.JaSouth)} must be bigger than JaMin ${ffix2(JaMin2(Ra))} mm`;
1062
+ }
1063
+ if (param.JaNorth < JaMin2(RaNorth)) {
1064
+ throw `err234: JaNorth ${ffix2(param.JaNorth)} must be bigger than JaMin ${ffix2(JaMin2(RaNorth))} mm`;
1065
+ }
1066
+ if (param.P41 > W42 + R4) {
1067
+ throw `err287: P41 ${ffix2(param.P41)} is too big compare to W4 ${ffix2(param.W4)} and D4 ${ffix2(param.D4)} mm`;
1068
+ }
1069
+ if (param.P41 > param.H7) {
1070
+ throw `err291: P41 ${ffix2(param.P41)} is too big compare to H7 ${ffix2(param.H7)} mm`;
1071
+ }
1072
+ if (param.Lb < LbMin) {
1073
+ throw `err318: Lb ${ffix2(param.Lb)} is too small compare to LbMin ${ffix2(LbMin)} mm`;
1074
+ }
1075
+ if (param.La < LaMin) {
1076
+ throw `err322: La ${ffix2(param.La)} is too small compare to LaMin ${ffix2(LaMin)} mm`;
1077
+ }
1078
+ if (param.KaNorth < LaMin) {
1079
+ throw `err325: KaNorth ${ffix2(param.KaNorth)} is too small compare to LaMin ${ffix2(LaMin)} mm`;
1080
+ }
1081
+ if (param.KaSouth < LaMin) {
1082
+ throw `err328: KaSouth ${ffix2(param.KaSouth)} is too small compare to LaMin ${ffix2(LaMin)} mm`;
1083
+ }
1084
+ rGeome.logstr += `Inner size X: ${ffix2(lbInner)} Y: ${ffix2(laInner)} m, S: ${ffix2(lbInner * laInner)} m2
1085
+ `;
1086
+ rGeome.logstr += `Wall size X: ${ffix2(lbWall)} Y: ${ffix2(laWall)} m, S: ${ffix2(lbWall * laWall)} m2
1087
+ `;
1088
+ rGeome.logstr += `Roof size X: ${ffix2(lbRoof)} Y: ${ffix2(laRoof)} m, S: ${ffix2(lbRoof * laRoof)} m2
1089
+ `;
1090
+ rGeome.logstr += `Pole Horizontal B (W-E): W: ${ffix2(param.W2)} H: ${ffix2(param.H2)} L: ${ffix2(pl2Lb)} mm x${Na * 2}
1091
+ `;
1092
+ rGeome.logstr += `Pole Horizontal A (N-S): W: ${ffix2(param.W3)} H: ${ffix2(param.H3)} L: ${ffix2(pl3La)} mm x${param.Nb1 * 2}
1093
+ `;
1094
+ rGeome.logstr += `Pole Vertical: W1a: ${ffix2(param.W1a)} W1b: ${ffix2(param.W1b)} H: ${ffix2(H123)} mm x${Na * param.Nb1}
1095
+ `;
1096
+ rGeome.logstr += `Top position: laSouth: ${ffix2(laSouth)} laNorth: ${ffix2(laNorth)} Ytop ${ffix2(Ytop)} mm
1097
+ `;
1098
+ rGeome.logstr += `Roof south: RdSouth1: ${ffix2(RdSouth1)} RdSouth: ${ffix2(RdSouth)} mm
1099
+ `;
1100
+ rGeome.logstr += `Roof north: RdNorth1: ${ffix2(RdNorth1)} RdNorth: ${ffix2(RdNorth)} mm RaNorth ${ffix2(radToDeg(RaNorth))} degree
1101
+ `;
1102
+ rGeome.logstr += `Top angle: ${ffix2(radToDeg(aTop))} degree
1103
+ `;
1104
+ for (const yj of aPos) {
1105
+ for (let ii = 0; ii < param.Nb1; ii++) {
1106
+ figBase.addMainO(ctrRectangle2(ii * stepX, yj, param.W1b, param.W1a));
1107
+ figBase.addSecond(ctrRectangle2(-W3U1, yj + param.V1 - param.W2, pl2Lb, param.W2));
1108
+ figBase.addSecond(ctrRectangle2(-W3U1, yj + W1aV1, pl2Lb, param.W2));
1109
+ }
1110
+ }
1111
+ for (let ii = 0; ii < param.Nb1; ii++) {
1112
+ figBase.addSecond(ctrRectangle2(ii * stepX - W3U1, -param.JaSouth, param.W3, pl3La));
1113
+ figBase.addSecond(ctrRectangle2(ii * stepX + W1bU1, -param.JaSouth, param.W3, pl3La));
1114
+ }
1115
+ for (let ii = 0; ii < param.Nb1; ii++) {
1116
+ const ix = ii * stepX;
1117
+ const westLoHiPre = param.bSplit === 1 ? ii % 2 : 0;
1118
+ const westLoHi = ii === 0 ? 2 : westLoHiPre;
1119
+ const eastLoHiPre = param.bSplit === 1 ? 1 - ii % 2 : 0;
1120
+ const eastLoHi = ii === param.Nb1 - 1 ? 2 : eastLoHiPre;
1121
+ const ctrSouth = [ctrPlank1bPlaced2(ix, 0, westLoHi, eastLoHi, 1)];
1122
+ if (R2 > 0) {
1123
+ ctrSouth.push(contourCircle3(ix + W1a2, D2H, R2));
1124
+ if (param.bSplit === 1) {
1125
+ ctrSouth.push(contourCircle3(ix + W1a2, D2H + param.H2, R2));
1126
+ }
1127
+ }
1128
+ figSouth.addMainOI(ctrSouth);
1129
+ figSouth.addSecond(ctrRectangle2(ix - W3U1, H1H2 + H2c, param.W3, param.H3));
1130
+ figSouth.addSecond(ctrRectangle2(ix + W1bU1, H1H2 + H2c, param.W3, param.H3));
1131
+ figSouth.addSecond(ctrPlank5bPlaced2(ix + W1b2, ptPl5y0));
1132
+ }
1133
+ if (param.bSplit === 1) {
1134
+ for (let ii = 0; ii < param.Nb1 - 1; ii++) {
1135
+ const H2alt = ii % 2 === 0 ? param.H2 : 0;
1136
+ figSouth.addSecond(ctrPlank2Slot2(-W3U1 + ii * stepX, param.H1 + H2alt));
1137
+ }
1138
+ } else {
1139
+ figSouth.addSecond(ctrPlank2EE2(-W3U1, param.H1));
1140
+ }
1141
+ figSouth.addSecond(ctrPlank6b2(param.U1 - param.W5bs - param.dtF, ptPl6y0 - param.dtQ));
1142
+ for (let ii = 0; ii < param.Nb1 - 1; ii++) {
1143
+ const ix = ii * stepX + W1b2 + l5W / 2;
1144
+ const yy0 = ptPl6y0 - param.dtQ - param.dtY;
1145
+ figSouth.addSecond(ctrPlankDiagTopPlaced2(ix, yy0, pl6da, 1));
1146
+ }
1147
+ for (let ii = 1; ii < param.Nb1; ii++) {
1148
+ const ix = ii * stepX + W1b2 - l5W / 2;
1149
+ const yy0 = ptPl6y0 - param.dtQ - param.dtY;
1150
+ figSouth.addSecond(ctrPlankDiagTopPlaced2(ix, yy0, pl6da, -1));
1151
+ }
1152
+ for (let ii = 0; ii < param.Nb1 - 1; ii++) {
1153
+ const ix = ii * stepX + param.W1b + pldbX;
1154
+ const yy1 = ii % 2 === 0 && param.bSplit === 1 ? param.H2 : 0;
1155
+ const yy2 = param.H1 + H22 + yy1;
1156
+ figSouth.addSecond(ctrPlankDiagBplaced2(ix, yy2, pldbA, 1));
1157
+ figSouth.addSecond(contourCircle3(ix, yy2, dbR));
1158
+ }
1159
+ for (let ii = 1; ii < param.Nb1; ii++) {
1160
+ const ix = ii * stepX - pldbX;
1161
+ const yy1 = ii % 2 === 1 && param.bSplit === 1 ? param.H2 : 0;
1162
+ const yy2 = param.H1 + H22 + yy1;
1163
+ figSouth.addSecond(ctrPlankDiagBplaced2(ix, yy2, pldbA, -1));
1164
+ figSouth.addSecond(contourCircle3(ix, yy2, dbR));
1165
+ }
1166
+ for (const [idx, ix] of aPos.entries()) {
1167
+ let p1234 = idx + 1 === Na ? 4 : 1 + idx;
1168
+ if (Na === 3 && param.SecondPoleNorth === 1 && idx === 1) {
1169
+ p1234 = 3;
1170
+ }
1171
+ const ctrEast = [ctrPlank1aPlaced2(ix, 0, p1234)];
1172
+ if (R3 > 0) {
1173
+ ctrEast.push(contourCircle3(ix + W1a2, D3H, R3));
1174
+ if ((idx === 1 || idx === 2) && param.aSplit === 1) {
1175
+ ctrEast.push(contourCircle3(ix + W1a2, D3H + H3c, R3));
1176
+ }
1177
+ }
1178
+ figEast.addMainOI(ctrEast);
1179
+ figEast.addSecond(ctrRectangle2(ix - W2V1, param.H1, param.W2, param.H2));
1180
+ figEast.addSecond(ctrRectangle2(ix + W1aV1, param.H1, param.W2, param.H2));
1181
+ if (param.bSplit === 1) {
1182
+ figEast.addSecond(ctrRectangle2(ix - W2V1, H1H2, param.W2, param.H2));
1183
+ figEast.addSecond(ctrRectangle2(ix + W1aV1, H1H2, param.W2, param.H2));
1184
+ }
1185
+ }
1186
+ if (param.aSplit === 1) {
1187
+ figEast.addSecond(ctrPlank3S2(pl3Sx0, H1H2 + H2c));
1188
+ figEast.addSecond(ctrPlank3M2(pl3Mx0, H123 + H2c));
1189
+ figEast.addSecond(ctrPlank3N2(pl3Nx0, H1H2 + H2c));
1190
+ } else {
1191
+ figEast.addSecond(ctrPlank3EE2(pl3Sx0, H1H2 + H2c));
1192
+ }
1193
+ for (const [idx, ix] of aPos.entries()) {
1194
+ const H1H2c = H1H2 + H2c + H32;
1195
+ const H3ac = param.aSplit === 1 ? param.H3 : 0;
1196
+ if (idx < Na - 1) {
1197
+ const H1H2cc = idx === 1 ? H1H2c + H3ac : H1H2c;
1198
+ figEast.addSecond(ctrPlankDiagAplaced2(ix + param.W1a + pldaX, H1H2cc, pldaA, 1));
1199
+ figEast.addSecond(contourCircle3(ix + param.W1a + pldaX, H1H2cc, daR));
1200
+ }
1201
+ if (idx > 0) {
1202
+ const H1H2cc = idx === 2 ? H1H2c + H3ac : H1H2c;
1203
+ figEast.addSecond(ctrPlankDiagAplaced2(ix - pldaX, H1H2cc, pldaA, -1));
1204
+ figEast.addSecond(contourCircle3(ix - pldaX, H1H2cc, daR));
1205
+ }
1206
+ }
1207
+ const p0Sx = -param.JaSouth + H32;
1208
+ const p0Sy = D3H;
1209
+ figEast.addSecond(contourCircle3(p0Sx, p0Sy, R4));
1210
+ figEast.addSecond(contourCircle3(p0Sx + p2Sx, p0Sy + p2Sy, R4));
1211
+ figEast.addSecond(
1212
+ ctrRectangle2(0, 0, RdSouth1, W42 + W47).rotate(0, 0, Ra).translate(p0Sx + p1Sx, p0Sy + p1Sy)
1213
+ );
1214
+ figEast.addSecond(ctrPlank4Splaced2(p0Sx + p1Sx + p4Sx, p0Sy + p1Sy + p4Sy));
1215
+ const p0Nx = la + param.JaNorth - H32;
1216
+ const p0Ny = D3H;
1217
+ figEast.addSecond(contourCircle3(p0Nx, p0Ny, R4));
1218
+ figEast.addSecond(contourCircle3(p0Nx + p2Nx, p0Ny + p2Ny, R4));
1219
+ figEast.addSecond(
1220
+ ctrRectangle2(0, -W42 - W47, RdNorth1, W42 + W47).rotate(0, 0, pi - RaNorth).translate(p0Nx + p1Nx, p0Ny + p1Ny)
1221
+ );
1222
+ figEast.addSecond(ctrPlank4Nplaced2(p0Nx + p1Nx + p4Nx, p0Ny + p1Ny + p4Ny));
1223
+ figEast.addSecond(ctrPlank5aPlaced2(ptPl5x00, ptPl5y0));
1224
+ figEast.addSecond(contourCircle3(ptPl5x00 + W52, ptPl5y0 - H32, R5));
1225
+ figEast.addSecond(contourCircle3(ptPl5x00 + W52, ptPl5y0 + R5, R5));
1226
+ figEast.addSecond(ctrPlank6c2(ptPl6x0, ptPl6y0 - param.dtQ));
1227
+ figEast.addSecond(ctrRectangle2(ptPl6x0, ptPl6y0 - param.dtQ, param.W6, param.dtQ));
1228
+ for (let ii = 0; ii < n7S; ii++) {
1229
+ const ll = param.Q4Init + ii * step7;
1230
+ const ipt = point(p0Sx + p3Sx, p0Sy + p3Sy).translatePolar(Ra, ll);
1231
+ const iCtr = ctrRectangle2(0, 0, param.S4, param.H7).rotate(0, 0, Ra);
1232
+ figEast.addSecond(iCtr.translate(ipt.cx, ipt.cy));
1233
+ }
1234
+ for (let ii = 0; ii < n7N; ii++) {
1235
+ const aa = pi - RaNorth;
1236
+ const ll = param.Q4Init + ii * step7;
1237
+ const ipt = point(p0Nx + p3Nx, p0Ny + p3Ny).translatePolar(aa, ll);
1238
+ const iCtr = ctrRectangle2(0, -param.H7, param.S4, param.H7).rotate(0, 0, aa);
1239
+ figEast.addSecond(iCtr.translate(ipt.cx, ipt.cy));
1240
+ }
1241
+ figEast.addSecond(ctrPlank8Splaced2(ptPl5x00, ptPl5y0, Ra - pi2));
1242
+ figEast.addSecond(ctrPlank8Nplaced2(ptPl5x00 + 2 * W52, ptPl5y0, pi2 - RaNorth));
1243
+ const ctrPl1a = [ctrPlank1a2(0, 0, d3P1P1234)];
1244
+ if (R3 > 0) {
1245
+ ctrPl1a.push(contourCircle3(H12c + param.H3 / 2, W1a2, R3));
1246
+ if (param.aSplit === 1 && d3P1P23) {
1247
+ ctrPl1a.push(contourCircle3(H123c + param.H3s / 2, W1a2, R3));
1248
+ }
1249
+ }
1250
+ figPlank1a.addMainOI(ctrPl1a);
1251
+ if (R2 > 0) {
1252
+ const D2H2 = D2H + param.H2;
1253
+ figPlank1a.addSecond(ctrRectangle2(D2H - R2, -W2V1, 2 * R2, W1a2V1 + 2 * param.W2));
1254
+ if (param.bSplit === 1) {
1255
+ figPlank1a.addSecond(ctrRectangle2(D2H2 - R2, -W2V1, 2 * R2, W1a2V1 + 2 * param.W2));
1256
+ }
1257
+ }
1258
+ figPlank1a.addSecond(ctrRectangle2(param.H1, -W2V1, param.H2, param.W2));
1259
+ figPlank1a.addSecond(ctrRectangle2(param.H1, W1aV1, param.H2, param.W2));
1260
+ if (param.bSplit === 1) {
1261
+ figPlank1a.addSecond(ctrRectangle2(H1H2, -W2V1, param.H2, param.W2));
1262
+ figPlank1a.addSecond(ctrRectangle2(H1H2, W1aV1, param.H2, param.W2));
1263
+ }
1264
+ const ctrPl1b = [
1265
+ ctrPlank1b2(0, 0, param.d3Plank1West, param.d3Plank1East, d3P1P1234)
1266
+ ];
1267
+ if (R2 > 0) {
1268
+ ctrPl1b.push(contourCircle3(D2H, W1b2, R2));
1269
+ if (param.bSplit === 1) {
1270
+ ctrPl1b.push(contourCircle3(D2H + param.H2, W1b2, R2));
1271
+ }
1272
+ }
1273
+ figPlank1b.addMainOI(ctrPl1b);
1274
+ if (R3 > 0) {
1275
+ figPlank1b.addSecond(ctrRectangle2(D3H - R3, -W3U1, 2 * R3, W1b2U1 + 2 * param.W3));
1276
+ }
1277
+ figPlank1b.addSecond(ctrRectangle2(H12c, -W3U1, param.H3, param.W3));
1278
+ figPlank1b.addSecond(ctrRectangle2(H12c, W1bU1, param.H3, param.W3));
1279
+ const ctrPl2EE = [ctrPlank2EE2(0, 0)];
1280
+ if (R2 > 0) {
1281
+ for (let ii = 0; ii < param.Nb1; ii++) {
1282
+ const ix = W1b2 + W3U1 + ii * stepX;
1283
+ ctrPl2EE.push(contourCircle3(ix, H22, R2));
1284
+ }
1285
+ }
1286
+ if (dbR > 0) {
1287
+ for (let ii = 0; ii < param.Nb1 - 1; ii++) {
1288
+ const ix = ii * stepX + W3U1 + param.W1b + pldbX;
1289
+ ctrPl2EE.push(contourCircle3(ix, H22, dbR));
1290
+ }
1291
+ for (let ii = 1; ii < param.Nb1; ii++) {
1292
+ const ix = W3U1 + ii * stepX - pldbX;
1293
+ ctrPl2EE.push(contourCircle3(ix, H22, dbR));
1294
+ }
1295
+ }
1296
+ figPlank2EE.addMainOI(ctrPl2EE);
1297
+ figPlank2Slot.addMainO(ctrPlank2Slot2(0, 0));
1298
+ const ctrPl2Slot = [ctrPlank2Slot2(0, 0)];
1299
+ if (R2 > 0) {
1300
+ for (let ii = 0; ii < 2; ii++) {
1301
+ const ix = W1b2 + W3U1 + ii * stepX;
1302
+ ctrPl2Slot.push(contourCircle3(ix, H22, R2));
1303
+ }
1304
+ }
1305
+ if (dbR > 0) {
1306
+ ctrPl2Slot.push(contourCircle3(W3U1 + param.W1b + pldbX, H22, dbR));
1307
+ ctrPl2Slot.push(contourCircle3(W3U1 + stepX - pldbX, H22, dbR));
1308
+ }
1309
+ figPlank2Slot.addMainOI(ctrPl2Slot);
1310
+ const ctrPl2Short = [ctrPlank2Short2(0, 0)];
1311
+ if (R2 > 0) {
1312
+ ctrPl2Short.push(contourCircle3(W1b2 + W3U1, H22, R2));
1313
+ }
1314
+ figPlank2Short.addMainOI(ctrPl2Short);
1315
+ const ctrPl3EE = [ctrPlank3EE2(0, 0)];
1316
+ if (R3 > 0) {
1317
+ let ix = param.JaSouth + W1a2;
1318
+ ctrPl3EE.push(contourCircle3(ix, H32, R3));
1319
+ ix += pl3S1;
1320
+ if (pl3S1 > 0) {
1321
+ ctrPl3EE.push(contourCircle3(ix, H32, R3));
1322
+ }
1323
+ ix += param.La + param.W1a;
1324
+ ctrPl3EE.push(contourCircle3(ix, H32, R3));
1325
+ ix += pl3N1;
1326
+ if (pl3N1 > 0) {
1327
+ ctrPl3EE.push(contourCircle3(ix, H32, R3));
1328
+ }
1329
+ }
1330
+ if (R4 > 0) {
1331
+ ctrPl3EE.push(contourCircle3(H32, H32, R4));
1332
+ ctrPl3EE.push(contourCircle3(pl3La - H32, H32, R4));
1333
+ }
1334
+ if (R5 > 0) {
1335
+ const tx = param.JaSouth + param.W1a + laSouth;
1336
+ ctrPl3EE.push(contourCircle3(tx, param.H3arc + H32, R5));
1337
+ }
1338
+ if (daR > 0) {
1339
+ for (const [idx, ix] of aPos.entries()) {
1340
+ const iix = param.JaSouth + ix;
1341
+ if (idx < Na - 1) {
1342
+ ctrPl3EE.push(contourCircle3(iix + param.W1a + pldaX, H32, daR));
1343
+ }
1344
+ if (idx > 0) {
1345
+ ctrPl3EE.push(contourCircle3(iix - pldaX, H32, daR));
1346
+ }
1347
+ }
1348
+ }
1349
+ figPlank3EE.addMainOI(ctrPl3EE);
1350
+ const ctrPl3S = [ctrPlank3S2(0, 0)];
1351
+ if (R3 > 0) {
1352
+ let ix = param.JaSouth + W1a2;
1353
+ ctrPl3S.push(contourCircle3(ix, H32, R3));
1354
+ ix += param.KaSouth + param.W1a;
1355
+ ctrPl3S.push(contourCircle3(ix, H32, R3));
1356
+ }
1357
+ if (R4 > 0) {
1358
+ ctrPl3S.push(contourCircle3(H32, H32, R4));
1359
+ }
1360
+ if (daR > 0) {
1361
+ const xx0 = param.JaSouth + param.W1a;
1362
+ ctrPl3S.push(contourCircle3(xx0 + pldaX, H32, daR));
1363
+ ctrPl3S.push(contourCircle3(xx0 + param.KaSouth - pldaX, H32, daR));
1364
+ }
1365
+ figPlank3S.addMainOI(ctrPl3S);
1366
+ const ctrPl3M = [ctrPlank3M2(0, 0)];
1367
+ if (R3 > 0) {
1368
+ let ix = W1a2 + W2V1;
1369
+ ctrPl3M.push(contourCircle3(ix, H32, R3));
1370
+ ix += param.La + param.W1a;
1371
+ ctrPl3M.push(contourCircle3(ix, H32, R3));
1372
+ }
1373
+ if (R5 > 0) {
1374
+ const tx = param.W2 + W1aV1 + laSouth - pl3S1;
1375
+ ctrPl3M.push(contourCircle3(tx, param.H3arc + H32, R5));
1376
+ }
1377
+ if (daR > 0) {
1378
+ const xx0 = W2V1 + param.W1a;
1379
+ ctrPl3M.push(contourCircle3(xx0 + pldaX, H32, daR));
1380
+ ctrPl3M.push(contourCircle3(xx0 + param.La - pldaX, H32, daR));
1381
+ }
1382
+ figPlank3M.addMainOI(ctrPl3M);
1383
+ const ctrPl3N = [ctrPlank3N2(0, 0)];
1384
+ if (R3 > 0) {
1385
+ let ix = W1a2 + W2V1;
1386
+ ctrPl3N.push(contourCircle3(ix, H32, R3));
1387
+ ix += param.KaNorth + param.W1a;
1388
+ ctrPl3N.push(contourCircle3(ix, H32, R3));
1389
+ }
1390
+ if (R4 > 0) {
1391
+ ctrPl3N.push(contourCircle3(pl3N - H32, H32, R4));
1392
+ }
1393
+ if (daR > 0) {
1394
+ const xx0 = W2V1 + param.W1a;
1395
+ ctrPl3N.push(contourCircle3(xx0 + pldaX, H32, daR));
1396
+ ctrPl3N.push(contourCircle3(xx0 + param.KaNorth - pldaX, H32, daR));
1397
+ }
1398
+ figPlank3N.addMainOI(ctrPl3N);
1399
+ const ctrPl4S = [ctrPlank4S2(0, 0)];
1400
+ if (R4 > 0) {
1401
+ ctrPl4S.push(contourCircle3(param.ReS, W42, R4));
1402
+ const tx = (H32 + R4) / Math.sin(Ra);
1403
+ ctrPl4S.push(contourCircle3(param.ReS + tx, W42, R4));
1404
+ }
1405
+ figPlank4S.addMainOI(ctrPl4S);
1406
+ const ctrPl4N = [ctrPlank4N2(0, 0)];
1407
+ if (R4 > 0) {
1408
+ ctrPl4N.push(contourCircle3(RdNorth1, W42, R4));
1409
+ const tx = (H32 + R4) / Math.sin(RaNorth);
1410
+ ctrPl4N.push(contourCircle3(RdNorth1 - tx, W42, R4));
1411
+ }
1412
+ figPlank4N.addMainOI(ctrPl4N);
1413
+ const ctrPl5a = [ctrPlank5a2(0, 0)];
1414
+ if (R5 > 0) {
1415
+ const ix = l5l - (param.aSplit === 1 ? param.H3s : param.H3) / 2;
1416
+ ctrPl5a.push(contourCircle3(ix, param.W5a / 2, R5));
1417
+ ctrPl5a.push(contourCircle3(l5l + R5, param.W5a / 2, R5));
1418
+ }
1419
+ figPlank5a.addMainOI(ctrPl5a);
1420
+ figPlank5b.addMainO(ctrPlank5b2(0, 0));
1421
+ figPlank6b.addMainO(ctrPlank6b2(0, 0));
1422
+ figPlank6c.addMainO(ctrPlank6c2(0, 0));
1423
+ figPlank6c.addSecond(ctrRectangle2(0, 0, param.W6, param.dtQ));
1424
+ figPlank8S.addMainO(ctrPlank8S2(0, 0));
1425
+ figPlank8N.addMainO(ctrPlank8N2(0, 0));
1426
+ figPlankDiagTop.addMainO(ctrPlankDiagTop2(0, 0, 1));
1427
+ figPlankDiagA.addMainOI([
1428
+ ctrPlankDiagA2(0, 0, 1),
1429
+ contourCircle3(param.daE, param.daW / 2, daR)
1430
+ ]);
1431
+ figPlankDiagB.addMainOI([
1432
+ ctrPlankDiagB2(0, 0, 1),
1433
+ contourCircle3(param.dbE, param.dbW / 2, dbR)
1434
+ ]);
1435
+ rGeome.fig = {
1436
+ faceEast: figEast,
1437
+ faceBase: figBase,
1438
+ faceSouth: figSouth,
1439
+ facePlank1a: figPlank1a,
1440
+ facePlank1b: figPlank1b,
1441
+ facePlank2EE: figPlank2EE,
1442
+ facePlank2Slot: figPlank2Slot,
1443
+ facePlank2Short: figPlank2Short,
1444
+ facePlank3EE: figPlank3EE,
1445
+ facePlank3S: figPlank3S,
1446
+ facePlank3M: figPlank3M,
1447
+ facePlank3N: figPlank3N,
1448
+ facePlank4S: figPlank4S,
1449
+ facePlank4N: figPlank4N,
1450
+ facePlank5a: figPlank5a,
1451
+ facePlank5b: figPlank5b,
1452
+ facePlank6b: figPlank6b,
1453
+ facePlank6c: figPlank6c,
1454
+ facePlank7c: figPlank7c,
1455
+ facePlank8S: figPlank8S,
1456
+ facePlank8N: figPlank8N,
1457
+ facePlankDiagTop: figPlankDiagTop,
1458
+ facePlankDiagA: figPlankDiagA,
1459
+ facePlankDiagB: figPlankDiagB
1460
+ };
1461
+ const designName = rGeome.partName;
1462
+ const exportList = [];
1463
+ if (param.d3Plank1) {
1464
+ exportList.push(`pax_${designName}_pl1`);
1465
+ }
1466
+ if (param.d3Plank2EE) {
1467
+ exportList.push(`subpax_${designName}_pl2ee`);
1468
+ }
1469
+ if (param.d3Plank2Slot) {
1470
+ exportList.push(`subpax_${designName}_pl2slot`);
1471
+ }
1472
+ if (param.d3Plank2short) {
1473
+ exportList.push(`subpax_${designName}_pl2short`);
1474
+ }
1475
+ if (param.d3Plank3EE) {
1476
+ exportList.push(`subpax_${designName}_pl3ee`);
1477
+ }
1478
+ if (param.d3Plank3S) {
1479
+ exportList.push(`subpax_${designName}_pl3s`);
1480
+ }
1481
+ if (param.d3Plank3M) {
1482
+ exportList.push(`subpax_${designName}_pl3m`);
1483
+ }
1484
+ if (param.d3Plank3N) {
1485
+ exportList.push(`subpax_${designName}_pl3n`);
1486
+ }
1487
+ if (param.d3Plank4S) {
1488
+ exportList.push(`subpax_${designName}_pl4s`);
1489
+ }
1490
+ if (param.d3Plank4N) {
1491
+ exportList.push(`subpax_${designName}_pl4n`);
1492
+ }
1493
+ if (param.d3Plank5) {
1494
+ exportList.push(`pax_${designName}_pl5`);
1495
+ }
1496
+ if (param.d3Plank6) {
1497
+ exportList.push(`pax_${designName}_pl6`);
1498
+ }
1499
+ if (param.d3Plank7) {
1500
+ exportList.push(`subpax_${designName}_pl7`);
1501
+ }
1502
+ if (param.d3Plank8S) {
1503
+ exportList.push(`subpax_${designName}_pl8s`);
1504
+ }
1505
+ if (param.d3Plank8N) {
1506
+ exportList.push(`subpax_${designName}_pl8n`);
1507
+ }
1508
+ if (param.d3PlankDiagTop) {
1509
+ exportList.push(`subpax_${designName}_pldt`);
1510
+ }
1511
+ if (param.d3PlankDiagA) {
1512
+ exportList.push(`subpax_${designName}_plda`);
1513
+ }
1514
+ if (param.d3PlankDiagB) {
1515
+ exportList.push(`subpax_${designName}_pldb`);
1516
+ }
1517
+ if (param.d3Assembly) {
1518
+ exportList.push(`pax_${designName}_assembly`);
1519
+ }
1520
+ rGeome.vol = {
1521
+ extrudes: [
1522
+ {
1523
+ outName: `subpax_${designName}_pl1a`,
1524
+ face: `${designName}_facePlank1a`,
1525
+ extrudeMethod: EExtrude3.eLinearOrtho,
1526
+ length: param.W1b,
1527
+ rotate: [0, 0, 0],
1528
+ translate: [0, 0, 0]
1529
+ },
1530
+ {
1531
+ outName: `subpax_${designName}_pl1b`,
1532
+ face: `${designName}_facePlank1b`,
1533
+ extrudeMethod: EExtrude3.eLinearOrtho,
1534
+ length: param.W1a,
1535
+ rotate: [pi2, 0, 0],
1536
+ translate: [0, param.W1a, 0]
1537
+ },
1538
+ {
1539
+ outName: `subpax_${designName}_pl2ee`,
1540
+ face: `${designName}_facePlank2EE`,
1541
+ extrudeMethod: EExtrude3.eLinearOrtho,
1542
+ length: param.W2,
1543
+ rotate: [0, 0, 0],
1544
+ translate: [0, 0, 0]
1545
+ },
1546
+ {
1547
+ outName: `subpax_${designName}_pl2slot`,
1548
+ face: `${designName}_facePlank2Slot`,
1549
+ extrudeMethod: EExtrude3.eLinearOrtho,
1550
+ length: param.W2,
1551
+ rotate: [0, 0, 0],
1552
+ translate: [0, 0, 0]
1553
+ },
1554
+ {
1555
+ outName: `subpax_${designName}_pl2short`,
1556
+ face: `${designName}_facePlank2Short`,
1557
+ extrudeMethod: EExtrude3.eLinearOrtho,
1558
+ length: param.W2,
1559
+ rotate: [0, 0, 0],
1560
+ translate: [0, 0, 0]
1561
+ },
1562
+ {
1563
+ outName: `subpax_${designName}_pl3ee`,
1564
+ face: `${designName}_facePlank3EE`,
1565
+ extrudeMethod: EExtrude3.eLinearOrtho,
1566
+ length: param.W3,
1567
+ rotate: [0, 0, 0],
1568
+ translate: [0, 0, 0]
1569
+ },
1570
+ {
1571
+ outName: `subpax_${designName}_pl3s`,
1572
+ face: `${designName}_facePlank3S`,
1573
+ extrudeMethod: EExtrude3.eLinearOrtho,
1574
+ length: param.W3,
1575
+ rotate: [0, 0, 0],
1576
+ translate: [0, 0, 0]
1577
+ },
1578
+ {
1579
+ outName: `subpax_${designName}_pl3m`,
1580
+ face: `${designName}_facePlank3M`,
1581
+ extrudeMethod: EExtrude3.eLinearOrtho,
1582
+ length: param.W3,
1583
+ rotate: [0, 0, 0],
1584
+ translate: [0, 0, 0]
1585
+ },
1586
+ {
1587
+ outName: `subpax_${designName}_pl3n`,
1588
+ face: `${designName}_facePlank3N`,
1589
+ extrudeMethod: EExtrude3.eLinearOrtho,
1590
+ length: param.W3,
1591
+ rotate: [0, 0, 0],
1592
+ translate: [0, 0, 0]
1593
+ },
1594
+ {
1595
+ outName: `subpax_${designName}_pl4s`,
1596
+ face: `${designName}_facePlank4S`,
1597
+ extrudeMethod: EExtrude3.eLinearOrtho,
1598
+ length: pl4W,
1599
+ rotate: [0, 0, 0],
1600
+ translate: [0, 0, 0]
1601
+ },
1602
+ {
1603
+ outName: `subpax_${designName}_pl4n`,
1604
+ face: `${designName}_facePlank4N`,
1605
+ extrudeMethod: EExtrude3.eLinearOrtho,
1606
+ length: pl4W,
1607
+ rotate: [0, 0, 0],
1608
+ translate: [0, 0, 0]
1609
+ },
1610
+ {
1611
+ outName: `subpax_${designName}_pl5a`,
1612
+ face: `${designName}_facePlank5a`,
1613
+ extrudeMethod: EExtrude3.eLinearOrtho,
1614
+ length: pl5aW,
1615
+ rotate: [0, 0, 0],
1616
+ translate: [0, 0, 0]
1617
+ },
1618
+ {
1619
+ outName: `subpax_${designName}_pl5b`,
1620
+ face: `${designName}_facePlank5b`,
1621
+ extrudeMethod: EExtrude3.eLinearOrtho,
1622
+ length: pl5bW,
1623
+ rotate: [pi2, 0, 0],
1624
+ translate: [0, pl5bW, 0]
1625
+ },
1626
+ {
1627
+ outName: `subpax_${designName}_pl6b`,
1628
+ face: `${designName}_facePlank6b`,
1629
+ extrudeMethod: EExtrude3.eLinearOrtho,
1630
+ length: param.W6,
1631
+ rotate: [pi2, 0, 0],
1632
+ translate: [0, param.W6, 0]
1633
+ },
1634
+ {
1635
+ outName: `subpax_${designName}_pl6c`,
1636
+ face: `${designName}_facePlank6c`,
1637
+ extrudeMethod: EExtrude3.eLinearOrtho,
1638
+ length: pl6bL,
1639
+ rotate: [pi2, 0, -pi2],
1640
+ translate: [pl6bL, param.W6, 0]
1641
+ },
1642
+ {
1643
+ outName: `subpax_${designName}_pl7`,
1644
+ face: `${designName}_facePlank7c`,
1645
+ extrudeMethod: EExtrude3.eLinearOrtho,
1646
+ length: pl6bL,
1647
+ rotate: [pi2, 0, 0],
1648
+ translate: [0, pl6bL, 0]
1649
+ },
1650
+ {
1651
+ outName: `subpax_${designName}_pl8s`,
1652
+ face: `${designName}_facePlank8S`,
1653
+ extrudeMethod: EExtrude3.eLinearOrtho,
1654
+ length: pl4W,
1655
+ rotate: [0, 0, 0],
1656
+ translate: [0, 0, 0]
1657
+ },
1658
+ {
1659
+ outName: `subpax_${designName}_pl8n`,
1660
+ face: `${designName}_facePlank8N`,
1661
+ extrudeMethod: EExtrude3.eLinearOrtho,
1662
+ length: pl4W,
1663
+ rotate: [0, 0, 0],
1664
+ translate: [0, 0, 0]
1665
+ },
1666
+ {
1667
+ outName: `subpax_${designName}_pldt`,
1668
+ face: `${designName}_facePlankDiagTop`,
1669
+ extrudeMethod: EExtrude3.eLinearOrtho,
1670
+ length: param.W6,
1671
+ rotate: [0, 0, 0],
1672
+ translate: [0, 0, 0]
1673
+ },
1674
+ {
1675
+ outName: `subpax_${designName}_plda`,
1676
+ face: `${designName}_facePlankDiagA`,
1677
+ extrudeMethod: EExtrude3.eLinearOrtho,
1678
+ length: W1b2U1,
1679
+ rotate: [0, 0, 0],
1680
+ translate: [0, 0, 0]
1681
+ },
1682
+ {
1683
+ outName: `subpax_${designName}_pldb`,
1684
+ face: `${designName}_facePlankDiagB`,
1685
+ extrudeMethod: EExtrude3.eLinearOrtho,
1686
+ length: W1a2V1,
1687
+ rotate: [0, 0, 0],
1688
+ translate: [0, 0, 0]
1689
+ }
1690
+ ],
1691
+ volumes: [
1692
+ {
1693
+ outName: `pax_${designName}_pl1`,
1694
+ boolMethod: EBVolume3.eIntersection,
1695
+ inList: [`subpax_${designName}_pl1a`, `subpax_${designName}_pl1b`]
1696
+ },
1697
+ {
1698
+ outName: `pax_${designName}_pl5`,
1699
+ boolMethod: EBVolume3.eIntersection,
1700
+ inList: [`subpax_${designName}_pl5a`, `subpax_${designName}_pl5b`]
1701
+ },
1702
+ {
1703
+ outName: `pax_${designName}_pl6`,
1704
+ boolMethod: EBVolume3.eIntersection,
1705
+ inList: [`subpax_${designName}_pl6b`, `subpax_${designName}_pl6c`]
1706
+ },
1707
+ {
1708
+ outName: `pax_${designName}_assembly`,
1709
+ boolMethod: EBVolume3.eUnion,
1710
+ inList: [`pax_${designName}_pl1`, `pax_${designName}_pl6`]
1711
+ },
1712
+ {
1713
+ outName: `pax_${designName}`,
1714
+ boolMethod: EBVolume3.eUnion,
1715
+ inList: exportList
1716
+ }
1717
+ ]
1718
+ };
1719
+ rGeome.sub = {};
1720
+ rGeome.logstr += "abri drawn successfully!\n";
1721
+ rGeome.calcErr = false;
1722
+ } catch (emsg) {
1723
+ rGeome.logstr += emsg;
1724
+ console.log(emsg);
1725
+ }
1726
+ return rGeome;
1727
+ }
1728
+ var abriDef = {
1729
+ pTitle: "abri",
1730
+ pDescription: "A shelter made out of wood beam for supporting photovoltaic panels",
1731
+ pDef: pDef3,
1732
+ pGeom: pGeom3
1733
+ };
1734
+
1735
+ // src/stone/stairs.ts
1736
+ import {
1737
+ point as point2,
1738
+ contour as contour4,
1739
+ contourCircle as contourCircle4,
1740
+ ctrRectangle as ctrRectangle3,
1741
+ figure as figure4,
1742
+ radToDeg as radToDeg2,
1743
+ ffix as ffix3,
1744
+ pNumber as pNumber4,
1745
+ pDropdown as pDropdown2,
1746
+ pSectionSeparator as pSectionSeparator4,
1747
+ EExtrude as EExtrude4,
1748
+ EBVolume as EBVolume4,
1749
+ initGeom as initGeom4
1750
+ } from "geometrix";
1751
+ var pDef4 = {
353
1752
  partName: "stairs",
354
1753
  params: [
355
1754
  //pNumber(name, unit, init, min, max, step)
356
- pNumber3("Nn", "stair", 25, 1, 200, 1),
357
- pNumber3("Nd", "stair", 20, 2, 200, 1),
358
- pNumber3("D1", "mm", 5e3, 1e3, 5e4, 1),
359
- pNumber3("Wi1", "mm", 1e3, 1, 1e4, 1),
360
- pNumber3("We1", "mm", 1e3, 1, 1e4, 1),
361
- pNumber3("Wi2", "mm", 2e3, 1, 1e4, 1),
362
- pNumber3("We2", "mm", 2e3, 1, 1e4, 1),
363
- pSectionSeparator3("Details"),
364
- pDropdown("spiral", ["ExtInt", "Exterior", "Interior"]),
365
- pDropdown("border", ["arc", "straight"]),
366
- pNumber3("H1", "mm", 200, 10, 2e3, 1),
367
- pNumber3("Wc", "mm", 200, 10, 2e3, 1),
368
- pNumber3("Nc", "column", 6, 1, 100, 1)
1755
+ pNumber4("Nn", "stair", 25, 1, 200, 1),
1756
+ pNumber4("Nd", "stair", 20, 2, 200, 1),
1757
+ pNumber4("D1", "mm", 5e3, 1e3, 5e4, 1),
1758
+ pNumber4("Wi1", "mm", 1e3, 1, 1e4, 1),
1759
+ pNumber4("We1", "mm", 1e3, 1, 1e4, 1),
1760
+ pNumber4("Wi2", "mm", 2e3, 1, 1e4, 1),
1761
+ pNumber4("We2", "mm", 2e3, 1, 1e4, 1),
1762
+ pSectionSeparator4("Details"),
1763
+ pDropdown2("spiral", ["ExtInt", "Exterior", "Interior"]),
1764
+ pDropdown2("border", ["arc", "straight"]),
1765
+ pNumber4("H1", "mm", 200, 10, 2e3, 1),
1766
+ pNumber4("Wc", "mm", 200, 10, 2e3, 1),
1767
+ pNumber4("Nc", "column", 6, 0, 100, 1)
369
1768
  ],
370
1769
  paramSvg: {
371
1770
  Nn: "stairs_top.svg",
@@ -388,27 +1787,39 @@ var pDef3 = {
388
1787
  // every 0.5 second
389
1788
  }
390
1789
  };
391
- function pGeom3(t, param, suffix = "") {
392
- const rGeome = initGeom3(pDef3.partName + suffix);
393
- const figTop = figure3();
394
- const figTopColumn = figure3();
395
- const figBorderI = figure3();
396
- const figBorderE = figure3();
1790
+ function pGeom4(t, param, suffix = "") {
1791
+ const rGeome = initGeom4(pDef4.partName + suffix);
1792
+ const figTop = figure4();
1793
+ const figTopColumn = figure4();
1794
+ const figBorderI = figure4();
1795
+ const figBorderE = figure4();
397
1796
  rGeome.logstr += `${rGeome.partName} simTime: ${t}
398
1797
  `;
399
1798
  try {
400
- let spiral2 = function(ir0, irr, ird, iwc, idx, iSign) {
401
- const ab = idx * 2 * aStair2;
1799
+ let ptSpiral2 = function(ird, idx, iSign) {
1800
+ const rab = idx * 2 * aStair2;
402
1801
  const cPi = iSign < 0 ? pi : 0;
403
- const aa = ab + a0 + cPi;
1802
+ const aa = rab + a0 + cPi;
1803
+ const rpt = point2(ird, 0).rotate(p0, aa);
1804
+ return [rpt, rab];
1805
+ }, ctrPolygon2 = function(iN, ird, iSign) {
1806
+ const [pp0] = ptSpiral2(ird, 0, iSign);
1807
+ const rCtr = contour4(pp0.cx, pp0.cy);
1808
+ for (let ii = 1; ii < iN; ii++) {
1809
+ const [ppi] = ptSpiral2(ird, ii, iSign);
1810
+ rCtr.addSegStrokeA(ppi.cx, ppi.cy);
1811
+ }
1812
+ rCtr.closeSegStroke();
1813
+ return rCtr;
1814
+ }, spiral2 = function(ir0, irr, ird, iwc, idx, iSign) {
1815
+ const [pc, ab] = ptSpiral2(ird, idx, iSign);
404
1816
  const rr = ir0 + iSign * (idx * irr - iwc);
405
- const pc = point(ird, 0).rotate(p0, aa);
406
1817
  const rp1 = pc.translatePolar(ab, rr);
407
1818
  const rp2 = pc.translatePolar(ab + aStair2, rr);
408
1819
  const rp3 = pc.translatePolar(ab + 2 * aStair2, rr);
409
1820
  return [rp1, rp2, rp3];
410
1821
  }, ctrStair2 = function(pi1, pi22, pi3, pe1, pe2, pe3) {
411
- const rCtr = contour3(pe1.cx, pe1.cy);
1822
+ const rCtr = contour4(pe1.cx, pe1.cy);
412
1823
  if (param.border === 0) {
413
1824
  rCtr.addPointA(pe2.cx, pe2.cy).addPointA(pe3.cx, pe3.cy).addSegArc2();
414
1825
  } else {
@@ -422,8 +1833,13 @@ function pGeom3(t, param, suffix = "") {
422
1833
  }
423
1834
  rCtr.closeSegStroke();
424
1835
  return rCtr;
1836
+ }, ptColumn2 = function(ipI, ipE, iWc) {
1837
+ const aa = Math.atan2(ipE.cy - ipI.cy, ipE.cx - ipI.cx);
1838
+ const rpI = ipI.translatePolar(aa, iWc);
1839
+ const rpE = ipE.translatePolar(aa + pi, iWc);
1840
+ return [rpI, rpE];
425
1841
  };
426
- var spiral = spiral2, ctrStair = ctrStair2;
1842
+ var ptSpiral = ptSpiral2, ctrPolygon = ctrPolygon2, spiral = spiral2, ctrStair = ctrStair2, ptColumn = ptColumn2;
427
1843
  const pi = Math.PI;
428
1844
  const pi2 = pi / 2;
429
1845
  const R1 = param.D1 / 2;
@@ -432,9 +1848,10 @@ function pGeom3(t, param, suffix = "") {
432
1848
  const aStair2 = pi / param.Nd;
433
1849
  const Rid = Wid / (2 * Math.sin(aStair2));
434
1850
  const Red = Wed / (2 * Math.sin(aStair2));
435
- const p0 = point(0, 0);
1851
+ const p0 = point2(0, 0);
436
1852
  const a0 = pi2 + aStair2;
437
- const columnNb = Math.floor(param.Nn / param.Nc);
1853
+ const columnNb = param.Nc > 0 ? Math.floor(param.Nn / param.Nc) : 0;
1854
+ const Nc = param.Nc > 0 ? param.Nc : 1;
438
1855
  if (param.Wi2 < param.Wi1) {
439
1856
  throw `err092: Wi2 ${param.Wi2} is too small compare to Wi1 ${param.Wi1}`;
440
1857
  }
@@ -450,16 +1867,16 @@ function pGeom3(t, param, suffix = "") {
450
1867
  if (param.We1 < param.Wc) {
451
1868
  throw `err113: We1 ${param.We1} is too small compare to Wc ${param.Wc}`;
452
1869
  }
453
- rGeome.logstr += `Stair angle ${ffix2(radToDeg(2 * aStair2))} degree
1870
+ rGeome.logstr += `Stair angle ${ffix3(radToDeg2(2 * aStair2))} degree
454
1871
  `;
455
- rGeome.logstr += `Stairs angle ${ffix2(param.Nn / param.Nd)} turn with ${columnNb} columns
1872
+ rGeome.logstr += `Stairs angle ${ffix3(param.Nn / param.Nd)} turn with ${columnNb} columns
456
1873
  `;
457
- const ctrCircleRef = contourCircle3(0, 0, R1);
458
- const ctrCircleSpiralI = contourCircle3(0, 0, Rid);
459
- const ctrCircleSpiralE = contourCircle3(0, 0, Red);
1874
+ const ctrCircleRef = contourCircle4(0, 0, R1);
1875
+ const ctrPolygonI = ctrPolygon2(param.Nd, Rid, -1);
1876
+ const ctrPolygonE = ctrPolygon2(param.Nd, Red, 1);
460
1877
  figTop.addSecond(ctrCircleRef);
461
- figTop.addSecond(ctrCircleSpiralI);
462
- figTop.addSecond(ctrCircleSpiralE);
1878
+ figTop.addSecond(ctrPolygonI);
1879
+ figTop.addSecond(ctrPolygonE);
463
1880
  const ctrListStair = [];
464
1881
  for (let ii = 0; ii < param.Nn; ii++) {
465
1882
  const wEI = ii * (Wed + Wid) + param.We1 + param.Wi1;
@@ -482,9 +1899,10 @@ function pGeom3(t, param, suffix = "") {
482
1899
  const ii2 = (ii + 1) * param.Nc - 1;
483
1900
  const wEI = ii2 * (Wed + Wid) + param.We1 + param.Wi1;
484
1901
  let [pi1, pi22, pi3] = spiral2(R1 - param.Wi1, Wid, Rid, 0, ii2, -1);
485
- let [pi4, pi5, pi6] = spiral2(R1 - param.Wi1, Wid, Rid, param.Wc, ii2, -1);
486
1902
  let [pe1, pe2, pe3] = spiral2(R1 + param.We1, Wed, Red, 0, ii2, 1);
487
- let [pe4, pe5, pe6] = spiral2(R1 + param.We1, Wed, Red, param.Wc, ii2, 1);
1903
+ let [pi4, pe4] = ptColumn2(pi1, pe1, param.Wc);
1904
+ let [pi5, pe5] = ptColumn2(pi22, pe2, param.Wc);
1905
+ let [pi6, pe6] = ptColumn2(pi3, pe3, param.Wc);
488
1906
  if (param.spiral === 1) {
489
1907
  [pe4, pe5, pe6] = spiral2(R1 + param.We1, Wed, Red, param.Wc, ii2, 1);
490
1908
  [pi1, pi22, pi3] = spiral2(R1 + param.We1, Wed, Red, wEI, ii2, 1);
@@ -509,9 +1927,9 @@ function pGeom3(t, param, suffix = "") {
509
1927
  for (let ii = 0; ii < param.Nn; ii++) {
510
1928
  const lStair = (R1 - param.Wi1 - ii * Wid) * 2 * aStair2;
511
1929
  const yy = ii * param.H1;
512
- figBorderI.addMainO(ctrRectangle2(xx, yy, lStair, param.H1));
513
- if ((ii + 1) % param.Nc === 0 && yy > 0) {
514
- figBorderI.addMainO(ctrRectangle2(xx, 0, lStair, yy));
1930
+ figBorderI.addMainO(ctrRectangle3(xx, yy, lStair, param.H1));
1931
+ if ((ii + 1) % Nc === 0 && yy > 0) {
1932
+ figBorderI.addMainO(ctrRectangle3(xx, 0, lStair, yy));
515
1933
  colHeight.push(yy);
516
1934
  }
517
1935
  xx += lStair;
@@ -521,9 +1939,9 @@ function pGeom3(t, param, suffix = "") {
521
1939
  for (let ii = 0; ii < param.Nn; ii++) {
522
1940
  const lStair = (R1 + param.We1 - ii * Wed) * 2 * aStair2;
523
1941
  const yy = ii * param.H1;
524
- figBorderE.addMainO(ctrRectangle2(xx, yy, lStair, param.H1));
525
- if ((ii + 1) % param.Nc === 0 && yy > 0) {
526
- figBorderE.addMainO(ctrRectangle2(xx, 0, lStair, yy));
1942
+ figBorderE.addMainO(ctrRectangle3(xx, yy, lStair, param.H1));
1943
+ if ((ii + 1) % Nc === 0 && yy > 0) {
1944
+ figBorderE.addMainO(ctrRectangle3(xx, 0, lStair, yy));
527
1945
  }
528
1946
  xx += lStair;
529
1947
  }
@@ -533,7 +1951,7 @@ function pGeom3(t, param, suffix = "") {
533
1951
  const listVolName = [];
534
1952
  const designName = rGeome.partName;
535
1953
  for (const [idx, elem] of ctrListStair.entries()) {
536
- const iFig = figure3();
1954
+ const iFig = figure4();
537
1955
  iFig.addMainO(elem);
538
1956
  const iStr = `Stair${idx.toString().padStart(4, "0")}`;
539
1957
  const iFace = `face${iStr}`;
@@ -541,7 +1959,7 @@ function pGeom3(t, param, suffix = "") {
541
1959
  listVol.push({
542
1960
  outName: `subpax_${designName}_${iStr}`,
543
1961
  face: `${designName}_${iFace}`,
544
- extrudeMethod: EExtrude3.eLinearOrtho,
1962
+ extrudeMethod: EExtrude4.eLinearOrtho,
545
1963
  length: param.H1,
546
1964
  rotate: [0, 0, 0],
547
1965
  translate: [0, 0, idx * param.H1]
@@ -549,7 +1967,7 @@ function pGeom3(t, param, suffix = "") {
549
1967
  listVolName.push(`subpax_${designName}_${iStr}`);
550
1968
  }
551
1969
  for (const [idx, elem] of ctrListColumnI.entries()) {
552
- const iFig = figure3();
1970
+ const iFig = figure4();
553
1971
  iFig.addMainO(elem);
554
1972
  iFig.addMainO(ctrListColumnE[idx]);
555
1973
  const iStr = `Col${idx.toString().padStart(4, "0")}`;
@@ -558,7 +1976,7 @@ function pGeom3(t, param, suffix = "") {
558
1976
  listVol.push({
559
1977
  outName: `subpax_${designName}_${iStr}`,
560
1978
  face: `${designName}_${iFace}`,
561
- extrudeMethod: EExtrude3.eLinearOrtho,
1979
+ extrudeMethod: EExtrude4.eLinearOrtho,
562
1980
  length: colHeight[idx],
563
1981
  rotate: [0, 0, 0],
564
1982
  translate: [0, 0, 0]
@@ -578,7 +1996,7 @@ function pGeom3(t, param, suffix = "") {
578
1996
  volumes: [
579
1997
  {
580
1998
  outName: `pax_${designName}`,
581
- boolMethod: EBVolume3.eUnion,
1999
+ boolMethod: EBVolume4.eUnion,
582
2000
  inList: listVolName
583
2001
  }
584
2002
  ]
@@ -595,10 +2013,11 @@ function pGeom3(t, param, suffix = "") {
595
2013
  var stairsDef = {
596
2014
  pTitle: "stairs",
597
2015
  pDescription: "an helicoidal stairs",
598
- pDef: pDef3,
599
- pGeom: pGeom3
2016
+ pDef: pDef4,
2017
+ pGeom: pGeom4
600
2018
  };
601
2019
  export {
2020
+ abriDef,
602
2021
  catamaranDef,
603
2022
  stairsDef,
604
2023
  voilaDef