@eturnity/eturnity_3d 6.34.0 → 6.34.1

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.
Files changed (41) hide show
  1. package/.editorconfig +5 -0
  2. package/package.json +8 -4
  3. package/src/App.vue +16 -16
  4. package/src/assets/theme.js +4 -4
  5. package/src/components/ThreeCanvasViewer.vue +56 -43
  6. package/src/config.js +139 -65
  7. package/src/helper/MapView.js +214 -241
  8. package/src/helper/UpdateRoofModuleFieldRelations.js +17 -23
  9. package/src/helper/UpdateRoofObstacleRelations.js +48 -41
  10. package/src/helper/cameraMixin.js +97 -93
  11. package/src/helper/customProvider.js +28 -28
  12. package/src/helper/materialMixin.js +86 -70
  13. package/src/helper/materials.js +64 -49
  14. package/src/helper/render/background.js +2 -5
  15. package/src/helper/render/base.js +43 -40
  16. package/src/helper/render/clear.js +96 -84
  17. package/src/helper/render/edge.js +59 -65
  18. package/src/helper/render/geometryHandler.js +166 -128
  19. package/src/helper/render/imageOverlay.js +157 -106
  20. package/src/helper/render/index.js +21 -3
  21. package/src/helper/render/loader.js +34 -34
  22. package/src/helper/render/mapProjection.js +88 -74
  23. package/src/helper/render/margin.js +46 -50
  24. package/src/helper/render/moduleField.js +26 -24
  25. package/src/helper/render/node.js +43 -43
  26. package/src/helper/render/obstacle.js +50 -48
  27. package/src/helper/render/panel.js +85 -79
  28. package/src/helper/render/projectionMaterial.js +58 -50
  29. package/src/helper/render/roof.js +136 -133
  30. package/src/helper/render/texture.js +17 -17
  31. package/src/helper/render/tile.js +291 -0
  32. package/src/helper/renderMixin.js +30 -37
  33. package/src/helper/threeMixin.js +40 -101
  34. package/src/main.js +22 -18
  35. package/src/store/AddMargin.js +87 -83
  36. package/src/store/hydrateData.js +40 -30
  37. package/src/store/nodesEdgesCreation.js +177 -160
  38. package/src/store/three-d-module.js +41 -27
  39. package/src/utils/cancellablePromise.js +23 -0
  40. package/.eslintrc.json +0 -18
  41. package/src/helper/geo-three.module.js +0 -1903
