summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/shapes/regionlist.js
blob: 1f2810ff320376fcdbdf1c49c34010a242b13041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var RegionList = (function(){

  var RegionList = {}
  var regions = RegionList.regions
  
  RegionList.init = function(){
  }
  
  RegionList.build = function(){
    var segments = shapes.getAllSegments()
    segments.forEach(function(segment){
      if (segment[0][0] == segment[1][0]) {
        if (segment[0][1] > segment[1][1]) {
          segment.push(segment.shift())
        }
      }
      else if (segment[0][1] == segment[1][1]) {
        if (segment[0][0] > segment[1][0]) {
          segment.push(segment.shift())
        }
      }
    })
    segments = segments.sort(function(a,b){
      return a[0][0] < b[0][0]
    })
    
    console.log(segments)
    
    // get a list of all segments from these polylines
    // re-orientate them so they're either facing up or right
    // loop over them from left to right
    // 
  }
  
  return RegionList
  
})()