Changed SVG format. Changed from int. to double of points.
[chise/kage.git] / engine / polygon.js
1 function Polygon(number){\r
2   // resolution : 0.1\r
3   \r
4   // method\r
5   function push(x, y){ // void\r
6     var temp = new Object();\r
7     temp.x = Math.floor(x*10)/10;\r
8     temp.y = Math.floor(y*10)/10;\r
9     this.array.push(temp);\r
10   }\r
11   Polygon.prototype.push = push;\r
12   \r
13   function set(index, x, y){ // void\r
14     this.array[index].x = Math.floor(x*10)/10;\r
15     this.array[index].y = Math.floor(y*10)/10;\r
16   }\r
17   Polygon.prototype.set = set;\r
18   \r
19   function reverse(){ // void\r
20     this.array.reverse();\r
21   }\r
22   Polygon.prototype.reverse = reverse;\r
23   \r
24   function concat(poly){ // void\r
25     this.array = this.array.concat(poly.array);\r
26   }\r
27   Polygon.prototype.concat = concat;\r
28 \r
29   // property\r
30   this.array = new Array();\r
31   \r
32   // initialize\r
33   if(number){\r
34     for(var i = 0; i < number; i++){\r
35       this.push(0, 0);\r
36     }\r
37   }\r
38   \r
39   return this;\r
40 }\r