@eturnity/eturnity_maths
Advanced tools
Comparing version 6.29.0 to 6.30.0-qa-6.31.0
{ | ||
"name": "@eturnity/eturnity_maths", | ||
"version": "6.29.0", | ||
"version": "6.30.0-qa-6.31.0", | ||
"author": "Eturnity Team", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -78,5 +78,4 @@ import { | ||
let angle = Math.round( | ||
(Math.acos((a * a + b * b - c * c) / (2 * a * b)) * 180) / Math.PI | ||
) | ||
let angle = (Math.acos((a * a + b * b - c * c) / (2 * a * b)) * 180) / Math.PI | ||
//if 3 points are aligned | ||
@@ -86,2 +85,5 @@ if (isNaN(angle)) { | ||
} | ||
let sgn=-Math.sign(crossProduct(substractVector(H,I),substractVector(J,I)).z) | ||
angle=sgn*angle | ||
return angle | ||
@@ -88,0 +90,0 @@ } |
@@ -7,2 +7,3 @@ | ||
export * from './vector'; | ||
export * from './snap'; | ||
export * from './intersectionPolygon'; | ||
@@ -9,0 +10,0 @@ export * from './objects'; |
@@ -0,1 +1,2 @@ | ||
import { substractVector } from "./vector" | ||
export function inverse2x2Matrix([a, b, c, d]) { | ||
@@ -53,2 +54,7 @@ //inverse matrix |a,c| | ||
return product | ||
} | ||
export function rotateTransformation(point,angle,center){ | ||
let rotationMatrix=[[Math.cos(angle),Math.sin(angle)],[-Math.sin(angle),Math.cos(angle)]] | ||
let k=multiplyMatrices(rotationMatrix,[[point.x-center.x],[point.y-center.y]]) | ||
return {x:k[0][0]+center.x,y:k[1][0]+center.y} | ||
} |
@@ -24,3 +24,3 @@ import { | ||
} | ||
export function updateOutlineFromInclineDirection(incline, direction, outline,initialAverageHeight) { | ||
export function updateOutlineFromInclineDirection(incline, direction, outline,initialAverageHeight,isRoofOnRoof = false) { | ||
const newNormalVector = {} | ||
@@ -33,3 +33,2 @@ newNormalVector.x = | ||
let meanPoint = meanVector(outline) | ||
let minAltitude=Math.min(...outline.map(p=>p.z)) | ||
meanPoint.z=initialAverageHeight | ||
@@ -40,4 +39,12 @@ let newOutline = outline.map((p) => { | ||
//if some points are with negative altitude, we offset the whole roof | ||
const newMinAltitude = Math.min(...newOutline.map((p) => p.z)) | ||
let altitudeOffset=newMinAltitude-minAltitude | ||
let altitudeOffset | ||
let minAltitude=Math.min(...outline.map(p=>p.z)) | ||
let maxAltitude=Math.max(...outline.map(p=>p.z)) | ||
let newMinAltitude = Math.min(...newOutline.map((p) => p.z)) | ||
let newMaxAltitude = Math.max(...newOutline.map((p) => p.z)) | ||
if(isRoofOnRoof && maxAltitude!=0){ | ||
altitudeOffset=newMaxAltitude-maxAltitude | ||
}else{ | ||
altitudeOffset=newMinAltitude-minAltitude | ||
} | ||
newOutline.forEach((p) => (p.z -= altitudeOffset)) | ||
@@ -44,0 +51,0 @@ |
@@ -56,2 +56,9 @@ export function addVector(u, v) { | ||
return multiplyVector(1 / length, v) | ||
} | ||
export function normalize2DVector(v) { | ||
let length = vectorLength2D(v) | ||
if (length == 0) { | ||
return v | ||
} | ||
return multiplyVector(1 / length, v) | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
97489
26
3032
0
2