summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/engine/shapes/regionlist.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/rectangles/engine/shapes/regionlist.js')
-rw-r--r--public/assets/javascripts/rectangles/engine/shapes/regionlist.js37
1 files changed, 37 insertions, 0 deletions
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