lib/shape/PolygonShape.js
function PolygonShape(vertices) {
  if (!(this instanceof PolygonShape)) {
    return new PolygonShape(vertices);
  }

  PolygonShape._super.call(this);

  this.m_type = PolygonShape.TYPE;
  this.m_radius = Settings.polygonRadius;
  this.m_centroid = Vec2.zero();
  this.m_vertices = []; // Vec2[Settings.maxPolygonVertices]
  this.m_normals = []; // Vec2[Settings.maxPolygonVertices]
  this.m_count = 0;

  if (vertices && vertices.length) {
    this._set(vertices);
  }
}
function PolygonShape(vertices) {
  if (!(this instanceof PolygonShape)) {
    return new PolygonShape(vertices);
  }

  PolygonShape._super.call(this);

  this.m_type = PolygonShape.TYPE;
  this.m_radius = Settings.polygonRadius;
  this.m_centroid = Vec2.zero();
  this.m_vertices = []; // Vec2[Settings.maxPolygonVertices]
  this.m_normals = []; // Vec2[Settings.maxPolygonVertices]
  this.m_count = 0;

  if (vertices && vertices.length) {
    this._set(vertices);
  }
}
function PolygonShape ( vertices ) { if ( ! ( this instanceof PolygonShape ) ) { return new PolygonShape ( vertices ) ; } PolygonShape . _super . call ( this ) ; this . m_type = PolygonShape . TYPE ; this . m_radius = Settings . polygonRadius ; this . m_centroid = Vec2 . zero ( ) ; this . m_vertices = [ ] ; // Vec2[Settings.maxPolygonVertices] this . m_normals = [ ] ; // Vec2[Settings.maxPolygonVertices] this . m_count = 0 ; if ( vertices && vertices . length ) { this . _set ( vertices ) ; } }
A convex polygon. It is assumed that the interior of the polygon is to the
left of each edge. Polygons have a maximum number of vertices equal to
Settings.maxPolygonVertices. In most cases you should not need many vertices
for a convex polygon. extends Shape
A convex polygon . It is assumed that the interior of the polygon is to the left of each edge . Polygons have a maximum number of vertices equal to Settings . maxPolygonVertices . In most cases you should not need many vertices for a convex polygon . extends Shape