xzw před 4 měsíci
rodič
revize
cc433efff1
1 změnil soubory, kde provedl 15 přidání a 7 odebrání
  1. 15 7
      src/custom/modules/panos/Panorama.js

+ 15 - 7
src/custom/modules/panos/Panorama.js

@@ -327,24 +327,32 @@ class Panorama extends THREE.EventDispatcher{
             this[type+'Tex'] = texture 
             if(getRangeFun){ 
                 if(type == 'ir'){ 
-                     
-                    let pixelCount = texture.image.width * texture.image.height
+                    let p = [range.minPixel_, range.maxPixel_].map(index=>{
+                        let row = Math.floor(index / texture.image.width)
+                        let col = index % texture.image.width
+                        return {x:col,y:row}
+                    })
+                    range.minPixel = p[0]
+                    range.maxPixel = p[1] 
+                    
+                    
+                     /* let pixelCount = texture.image.width * texture.image.height
                     const stopMemberCount = 50;
                     
                     
-                    (['min','max']).forEach(name =>{
+                   (['min','max']).forEach(name =>{
                         let value = range[name]
                         let groups = []
                         let isNeigh = (A,B)=>{
                             return (Math.abs(A.x - B.x)<=1 || Math.abs(A.x - B.x) == texture.image.width-1) && Math.abs(A.y - B.y)<=1
                         }
                         for(let i=0;i<pixelCount;i++){
-                            if(Math.abs(value - pixels[i]) < 5){
+                            if(Math.abs(value - pixels[i]) < 2 ){
                                 let row = Math.floor(i / texture.image.width)
                                 let col = i % texture.image.width
                                 let data = {x:col, y:row, value: pixels[i]}
-                                Potree.Common.pushToGroupAuto([data], groups, isNeigh/* , recognizeGroup */)
-                                if(groups.some(e=>e.length > stopMemberCount)){
+                                Potree.Common.pushToGroupAuto([data], groups, isNeigh )
+                                if(groups.some(e=>e.length > stopMemberCount && e.some(e=>e==range[name]))){
                                     break
                                 }
                             }
@@ -363,7 +371,7 @@ class Panorama extends THREE.EventDispatcher{
                         groups2.sort((b,a)=>{return a.score - b.score})
                         range[name+'Pixel'] = groups2[0]?.center  
                         console.log('groups2', this.id, name,groups2)
-                    })
+                    }) */
                     
                 }
                 range.min /= 10, range.max /= 10