Home :: GUI :: Shapes

  1. Introduction
  2. Reference
    1. Methods
      1. constructor
      2. init
      3. realize
      4. refresh
      5. registerHandles
      6. unregisterHandles
      7. selectHandles
      8. showHandles
      9. getIntersectionParams
      10. pointInPolygon
      11. getArea
      12. isClockwise
      13. isCounterClockwise
      14. isConcave
      15. isConvex
    2. Properties
      1. handles
  3. Example
  4. Download

Polygon is a JavaScript object that allows you to adjust a polygon by manipulating Handles: one for each vertex of the polygon. This code is used in the 2D Geometry section of this site

Polygon is a sub-class of the Shape object.


Reference

Methods

constructor - new Polygon(svgNode);

init(svgNode);

realize();

refresh();

registerHandles();

unregisterHandles();

selectHandles();

showHandles();

getIntersectionParams() : IntersectionParams;

pointInPolygon(point) : boolean;

getArea() : float;

isClockwise() : boolean;

isCounterClockwise() : boolean;

isConcave() : boolean;

isConvex() : boolean;

setCallback(callback);

Properties


Example

This example allows you to adjust the vertices of the polygons within the SVG document. Here is a brief summary of the editing procedures:


Download

Polygon.js - the polygon object only...cannot be used in isolation

2D.js.gz - all objects needed to use this object and other 2D geometry objects