+++ /dev/null
-function Polygon(number){\r
- // resolution : 0.1\r
- \r
- // method\r
- function push(x, y, off){ // void\r
- var temp = new Object();\r
- temp.x = Math.floor(x*10)/10;\r
- temp.y = Math.floor(y*10)/10;\r
- if(off != 1){\r
- off = 0;\r
- }\r
- temp.off = off;\r
- this.array.push(temp);\r
- }\r
- Polygon.prototype.push = push;\r
- \r
- function set(index, x, y, off){ // void\r
- this.array[index].x = Math.floor(x*10)/10;\r
- this.array[index].y = Math.floor(y*10)/10;\r
- if(off != 1){\r
- off = 0;\r
- }\r
- this.array[index].off = off;\r
- }\r
- Polygon.prototype.set = set;\r
- \r
- function reverse(){ // void\r
- this.array.reverse();\r
- }\r
- Polygon.prototype.reverse = reverse;\r
- \r
- function concat(poly){ // void\r
- this.array = this.array.concat(poly.array);\r
- }\r
- Polygon.prototype.concat = concat;\r
- \r
- function shift(){ // void\r
- this.array.shift();\r
- }\r
- Polygon.prototype.shift = shift;\r
- \r
- function unshift(x, y, off){ // void\r
- var temp = new Object();\r
- temp.x = Math.floor(x*10)/10;\r
- temp.y = Math.floor(y*10)/10;\r
- if(off != 1){\r
- off = 0;\r
- }\r
- temp.off = off;\r
- this.array.unshift(temp);\r
- }\r
- Polygon.prototype.unshift = unshift;\r
- \r
- // property\r
- this.array = new Array();\r
- \r
- // initialize\r
- if(number){\r
- for(var i = 0; i < number; i++){\r
- this.push(0, 0, 0);\r
- }\r
- }\r
- \r
- return this;\r
-}\r