@eturnity/eturnity_3d 1.0.14-debug → 1.0.15

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "1.0.14-debug",
4
+ "version": "1.0.15",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  isInsidePolygon,
3
3
  verticalProjectionOnPlane,
4
- calculateArea,
5
- intersectOutlines
4
+ intersectOutlines,
5
+ calculateArea
6
6
  } from '@eturnity/eturnity_maths'
7
7
  //this function just update the "roof" and "moduleField(s)" properties of panels,moduleFields and roofs
8
8
  export function UpdateRoofModuleFieldRelations(state) {
@@ -30,7 +30,6 @@ export function UpdateRoofModuleFieldRelations(state) {
30
30
 
31
31
  for (let k in moduleFieldPolygons) {
32
32
  const moduleField = moduleFieldPolygons[k]
33
- //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
34
33
  const moduleFieldArea=calculateArea(moduleField.outline)
35
34
  //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
36
35
  let roofPolygonCandidates = roofPolygons.filter((roof) =>
@@ -39,13 +38,12 @@ export function UpdateRoofModuleFieldRelations(state) {
39
38
  moduleField.outline,
40
39
  roof.outline
41
40
  )
42
- console.log('inter:',intersection)
41
+ if(intersection.length==0) return false
43
42
  const intersectionArea=calculateArea(intersection[0])
44
- console.log(intersectionArea,0.9*moduleFieldArea,intersectionArea>0.9*moduleFieldArea)
45
43
  return intersectionArea>0.9*moduleFieldArea
44
+
46
45
  }
47
46
  )
48
- console.log(roofPolygonCandidates)
49
47
  //roofs on roof can lead to multiple roof under a point. moduleField is in the smallest
50
48
  let smallestRoof = null
51
49
  for (let roof of roofPolygonCandidates) {
@@ -54,30 +52,10 @@ export function UpdateRoofModuleFieldRelations(state) {
54
52
  }
55
53
  }
56
54
  let roofPolygon = smallestRoof
57
-
58
55
  if (!roofPolygon) {
59
56
  //no roof found under first node of moduleField => moduleField will be deleted
60
57
  continue
61
58
  }
62
- let moduleFieldBelongsToRoof = true
63
- moduleField.outline.forEach((p) => {
64
- const distanceToFlatRoof =
65
- p.z -
66
- verticalProjectionOnPlane(
67
- p,
68
- roofPolygon.normalVector,
69
- roofPolygon.flatOutline[0]
70
- ).z
71
- if (
72
- !isInsidePolygon(p, roofPolygon.margins.innerOutline) ||
73
- distanceToFlatRoof < -1 ||
74
- distanceToFlatRoof > 50
75
- ) {
76
- // one point from moduleField is not inside the roof or too far from it's flat surface => moduleField will be deleted
77
- moduleFieldBelongsToRoof = false
78
- }
79
- })
80
- if (moduleFieldBelongsToRoof) {
81
59
  roofPolygon.moduleFields.push(moduleField)
82
60
  moduleField.roof = roofPolygon
83
61
  moduleField.panels.forEach((panel) => (panel.roof = roofPolygon))
@@ -86,7 +64,7 @@ export function UpdateRoofModuleFieldRelations(state) {
86
64
  p.roof = roofPolygon
87
65
  }
88
66
  })
89
- }
67
+ //}
90
68
  }
91
69
 
92
70
  let newPolygons = state.polygons.map((p) => {