|  | @@ -88,7 +88,8 @@ export default {
 | 
	
		
			
				|  |  |      // }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.parsePoints()
 | 
	
		
			
				|  |  | -    this.getSalientPoints()
 | 
	
		
			
				|  |  | +    // this.getSalientPoints()
 | 
	
		
			
				|  |  | +    this.getJarvisEnvelopeConvexe()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      if (this.salientPoints.length > 3) { // do not build item if it doesn't get enougth salient points
 | 
	
		
			
				|  |  |        if (this.canvasMap) {
 | 
	
	
		
			
				|  | @@ -229,6 +230,57 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        // console.log(`this.salientPoints ${this.concernement.id}`, this.salientPoints);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    getJarvisEnvelopeConvexe(){
 | 
	
		
			
				|  |  | +      // https://www.geeksforgeeks.org/convex-hull-using-jarvis-algorithm-or-wrapping/
 | 
	
		
			
				|  |  | +      // the most left point
 | 
	
		
			
				|  |  | +      let l = 0, min_x = null;
 | 
	
		
			
				|  |  | +      for (let i = 1; i < this.entites.length; i++) {
 | 
	
		
			
				|  |  | +        let entite = this.entites[i];
 | 
	
		
			
				|  |  | +        let x = entite.display.ray * Math.cos(entite.display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +        if(!min_x || min_x > x){
 | 
	
		
			
				|  |  | +          l = i;
 | 
	
		
			
				|  |  | +          min_x = x;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      let p = l, q;
 | 
	
		
			
				|  |  | +      do {
 | 
	
		
			
				|  |  | +        let entite = this.entites[p];
 | 
	
		
			
				|  |  | +        let farest = {
 | 
	
		
			
				|  |  | +          alpha: entite.display.alpha,
 | 
	
		
			
				|  |  | +          ray: entite.display.ray,
 | 
	
		
			
				|  |  | +          pos: {
 | 
	
		
			
				|  |  | +            x: (entite.display.ray) * Math.cos(entite.display.alpha * (Math.PI/180)),
 | 
	
		
			
				|  |  | +            y: (entite.display.ray) * Math.sin(entite.display.alpha * (Math.PI/180))
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +        this.salientPoints.push(farest);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        q = (p + 1) % this.entites.length;
 | 
	
		
			
				|  |  | +        for (let i = 0; i < this.entites.length; i++) {
 | 
	
		
			
				|  |  | +          let p_x = (this.entites[p].display.ray + 3) * Math.cos(this.entites[p].display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +          let p_y = (this.entites[p].display.ray + 3) * Math.sin(this.entites[p].display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +          let i_x = (this.entites[i].display.ray + 3) * Math.cos(this.entites[i].display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +          let i_y = (this.entites[i].display.ray + 3) * Math.sin(this.entites[i].display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +          let q_x = (this.entites[q].display.ray + 3) * Math.cos(this.entites[q].display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +          let q_y = (this.entites[q].display.ray + 3) * Math.sin(this.entites[q].display.alpha * (Math.PI/180));
 | 
	
		
			
				|  |  | +          
 | 
	
		
			
				|  |  | +          let val = (i_y - p_y) * (q_x - i_x) - (i_x - p_x) * (q_y - i_y);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          if (val > 0){
 | 
	
		
			
				|  |  | +            q = i;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // Now q is the most counterclockwise with
 | 
	
		
			
				|  |  | +        // respect to p. Set p as q for next iteration, 
 | 
	
		
			
				|  |  | +        // so that q is added to result 'hull'
 | 
	
		
			
				|  |  | +        p = q;
 | 
	
		
			
				|  |  | +      } while (p != l) {
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      initCanvasMap (){
 | 
	
		
			
				|  |  |        // console.log(`ConcernementsMapItem ${this.concernement.id} initCanvasMap`);
 | 
	
		
			
				|  |  |        // record canvas and ctx for rendering (drawing)
 |