From a4a001668f9f05272a4fbc28567b259ee45ada97 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 20 Aug 2015 13:21:44 -0400 Subject: RegionList --- .../rectangles/engine/shapes/regionlist.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 public/assets/javascripts/rectangles/engine/shapes/regionlist.js (limited to 'public/assets/javascripts/rectangles/engine/shapes/regionlist.js') diff --git a/public/assets/javascripts/rectangles/engine/shapes/regionlist.js b/public/assets/javascripts/rectangles/engine/shapes/regionlist.js new file mode 100644 index 0000000..1f2810f --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/shapes/regionlist.js @@ -0,0 +1,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 + +})() \ No newline at end of file -- cgit v1.2.3-70-g09d2