@eturnity/eturnity_maths 6.38.0 → 6.39.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_maths",
3
- "version": "6.38.0",
3
+ "version": "6.39.0",
4
4
  "author": "Eturnity Team",
5
5
  "main": "src/index.js",
6
6
  "private": false,
package/src/geometry.js CHANGED
@@ -21,7 +21,7 @@ export function getConcaveOutline(selectedPanels,onPanelOutline){
21
21
  }, [])
22
22
  let AB = getDistanceBetweenPoints(onPanelOutline[0], onPanelOutline[1])
23
23
  let AD = getDistanceBetweenPoints(onPanelOutline[0], onPanelOutline[3])
24
- let longEdgeLength = Math.max(AB, AD) + 100
24
+ let longEdgeLength = Math.min(AB, AD)
25
25
  var concaveResult = concaveman(points, 1, longEdgeLength)
26
26
  concaveResult.pop()
27
27
  let moduleFieldOutline = concaveResult.map((p) => {
@@ -104,14 +104,6 @@ export function getDistanceBetweenPoints(firstPoint, secondPoint) {
104
104
  )
105
105
  return distance
106
106
  }
107
- export function get3DDistanceBetweenPoints(firstPoint, secondPoint) {
108
- const distance = Math.hypot(
109
- firstPoint.x - secondPoint.x,
110
- firstPoint.y - secondPoint.y,
111
- firstPoint.z - secondPoint.z
112
- )
113
- return distance
114
- }
115
107
 
116
108
  export function getDegree(H, I, J) {
117
109
  const a = getDistanceBetweenPoints(H, I)
package/src/matrix.js CHANGED
@@ -52,7 +52,7 @@ export function inverse3x3matrix(m) {
52
52
  }
53
53
  return product
54
54
  }
55
- export function rotateTransformation(point,angle,center = {x:0,y:0}){
55
+ export function rotateTransformation(point,angle,center){
56
56
  let rotationMatrix=[[Math.cos(angle),Math.sin(angle)],[-Math.sin(angle),Math.cos(angle)]]
57
57
  let k=multiplyMatrices(rotationMatrix,[[point.x-center.x],[point.y-center.y]])
58
58
  return {x:k[0][0]+center.x,y:k[1][0]+center.y}
@@ -2,8 +2,6 @@
2
2
  import {
3
3
  getDistanceBetweenPoints,
4
4
  translate2D,
5
- verticalProjectionOnPlane,
6
- get3DDistanceBetweenPoints
7
5
  } from '../geometry'
8
6
  import { v4 as uuidv4 } from 'uuid'
9
7
  import {Point} from './Point'
@@ -34,21 +32,11 @@ export class Circle {
34
32
  const toCanvasRef = canvasContext.toCanvasRef
35
33
  let pxCenter = toCanvasRef(this.center)
36
34
  let pxRadius = this.radius / canvasContext.mmPerPx
37
- if(this.normalVector){
38
- point.z=verticalProjectionOnPlane(point,this.normalVector,this.center).z
39
- }else{
40
- point.z=this.center.z
41
- }
42
- return Math.abs(get3DDistanceBetweenPoints(point, pxCenter) - pxRadius)
35
+ return Math.abs(getDistanceBetweenPoints(point, pxCenter) - pxRadius)
43
36
  }
44
37
  getProjectedPoint(point) {
45
- if(this.normalVector){
46
- point.z=verticalProjectionOnPlane(point,this.normalVector,this.center).z
47
- }else{
48
- point.z=this.center.z
49
- }
50
- let distance = get3DDistanceBetweenPoints(point, this.center)
51
- if (distance == 0) {
38
+ let distance = getDistanceBetweenPoints(point, this.center)
39
+ if (distance == 0) {
52
40
  console.error("can't project center to cercle", this)
53
41
  return null
54
42
  }
@@ -1,7 +1,6 @@
1
1
 
2
2
  import {
3
3
  getDistanceBetweenPoints,
4
- get3DDistanceBetweenPoints,
5
4
  getPointOnLine,
6
5
  isSamePoint3D,
7
6
  translate2D,
@@ -41,8 +40,8 @@ export class Line {
41
40
  canvasContext.mmPerPx
42
41
  )
43
42
  }
44
- mmLength() {
45
- return get3DDistanceBetweenPoints(this.outline[0], this.outline[1])
43
+ mmLength(canvasContext) {
44
+ return getDistanceBetweenPoints(this.outline[0], this.outline[1])
46
45
  }
47
46
 
48
47
  getMidPoint() {
@@ -26,7 +26,6 @@ export class Polygon {
26
26
  this.highlight = false
27
27
  this.visible = true
28
28
  this.heightReference = 0
29
- this.priority = 0
30
29
  this.margins = {
31
30
  isSameMargin: true,
32
31
  sameMargin: 200,