poly-extrude 0.20.0 → 0.20.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * poly-extrude v0.20.0
2
+ * poly-extrude v0.20.2
3
3
  */
4
4
  (function (global, factory) {
5
5
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -2560,15 +2560,26 @@
2560
2560
  i++;
2561
2561
  continue;
2562
2562
  }
2563
- TEMPV1.x = p0[0] - p1[0];
2564
- TEMPV1.y = p0[1] - p1[1];
2565
- TEMPV2.x = p2[0] - p1[0];
2566
- TEMPV2.y = p2[1] - p1[1];
2567
- if ((TEMPV1.x === 0 && TEMPV1.y === 0) || (TEMPV2.x === 0 && TEMPV2.y === 0)) {
2568
- console.error('has repeat vertex,the index:', i);
2563
+ const dy1 = p1[1] - p0[1], dx1 = p1[0] - p0[0];
2564
+ const rad1 = Math.atan2(dy1, dx1);
2565
+ const angle1 = radToDeg(rad1);
2566
+ // 平行,回头路
2567
+ if (Math.abs(Math.abs(angle1 - angle) - 180) <= 0.0001) {
2568
+ rAngle = angle;
2569
+ rAngle -= 90;
2570
+ console.log();
2571
+ }
2572
+ else {
2573
+ TEMPV1.x = p0[0] - p1[0];
2574
+ TEMPV1.y = p0[1] - p1[1];
2575
+ TEMPV2.x = p2[0] - p1[0];
2576
+ TEMPV2.y = p2[1] - p1[1];
2577
+ if ((TEMPV1.x === 0 && TEMPV1.y === 0) || (TEMPV2.x === 0 && TEMPV2.y === 0)) {
2578
+ console.error('has repeat vertex,the index:', i);
2579
+ }
2580
+ const vAngle = getAngle$1(TEMPV1, TEMPV2);
2581
+ rAngle = angle - vAngle / 2;
2569
2582
  }
2570
- const vAngle = getAngle$1(TEMPV1, TEMPV2);
2571
- rAngle = angle - vAngle / 2;
2572
2583
  }
2573
2584
  const rRad = degToRad(rAngle);
2574
2585
  const p3 = currentp;