@@ -7,17 +7,6 @@ export default {
7
7
  mixins: [renderMixin, cameraMixin],
8
8
  data() {
9
9
  return {
10
- meshes: {
11
- baseMeshes: {},
12
- roofMeshes: {},
13
- flatRoofMeshes: {},
14
- obstacleMeshes: {},
15
- panelsMeshes: {},
16
- nodeMeshes: null,
17
- edgeMeshes: {},
18
- roofMarginMeshes: {},
19
- moduleFieldsMeshes: {}
20
- },
21
10
  lastTic: new Date().getTime() * 1e4,
22
11
  //lastTic:(new Date()).getTime()
23
12
  lastGeometryEventIdDone: -1,
@@ -34,7 +23,8 @@ export default {
34
23
  nodeMeshes: null,
35
24
  edgeMeshes: {},
36
25
  roofMarginMeshes: {},
37
- moduleFieldsMeshes: {}
26
+ moduleFieldsMeshes: {},
27
+ tileMeshes: {}
38
28
  }
39
29
  },
40
30
 
@@ -46,7 +36,6 @@ export default {
46
36
  selectedMapLayer: (state) => state.threeDModule.selectedMapLayer,
47
37
  panelOpacity: (state) => state.threeDModule.panelOpacity,
48
38
  pvDataMemo: (state) => state.threeDModule.pvDataMemo
49
-
50
39
  }),
51
40
  ...mapGetters({
52
41
  selectedTool: 'getSelectedTool',
@@ -198,8 +187,8 @@ export default {
198
187
  break
199
188
  case 'backgroundTextureChange':
200
189
  methodList.push({
201
- name: 'initialiseThreeMap',
202
- method: this.initialiseThreeMap,
190
+ name: 'renderTiles',
191
+ method: this.renderTiles,
203
192
  arg: []
204
193
  })
205
194
  break
@@ -214,23 +203,28 @@ export default {
214
203
  method: this.applyTextureOnRoofs,
215
204
  arg: []
216
205
  })
206
+ methodList.push({
207
+ name: 'renderTiles',
208
+ method: this.renderTiles,
209
+ arg: []
210
+ })
217
211
  break
218
- // methodList.push({
219
- // name: 'removeImageOverlay',
220
- // method: this.removeImageOverlay,
221
- // arg: []
222
- // })
223
- // methodList.push({
224
- // name: 'applyTextureOnBackground',
225
- // method: this.renderImageOverlayOnBackground,
226
- // arg: []
227
- // })
228
- // methodList.push({
229
- // name: 'applyTextureOnRoofs',
230
- // method: this.applyTextureOnRoofs,
231
- // arg: []
232
- // })
233
- // break
212
+ // methodList.push({
213
+ // name: 'removeImageOverlay',
214
+ // method: this.removeImageOverlay,
215
+ // arg: []
216
+ // })
217
+ // methodList.push({
218
+ // name: 'applyTextureOnBackground',
219
+ // method: this.renderImageOverlayOnBackground,
220
+ // arg: []
221
+ // })
222
+ // methodList.push({
223
+ // name: 'applyTextureOnRoofs',
224
+ // method: this.applyTextureOnRoofs,
225
+ // arg: []
226
+ // })
227
+ // break
234
228
  case 'removeImageOverlay':
235
229
  case 'changeImageOverlay':
236
230
  case 'updateImageOverlay':
@@ -270,8 +264,8 @@ export default {
270
264
  this.renderEdges()
271
265
  this.renderFlatRoofs()
272
266
  },
273
-
274
- async initializeProjectionMaterial(){
267
+
268
+ async initializeProjectionMaterial() {
275
269
  await this.updateProjectionMaterials()
276
270
  this.applyTextureOnRoofs()
277
271
  },
@@ -362,10 +356,9 @@ export default {
362
356
  this.scene = null
363
357
  this.camera = null
364
358
  this.cameraprojection = null
365
- Object.values(this.material).forEach((m) =>{
366
- if(m && m.dispose)
367
- m.dispose()
368
- } )
359
+ Object.values(this.material).forEach((m) => {
360
+ if (m && m.dispose) m.dispose()
361
+ })
369
362
  this.material = null
370
363
  this.orbitControl = null
371
364
  this.raycaster = null
@@ -1,79 +1,14 @@
1
1
  import * as THREE from 'three'
2
2
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
3
3
  import { Sky } from 'three/examples/jsm/objects/Sky.js'
4
- import {UnitsUtils,MapView} from './geo-three.module.js'
5
- import {CustomProvider} from './customProvider'
4
+ import { CustomProvider } from './customProvider'
6
5
 
7
6
  export default {
8
- methods:{
9
- initialiseThreeMap(){
10
- if(this.three_map){
11
- this.three_map.clear()
12
- this.scene.remove(this.three_map)
13
- this.clearThreeObjects(this.three_map)
14
- }
15
- if(this.background_map){
16
- this.background_map.clear()
17
- this.scene.remove(this.background_map)
18
- this.clearThreeObjects(this.background_map)
19
- }
20
- this.background_map=new THREE.Group();
7
+ methods: {
8
+ initialiseThreeMap() {
21
9
  //Extention of the map with geo-map
22
- if(this.selectedMapLayer && !['googleLayerRoadmap','googleLayer','googleLayerTerrain'].includes(this.selectedMapLayer.key)){
23
- this.provider = new CustomProvider('',this.selectedMapLayer.key);
24
- // Create the map view and add it to your THREE scene
25
- this.three_map = new MapView(MapView.PLANAR, this.provider);
26
- this.three_map.rotateX(Math.PI / 2)
27
- const coef=Math.cos(this.layoutSettings.layout_latitude*Math.PI/180)
28
- this.three_map.scale.set(2*20015111.9287618*coef, 1, 2*20015111.9287618*coef);
29
- var coords = UnitsUtils.datumsToSpherical(this.layoutSettings.layout_latitude, this.layoutSettings.layout_longitude)
30
- this.three_map.position.set(-coords.x*coef,-coords.y*coef,0)
31
- this.scene.add(this.three_map)
32
- }else{
33
- let googleMapType='satellite'
34
- switch(this.selectedMapLayer.key){
35
- case 'googleLayerRoadmap':
36
- googleMapType='roadmap'
37
- break;
38
- case 'googleLayer':
39
- googleMapType='satellite'
40
- break;
41
- case 'googleLayerTerrain':
42
- googleMapType='terrain'
43
- break;
44
-
45
- }
46
-
47
- let apiKey = process.env.VUE_APP_GOOGLE_MAP_API_KEY
48
- let backgroundPlane=[]
49
- let size=640
50
- let planeGeometry=[]
51
- let planeMaterial=[]
52
- let texture=[]
53
- let zoomLevels=[19,16]
54
- for(let indexGoogleBackground=0;indexGoogleBackground<zoomLevels.length; indexGoogleBackground++){
55
- let zoomLevel=zoomLevels[indexGoogleBackground]
56
- let groundResolution = (Math.cos(this.layoutSettings.layout_latitude * Math.PI/180) * 2 * Math.PI * 6378137) / (256 * Math.pow(2,zoomLevel))
57
- let sizeInMeter=groundResolution*size
58
- planeGeometry[indexGoogleBackground] = new THREE.PlaneGeometry(sizeInMeter, sizeInMeter)
59
- let googleBackgroundUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${
60
- this.layoutSettings.layout_latitude +
61
- ',' +
62
- this.layoutSettings.layout_longitude
63
- }&maptype=${googleMapType}&zoom=${zoomLevel}&size=${size}x${size}&key=${apiKey}`
64
-
65
- texture[indexGoogleBackground] = this.loader.load(googleBackgroundUrl)
66
- planeMaterial[indexGoogleBackground] = new THREE.MeshBasicMaterial({
67
- map: texture[indexGoogleBackground],
68
- side: THREE.DoubleSide
69
- })
70
- backgroundPlane[indexGoogleBackground] = new THREE.Mesh(planeGeometry[indexGoogleBackground], planeMaterial[indexGoogleBackground])
71
- backgroundPlane[indexGoogleBackground].position.z = -indexGoogleBackground/2
72
- this.background_map.add(backgroundPlane[indexGoogleBackground])
73
- }
74
-
75
- }
76
- this.scene.add(this.background_map)
10
+ this.provider = new CustomProvider('', this.selectedMapLayer.key)
11
+ this.renderTiles()
77
12
  },
78
13
  initSky() {
79
14
  // Add Sky
@@ -83,69 +18,75 @@ export default {
83
18
  this.scene.add(sky)
84
19
  this.clearThreeObjects(sky)
85
20
  let sun = new THREE.Vector3()
86
-
21
+
87
22
  const uniforms = sky.material.uniforms
88
23
  uniforms.up.value = new THREE.Vector3(0, 0, 1)
89
24
  uniforms['turbidity'].value = 20
90
25
  uniforms['rayleigh'].value = 0.06
91
26
  uniforms['mieCoefficient'].value = 0.01
92
27
  uniforms['mieDirectionalG'].value = 0.1
93
- const elevation=10
94
- const azimuth=-20
28
+ const elevation = 10
29
+ const azimuth = -20
95
30
  const phi = THREE.MathUtils.degToRad(90 - elevation)
96
31
  const theta = THREE.MathUtils.degToRad(azimuth)
97
-
32
+
98
33
  sun.setFromSphericalCoords(1, phi, theta)
99
-
34
+
100
35
  uniforms['sunPosition'].value.copy(sun)
101
- sun=null
36
+ sun = null
102
37
  },
103
38
  initialiseThree(isInteractive = true) {
39
+ //this.loader.crossOrigin = null
104
40
 
105
- //this.loader.crossOrigin = null
106
-
107
41
  this.scene.background = new THREE.Color(0xb0b0b0)
108
42
 
109
43
  this.camera.position.set(0, -100, 50)
110
44
  this.camera.up.set(0, 0, 1)
111
-
112
- this.cameraprojection = new THREE.PerspectiveCamera(1, 300 / 300, 100, 1000)
45
+
46
+ this.cameraprojection = new THREE.PerspectiveCamera(
47
+ 1,
48
+ 300 / 300,
49
+ 100,
50
+ 1000
51
+ )
113
52
  this.cameraprojection.position.set(0, 0, 24)
114
53
  this.cameraprojection.up.set(0, 0, 1)
115
-
54
+
116
55
  // const helper = new THREE.CameraHelper( this.cameraprojection );
117
56
  // this.scene.add( helper );
118
-
57
+
119
58
  // const axesHelper = new THREE.AxesHelper( 20 );
120
59
  // this.scene.add( axesHelper );
121
60
  //Light
122
61
  const ambientLight = new THREE.AmbientLight(0xf0f0f0, 0.5)
123
62
  this.scene.add(ambientLight)
124
-
125
- var directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
126
- directionalLight.position.set(0, 1000, 500);
127
- var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);
128
- directionalLight2.position.set(0, -1000, 500);
129
- this.scene.add(directionalLight);
130
- this.scene.add(directionalLight2);
131
-
63
+
64
+ var directionalLight = new THREE.DirectionalLight(0xffffff, 0.5)
65
+ directionalLight.position.set(0, 1000, 500)
66
+ var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5)
67
+ directionalLight2.position.set(0, -1000, 500)
68
+ this.scene.add(directionalLight)
69
+ this.scene.add(directionalLight2)
70
+
132
71
  // this.renderer.setClearColor('#ffffff');
133
72
  this.renderer.setPixelRatio(window.devicePixelRatio)
134
73
  this.renderer.toneMappingExposure = 0.01
135
74
  this.$refs.canvas3DContainer.appendChild(this.renderer.domElement)
136
-
75
+
137
76
  //sky
138
77
  this.initSky()
139
- if(isInteractive){
140
- this.orbitControl=new OrbitControls(this.camera, this.renderer.domElement)
141
- this.orbitControl.maxPolarAngle=(Math.PI/2)*(87/90)
78
+ if (isInteractive) {
79
+ this.orbitControl = new OrbitControls(
80
+ this.camera,
81
+ this.renderer.domElement
82
+ )
83
+ this.orbitControl.maxPolarAngle = (Math.PI / 2) * (87 / 90)
142
84
  }
143
85
  window.addEventListener('resize', this.onWindowResize, false)
144
-
86
+
145
87
  ambientLight.dispose()
146
88
  directionalLight.dispose()
147
89
  directionalLight2.dispose()
148
-
149
90
  },
150
91
  onWindowResize() {
151
92
  this.camera.aspect = window.innerWidth / window.innerHeight
@@ -173,8 +114,6 @@ export default {
173
114
 
174
115
  // update any render target sizes here
175
116
  }
176
- },
177
-
178
- },
179
-
180
- }
117
+ }
118
+ }
119
+ }
package/src/main.js CHANGED
@@ -1,28 +1,32 @@
1
- import Vue from "vue";
1
+ import Vue from 'vue'
2
2
  import Vuex from 'vuex'
3
3
  import App from './App.vue'
4
4
  // import axios from 'axios'
5
5
  import threeDModule from './store/three-d-module'
6
6
 
7
-
8
7
  Vue.use(Vuex)
9
8
 
10
9
  const Renderer = class {
11
- constructor(){}
12
- mount(identifier,geometryData,specificData,isInteractive=false){
13
- const myStore = new Vuex.Store({
14
- modules:{
15
- threeDModule:{
16
- ...threeDModule,
17
- state:{...threeDModule.state,geometryData,...specificData,isInteractive}
18
- }
10
+ constructor() {}
11
+ mount(identifier, geometryData, specificData, isInteractive = false) {
12
+ const myStore = new Vuex.Store({
13
+ modules: {
14
+ threeDModule: {
15
+ ...threeDModule,
16
+ state: {
17
+ ...threeDModule.state,
18
+ geometryData,
19
+ ...specificData,
20
+ isInteractive
19
21
  }
20
- })
21
- this.App=new Vue({
22
- store:myStore,
23
- render: (h) => h(App),
24
- })
25
- this.App.$mount(identifier)
26
- }
22
+ }
23
+ }
24
+ })
25
+ this.App = new Vue({
26
+ store: myStore,
27
+ render: (h) => h(App)
28
+ })
29
+ this.App.$mount(identifier)
30
+ }
27
31
  }
28
- export {Renderer}
32
+ export { Renderer }
@@ -1,107 +1,111 @@
1
- import {
2
- multiplyVector,
3
- getMarginPoint,
4
- } from '@eturnity/eturnity_maths'
1
+ import { multiplyVector, getMarginPoint } from '@eturnity/eturnity_maths'
5
2
 
6
-
7
- export function updateMarginsOutline(state){
8
- state.polygons.filter(p=>p.layer=='roof').forEach(polygon=>{
9
- polygon=getRoofMarginOutline(polygon)
3
+ export function updateMarginsOutline(state) {
4
+ state.polygons
5
+ .filter((p) => p.layer == 'roof')
6
+ .forEach((polygon) => {
7
+ polygon = getRoofMarginOutline(polygon)
10
8
  })
11
- state.polygons.filter(p=>p.layer=='obstacle').forEach(polygon=>{
12
- polygon=getObstacleMarginOutline(polygon)
9
+ state.polygons
10
+ .filter((p) => p.layer == 'obstacle')
11
+ .forEach((polygon) => {
12
+ polygon = getObstacleMarginOutline(polygon)
13
13
  })
14
- return state
15
- }
14
+ return state
15
+ }
16
16
 
17
- export function updateMarginOutlinePolygon(polygon){
18
- if(polygon.layer=="roof"){
19
- return getRoofMarginOutline(polygon)
20
- }else if(polygon.layer=='obstacle'){
21
- return getObstacleMarginOutline(polygon)
22
- }else{
23
- return polygon
24
- }
17
+ export function updateMarginOutlinePolygon(polygon) {
18
+ if (polygon.layer == 'roof') {
19
+ return getRoofMarginOutline(polygon)
20
+ } else if (polygon.layer == 'obstacle') {
21
+ return getObstacleMarginOutline(polygon)
22
+ } else {
23
+ return polygon
25
24
  }
26
-
27
- export function getRoofMarginOutline(polygon){
28
-
29
- let clockwiseNormalVector=polygon.normalVector
30
- if(!polygon.isClockwise){
31
- clockwiseNormalVector=multiplyVector(-1,clockwiseNormalVector)
32
- }
33
- //outterOutline is the outline close to the wall
34
- polygon.margins.outterOutline=polygon.flatOutline
35
- polygon.margins.innerOutline=[]
36
- const length=polygon.margins.outterOutline.length
37
- for(let index=0;index<length;index++){
38
- const B=polygon.margins.outterOutline[index]
39
- //A,B,C three consecutive points on the polygon.
40
- //n is a vector in the plan normal to AB of length margin[A] directed towards the inside
41
- //m is a vector in the plan normal to BC of length margin[B] directed towards the inside
42
- //K is the margin outline linked with B
43
- const A=polygon.margins.outterOutline[(index-1+length)%length]
44
- const C=polygon.margins.outterOutline[(index+1)%length]
45
- //filling the margins values if not initiated.
46
- let marginA
47
- let marginB
48
- if(polygon.margins.isSameMargin){
49
- marginA=polygon.margins.sameMargin
50
- marginB=polygon.margins.sameMargin
51
- polygon.margins.distances[index]=polygon.margins.sameMargin
52
- }else{
53
- if(!polygon.margins.distances[(index-1+length)%length]===undefined){
54
- polygon.margins.distances[(index-1+length)%length]=polygon.margins.sameMargin
55
- }
56
- if(!polygon.margins.distances[index]===undefined){
57
- polygon.margins.distances[index]=polygon.margins.sameMargin
58
- }
59
- marginA=polygon.margins.distances[(index-1+length)%length]
60
- marginB=polygon.margins.distances[index]
25
+ }
26
+
27
+ export function getRoofMarginOutline(polygon) {
28
+ let clockwiseNormalVector = polygon.normalVector
29
+ if (!polygon.isClockwise) {
30
+ clockwiseNormalVector = multiplyVector(-1, clockwiseNormalVector)
31
+ }
32
+ //outterOutline is the outline close to the wall
33
+ polygon.margins.outterOutline = polygon.flatOutline
34
+ polygon.margins.innerOutline = []
35
+ const length = polygon.margins.outterOutline.length
36
+ for (let index = 0; index < length; index++) {
37
+ const B = polygon.margins.outterOutline[index]
38
+ //A,B,C three consecutive points on the polygon.
39
+ //n is a vector in the plan normal to AB of length margin[A] directed towards the inside
40
+ //m is a vector in the plan normal to BC of length margin[B] directed towards the inside
41
+ //K is the margin outline linked with B
42
+ const A = polygon.margins.outterOutline[(index - 1 + length) % length]
43
+ const C = polygon.margins.outterOutline[(index + 1) % length]
44
+ //filling the margins values if not initiated.
45
+ let marginA
46
+ let marginB
47
+ if (polygon.margins.isSameMargin) {
48
+ marginA = polygon.margins.sameMargin
49
+ marginB = polygon.margins.sameMargin
50
+ polygon.margins.distances[index] = polygon.margins.sameMargin
51
+ } else {
52
+ if (
53
+ !polygon.margins.distances[(index - 1 + length) % length] === undefined
54
+ ) {
55
+ polygon.margins.distances[(index - 1 + length) % length] =
56
+ polygon.margins.sameMargin
57
+ }
58
+ if (!polygon.margins.distances[index] === undefined) {
59
+ polygon.margins.distances[index] = polygon.margins.sameMargin
61
60
  }
62
- let K=getMarginPoint(A,B,C,marginA,marginB,clockwiseNormalVector)
63
- polygon.margins.innerOutline.push(K)
61
+ marginA = polygon.margins.distances[(index - 1 + length) % length]
62
+ marginB = polygon.margins.distances[index]
64
63
  }
65
- return polygon
64
+ let K = getMarginPoint(A, B, C, marginA, marginB, clockwiseNormalVector)
65
+ polygon.margins.innerOutline.push(K)
66
66
  }
67
+ return polygon
68
+ }
67
69
 
68
-
69
- export function getObstacleMarginOutline(polygon){
70
- let clockwiseNormalVector=polygon.normalVector
71
- if(polygon.isClockwise){
72
- clockwiseNormalVector=multiplyVector(-1,clockwiseNormalVector)
70
+ export function getObstacleMarginOutline(polygon) {
71
+ let clockwiseNormalVector = polygon.normalVector
72
+ if (polygon.isClockwise) {
73
+ clockwiseNormalVector = multiplyVector(-1, clockwiseNormalVector)
73
74
  }
74
75
  //outterOutline is the outline close to the wall
75
- polygon.margins.innerOutline=polygon.flatOutline
76
- polygon.margins.outterOutline=[]
77
- const length=polygon.margins.innerOutline.length
78
- for(let index=0;index<length;index++){
79
- const B=polygon.margins.innerOutline[index]
76
+ polygon.margins.innerOutline = polygon.flatOutline
77
+ polygon.margins.outterOutline = []
78
+ const length = polygon.margins.innerOutline.length
79
+ for (let index = 0; index < length; index++) {
80
+ const B = polygon.margins.innerOutline[index]
80
81
  //A,B,C three consecutive points on the polygon.
81
82
  //n is a vector in the plan normal to AB of length margin[A] directed towards the inside
82
83
  //m is a vector in the plan normal to BC of length margin[B] directed towards the inside
83
84
  //K is the margin outline linked with B
84
- const A=polygon.margins.innerOutline[(index-1+length)%length]
85
- const C=polygon.margins.innerOutline[(index+1)%length]
85
+ const A = polygon.margins.innerOutline[(index - 1 + length) % length]
86
+ const C = polygon.margins.innerOutline[(index + 1) % length]
86
87
  //filling the margins values if not initiated.
87
88
  let marginA
88
89
  let marginB
89
- if(polygon.margins.isSameMargin){
90
- marginA=polygon.margins.sameMargin
91
- marginB=polygon.margins.sameMargin
92
- polygon.margins.distances[index]=polygon.margins.sameMargin
93
- }else{
94
- if(polygon.margins.distances[(index-1+length)%length]===undefined){
95
- polygon.margins.distances[(index-1+length)%length]=polygon.margins.sameMargin
90
+ if (polygon.margins.isSameMargin) {
91
+ marginA = polygon.margins.sameMargin
92
+ marginB = polygon.margins.sameMargin
93
+ polygon.margins.distances[index] = polygon.margins.sameMargin
94
+ } else {
95
+ if (
96
+ polygon.margins.distances[(index - 1 + length) % length] === undefined
97
+ ) {
98
+ polygon.margins.distances[(index - 1 + length) % length] =
99
+ polygon.margins.sameMargin
96
100
  }
97
- if(polygon.margins.distances[index]===undefined){
98
- polygon.margins.distances[index]=polygon.margins.sameMargin
101
+ if (polygon.margins.distances[index] === undefined) {
102
+ polygon.margins.distances[index] = polygon.margins.sameMargin
99
103
  }
100
- marginA=polygon.margins.distances[(index-1+length)%length]
101
- marginB=polygon.margins.distances[index]
104
+ marginA = polygon.margins.distances[(index - 1 + length) % length]
105
+ marginB = polygon.margins.distances[index]
102
106
  }
103
- let K=getMarginPoint(A,B,C,marginA,marginB,clockwiseNormalVector)
107
+ let K = getMarginPoint(A, B, C, marginA, marginB, clockwiseNormalVector)
104
108
  polygon.margins.outterOutline.push(K)
105
109
  }
106
110
  return polygon
107
- }
111
+ }