@eturnity/eturnity_maths
Advanced tools
Comparing version 6.37.0 to 6.38.0-EPDM-8453.0
{ | ||
"name": "@eturnity/eturnity_maths", | ||
"version": "6.37.0", | ||
"version": "6.38.0-EPDM-8453.0", | ||
"author": "Eturnity Team", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -24,3 +24,3 @@ import { | ||
let AD = getDistanceBetweenPoints(onPanelOutline[0], onPanelOutline[3]) | ||
let longEdgeLength = Math.max(AB, AD) + 100 | ||
let longEdgeLength = AB+AD | ||
var concaveResult = concaveman(points, 1, longEdgeLength) | ||
@@ -108,2 +108,10 @@ concaveResult.pop() | ||
} | ||
export function get3DDistanceBetweenPoints(firstPoint, secondPoint) { | ||
const distance = Math.hypot( | ||
firstPoint.x - secondPoint.x, | ||
firstPoint.y - secondPoint.y, | ||
firstPoint.z - secondPoint.z | ||
) | ||
return distance | ||
} | ||
@@ -110,0 +118,0 @@ export function getDegree(H, I, J) { |
@@ -55,3 +55,3 @@ import { substractVector } from "./vector" | ||
} | ||
export function rotateTransformation(point,angle,center){ | ||
export function rotateTransformation(point,angle,center = {x:0,y:0}){ | ||
let rotationMatrix=[[Math.cos(angle),Math.sin(angle)],[-Math.sin(angle),Math.cos(angle)]] | ||
@@ -58,0 +58,0 @@ let k=multiplyMatrices(rotationMatrix,[[point.x-center.x],[point.y-center.y]]) |
@@ -5,2 +5,4 @@ | ||
translate2D, | ||
verticalProjectionOnPlane, | ||
get3DDistanceBetweenPoints | ||
} from '../geometry' | ||
@@ -36,7 +38,17 @@ import { v4 as uuidv4 } from 'uuid' | ||
let pxRadius = this.radius / canvasContext.mmPerPx | ||
return Math.abs(getDistanceBetweenPoints(point, pxCenter) - pxRadius) | ||
if(this.normalVector){ | ||
point.z=verticalProjectionOnPlane(point,this.normalVector,this.center).z | ||
}else{ | ||
point.z=this.center.z | ||
} | ||
return Math.abs(get3DDistanceBetweenPoints(point, pxCenter) - pxRadius) | ||
} | ||
getProjectedPoint(point) { | ||
let distance = getDistanceBetweenPoints(point, this.center) | ||
if (distance == 0) { | ||
if(this.normalVector){ | ||
point.z=verticalProjectionOnPlane(point,this.normalVector,this.center).z | ||
}else{ | ||
point.z=this.center.z | ||
} | ||
let distance = get3DDistanceBetweenPoints(point, this.center) | ||
if (distance == 0) { | ||
console.error("can't project center to cercle", this) | ||
@@ -43,0 +55,0 @@ return null |
import { | ||
getDistanceBetweenPoints, | ||
get3DDistanceBetweenPoints, | ||
getPointOnLine, | ||
@@ -43,4 +44,4 @@ isSamePoint3D, | ||
} | ||
mmLength(canvasContext) { | ||
return getDistanceBetweenPoints(this.outline[0], this.outline[1]) | ||
mmLength() { | ||
return get3DDistanceBetweenPoints(this.outline[0], this.outline[1]) | ||
} | ||
@@ -47,0 +48,0 @@ |
@@ -29,2 +29,3 @@ | ||
this.heightReference = 0 | ||
this.priority = 0 | ||
this.margins = { | ||
@@ -31,0 +32,0 @@ isSameMargin: true, |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
102807
3199
2
9
3