@eturnity/eturnity_maths 1.0.4 → 1.0.6

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": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "author": "Eturnity Team",
5
5
  "main": "src/index.js",
6
6
  "private": false,
@@ -224,7 +224,13 @@ export class Polygon {
224
224
  module_tilt_degrees: this.data.module_tilt_degrees,
225
225
  user_deactivated_modules: user_deactivated_modules,
226
226
  base_line_index: this.data.base_line_index,
227
- justify_percent: this.data.justify_percent
227
+ justify_percent: this.data.justify_percent,
228
+
229
+ number_of_panels_overrid:this.data.number_of_panels_override,
230
+ number_of_panel:this.data.number_of_panels,
231
+ yearly_yield_manual_entr:this.data.yearly_yield_manual_entry,
232
+ yearly_yield_kwh_kw:this.data.yearly_yield_kwh_kwp,
233
+ yearly_yield_kwh_kwp_2:this.data.yearly_yield_kwh_kwp_2
228
234
  }
229
235
  } else if (['panel', 'user_deactivated_panel'].includes(this.layer)) {
230
236
  return {
@@ -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
- outline = outline.map((p) => {
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 altitudeOffset = Math.min(...outline.map((p) => p.z))
38
- if (altitudeOffset < 0) {
39
- outline.forEach((p) => (p.z -= altitudeOffset))
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
- outline.forEach((p) => (p.z = Math.max(0, Math.min(p.z, 50000))))
43
+ newOutline.forEach((p) => (p.z = Math.max(0, Math.min(p.z, 50000))))
43
44
 
44
- return outline
45
+ return newOutline
45
46
  }
46
47
  export function updateComputedGeometryPolygon(polygon) {
47
48
  if(!['roof','obstacle','moduleField'].includes(polygon.layer)){