@eturnity/eturnity_3d 1.0.13-debug → 1.0.14-debug

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.13-debug",
4
+ "version": "1.0.14-debug",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  isInsidePolygon,
3
3
  verticalProjectionOnPlane,
4
+ calculateArea,
5
+ intersectOutlines
4
6
  } from '@eturnity/eturnity_maths'
5
7
  //this function just update the "roof" and "moduleField(s)" properties of panels,moduleFields and roofs
6
8
  export function UpdateRoofModuleFieldRelations(state) {
@@ -29,12 +31,18 @@ export function UpdateRoofModuleFieldRelations(state) {
29
31
  for (let k in moduleFieldPolygons) {
30
32
  const moduleField = moduleFieldPolygons[k]
31
33
  //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
32
- const roofPolygonCandidates = roofPolygons.filter((roof) =>
34
+ const moduleFieldArea=calculateArea(moduleField.outline)
35
+ //check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
36
+ let roofPolygonCandidates = roofPolygons.filter((roof) =>
33
37
  {
34
- return moduleField.outline.every(p=>{
35
- console.log(p,roof.margins.innerOutline,isInsidePolygon(p, roof.margins.innerOutline))
36
- return isInsidePolygon(p, roof.margins.innerOutline)
37
- })
38
+ const intersection=intersectOutlines(
39
+ moduleField.outline,
40
+ roof.outline
41
+ )
42
+ console.log('inter:',intersection)
43
+ const intersectionArea=calculateArea(intersection[0])
44
+ console.log(intersectionArea,0.9*moduleFieldArea,intersectionArea>0.9*moduleFieldArea)
45
+ return intersectionArea>0.9*moduleFieldArea
38
46
  }
39
47
  )
40
48
  console.log(roofPolygonCandidates)