@eturnity/eturnity_maths 1.0.4 → 1.0.5
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
|
@@ -29,19 +29,20 @@ export function updateOutlineFromInclineDirection(incline, direction, outline,in
|
|
|
29
29
|
Math.sin((incline * Math.PI) / 180) * Math.cos((direction * Math.PI) / 180)
|
|
30
30
|
newNormalVector.z = Math.cos((incline * Math.PI) / 180)
|
|
31
31
|
let meanPoint = meanVector(outline)
|
|
32
|
+
let minAltitude=Math.min(...outline.map(p=>p.z))
|
|
32
33
|
meanPoint.z=initialAverageHeight
|
|
33
|
-
|
|
34
|
+
let newOutline = outline.map((p) => {
|
|
34
35
|
return verticalProjectionOnPlane(p, newNormalVector, meanPoint)
|
|
35
36
|
})
|
|
36
37
|
//if some points are with negative altitude, we offset the whole roof
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const newMinAltitude = Math.min(...newOutline.map((p) => p.z))
|
|
39
|
+
let altitudeOffset=newMinAltitude-minAltitude
|
|
40
|
+
newOutline.forEach((p) => (p.z -= altitudeOffset))
|
|
41
|
+
|
|
41
42
|
//if some points are with altitude>50000, we limit those points
|
|
42
|
-
|
|
43
|
+
newOutline.forEach((p) => (p.z = Math.max(0, Math.min(p.z, 50000))))
|
|
43
44
|
|
|
44
|
-
return
|
|
45
|
+
return newOutline
|
|
45
46
|
}
|
|
46
47
|
export function updateComputedGeometryPolygon(polygon) {
|
|
47
48
|
if(!['roof','obstacle','moduleField'].includes(polygon.layer)){
|