@eturnity/eturnity_maths 6.46.0 → 6.48.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/geometry.js +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_maths",
3
- "version": "6.46.0",
3
+ "version": "6.48.0",
4
4
  "author": "Eturnity Team",
5
5
  "main": "src/index.js",
6
6
  "private": false,
package/src/geometry.js CHANGED
@@ -759,9 +759,11 @@ export function get3DDistanceBetweenPoints(firstPoint, secondPoint) {
759
759
  for (var i = 0; i < n; i++) {
760
760
  var v_current = substractVector(vertices[i], vertices[0])
761
761
  var v_next = substractVector(vertices[(i + 1) % n], vertices[0])
762
- area += 0.5 * vectorLength(crossProduct(v_current, v_next))
762
+ const product = crossProduct(v_current, v_next)
763
+ const sgn=product.z>0?-1:1
764
+ area += 0.5 * sgn * vectorLength(product)
763
765
  }
764
- return area
766
+ return Math.abs(area)
765
767
  }
766
768
 
767
769
  export function hasNaN(arr) {