'use strict';

var p = require('./polygon');

function circle (position, radius) {
  return {
    position: position,
    radius: radius
  };
}

function polygon (position, points) {
  var poly = {
    position: position,
    angle: 0,
    offset: {x: 0, y: 0}
  };

  return p.setPoints(poly, points);
}

function tlBox (position, w, h) {
  return polygon(position, [
    {x: 0, y: 0}, {x: w, y: 0},
    {x: w, y: h}, {x: 0, y: h}
  ]);
}

function cBox (position, w, h) {
  var hw = w/2;
  var hh = h/2;

  return polygon(position, [
    {x: -hw, y: +hh}, {x: +hw, y: +hh},
    {x: +hw, y: -hh}, {x: -hw, y: -hh}
  ]);
}

function tlSquare (position, d) {
  return tlBox(position, d, d);
}

function cSquare (position, d) {
  return cBox(position, d, d);
}

function triangle (position, d) {
  return polygon(position, [{x: 0, y: 0}, {x: d, y: 0}, {x: 0, y: d}]);
}

module.exports = {
  circle: circle,
  tlSquare: tlSquare,
  tlBox: tlBox,
  tlRectangle: tlBox,
  cSquare: cSquare,
  cBox: cBox,
  cRectangle: cBox,
  polygon: polygon,
  triangle: triangle
};
@@ -58,22 +58,19 @@
 rcle (po
-sition
+int
 , radius
@@ -96,30 +96,27 @@
 position: po
-sition
+int
 ,%0A    radius
@@ -152,22 +152,19 @@
 ygon (po
-sition
+int
 , points
@@ -198,22 +198,19 @@
 tion: po
-sition
+int
 ,%0A    an
@@ -301,30 +301,27 @@
 on tlBox (po
-sition
+int
 , w, h) %7B%0A  
@@ -329,38 +329,35 @@
 eturn polygon(po
-sition
+int
 , %5B%0A    %7Bx: 0, y
@@ -433,22 +433,19 @@
 cBox (po
-sition
+int
 , w, h) 
@@ -498,22 +498,19 @@
 lygon(po
-sition
+int
 , %5B%0A    
@@ -606,38 +606,35 @@
 ion tlSquare (po
-sition
+int
 , d) %7B%0A  return 
@@ -637,30 +637,27 @@
 urn tlBox(po
-sition
+int
 , d, d);%0A%7D%0A%0A
@@ -672,30 +672,27 @@
  cSquare (po
-sition
+int
 , d) %7B%0A  ret
@@ -702,22 +702,19 @@
  cBox(po
-sition
+int
 , d, d);
@@ -738,22 +738,19 @@
 ngle (po
-sition
+int
 , d) %7B%0A 
@@ -767,22 +767,19 @@
 lygon(po
-sition
+int
 , %5B%7Bx: 0

rename position to point where applicable