New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eturnity/eturnity_maths

Package Overview
Dependencies
Maintainers
5
Versions
434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eturnity/eturnity_maths - npm Package Compare versions

Comparing version 6.34.3 to 6.37.0-3d-qa-6.38.0

7

package.json
{
"name": "@eturnity/eturnity_maths",
"version": "6.34.3",
"version": "6.37.0-3d-qa-6.38.0",
"author": "Eturnity Team",

@@ -20,3 +20,4 @@ "main": "src/index.js",

"svd-js": "^1.1.1",
"uuid": "^9.0.0"
"uuid": "^9.0.0",
"concaveman": "^1.2.1"
},

@@ -30,2 +31,2 @@ "devDependencies": {

"description": ""
}
}

@@ -15,3 +15,38 @@ import {

import {Line} from './objects/Line'
import concaveman from 'concaveman'
export function getConcaveOutline(selectedPanels,onePanelOutline){
const points = selectedPanels.reduce((acc, cur) => {
acc.push(...cur.outline.map((p) => [p.x, p.y]))
return acc
}, [])
let AB = getDistanceBetweenPoints(onePanelOutline[0], onePanelOutline[1])
let AD = getDistanceBetweenPoints(onePanelOutline[0], onePanelOutline[3])
let longEdgeLength = Math.max(AB, AD) + 100
var concaveResult = concaveman(points, 1, longEdgeLength)
concaveResult.pop()
let moduleFieldOutline = concaveResult.map((p) => {
return {
x: p[0],
y: p[1],
z: 0
}
})
//remove aligned nodes
moduleFieldOutline=simplifyOutline(moduleFieldOutline)
return moduleFieldOutline
}
export function simplifyOutline(initialOutline){
const simplifiedOutline=[]
initialOutline.forEach((p, k, outline) => {
let len = outline.length
let A = outline[(k - 1 + len) % len]
let B = outline[(k + 1) % len]
let M = outline[k % len]
if (!isInsideEdge2D(M, A, B)) {
simplifiedOutline.push(M)
}
})
return simplifiedOutline
}
export function getSnapedValue(value, snaps, tolerance) {

@@ -73,2 +108,10 @@ let closeSnapsItem = snaps.reduce(

}
export function get3DDistanceBetweenPoints(firstPoint, secondPoint) {
const distance = Math.hypot(
firstPoint.x - secondPoint.x,
firstPoint.y - secondPoint.y,
firstPoint.z - secondPoint.z
)
return distance
}

@@ -75,0 +118,0 @@ export function getDegree(H, I, J) {

@@ -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 {
multiplyVector
} from '../../vector'
import {getMarginPoint} from '../../geometry'
import {getMarginPoint,isClockWise} from '../../geometry'
import {calculateBestFittingPlanePolygon} from './updateComputedGeometryPolygon'
//update and calculate margins for all polygon

@@ -110,1 +111,33 @@ export function updateMarginsOutline(state){

}
export function getOutterOutlineWithConstantMargin(outline,margin){
const isClockwise = isClockWise(outline)
const {
projectedOutline,
maximumGap,
normalVector,
meanPoint,
incline,
direction
} = calculateBestFittingPlanePolygon(outline)
let clockwiseNormalVector=normalVector
if(isClockwise){
clockwiseNormalVector=multiplyVector(-1,clockwiseNormalVector)
}
//outterOutline is the outline close to the wall
const outterOutline=[]
const length=outline.length
for(let index=0;index<length;index++){
const B=projectedOutline[index]
//A,B,C three consecutive points on the polygon.
//n is a vector in the plan normal to AB of length margin[A] directed towards the inside
//m is a vector in the plan normal to BC of length margin[B] directed towards the inside
//K is the margin outline linked with B
const A=projectedOutline[(index-1+length)%length]
const C=projectedOutline[(index+1)%length]
//filling the margins values if not initiated.
let K=getMarginPoint(A,B,C,margin,margin,clockwiseNormalVector)
outterOutline.push(K)
}
return outterOutline
}

@@ -11,3 +11,4 @@ import {

isClockWise,
calculateArea
calculateArea,
getConcaveOutline
} from '../../geometry'

@@ -77,3 +78,14 @@ import { maximumGapLimit } from '../../config'

polygon=updateMarginOutlinePolygon(polygon)
if(polygon.layer=="moduleField"){
let trimedOutline=[]
if(polygon.panels.length>0){
trimedOutline = getConcaveOutline(polygon.panels,polygon.panels[0].outline)
trimedOutline = trimedOutline.map(p=>{return{
x:p.x,
y:p.y,
z:verticalProjectionOnPlane(p,polygon.roof.normalVector,polygon.roof.flatOutline[0]).z
}})
}
polygon.trimedOutline = trimedOutline
}
return polygon

@@ -80,0 +92,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc