# JSXGraph Reference

## JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

## Elements

- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- Circumcirclesector
- Conic
- Curve
- Ellipse
- Functiongraph
- Glider
- Grid
- Hyperbola
- Image
- Incenter
- Incircle
- Integral
- Intersection
- Line
- Locus
- Midpoint
- Mirrorpoint
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelpoint
- Perpendicular
- Perpendicularpoint
- Point
- Polygon
- Reflection
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Tangent
- Text
- Ticks
- Tracecurve

## Classes

- _global_
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.C
- JXG.CanvasRenderer
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.Curve
- JXG.Dump
- JXG.GeometryElement
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Line
- JXG.Math
- JXG.Math.Geometry
- JXG.Math.Numerics
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.Point
- JXG.Polygon
- JXG.Server
- JXG.Server.modules
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Turtle
- JXG.Util
- JXG.VMLRenderer

# Class JXG.Polygon

JXG.GeometryElement
↳ JXG.Polygon

Polygon stores all style and functional properties that are required to draw and to interactact with a polygon.
Defined in: Polygon.js.
Extends JXG.GeometryElement.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.Polygon(board, vertices, attributes) Creates a new instance of JXG.Polygon.

Attributes Summary
Field Attributes | Field Name and Description
--- | ---
| hasInnerPoints If `true`, moving the mouse over inner points triggers hasPoint.
| withLines Is the polygon bordered by lines?

Fields borrowed from class JXG.GeometryElement:
  addEvent, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, eventHandlers, fillColor, fillOpacity, fixed, frozen, getAttribute, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel

Field Summary
Field Attributes | Field Name and Description
--- | ---
| borders References to the border lines of the polygon.
| vertices References to the points defining the polygon.

Fields borrowed from class JXG.GeometryElement:
  addEvent, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, eventHandlers, fillColor, fillOpacity, fixed, frozen, getAttribute, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel

Method Summary
Method Attributes | Method Name and Description
--- | ---
| addPoints(%) Add more points to the polygon.
| Area() returns the area of the polygon
| findPoint(p) Finds the index to a given point reference.
| getTextAnchor() return TextAnchor
| hasPoint(x, y) Checks whether (x,y) is near the polygon.
| hideElement() Hide the polygon including its border lines.
| insertPoints(i, %) Adds more points to the vertex list of the polygon, starting with index ``
| remove() This method removes the SVG or VML nodes of the lines and the filled area from the renderer, to remove the object completely you should use JXG.Board#removeObject.
| removePoints(%) Removes given set of vertices from the polygon
| showElement() Make the element visible.
| updateRenderer() Uses the boards renderer to update the polygon.

Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, generatePolynomial, getAttributes, getLabelAnchor, getName, getParents, getProperty, getType, labelColor, noHighlight, normalize, off, on, prepareUpdate, resolveShortcuts, setArrow, setAttribute, setDash, setLabelText, setProperty, setStraight, triggerEventHandlers, update

Class Detail
JXG.Polygon(board, vertices, attributes)
Creates a new instance of JXG.Polygon.

Parameters:
{JXG.Board} board
  Reference to the board the polygon is to be drawn on.
{Array} vertices
  Unique identifiers for the points defining the polygon. Last point must be first point. Otherwise, the first point will be added at the list.
{Object} attributes
  An object which contains properties as given in JXG.Options.elements and JXG.Options.polygon.

Attribute Detail
{Boolean} hasInnerPoints
If `true`, moving the mouse over inner points triggers hasPoint.
Defined in: Options.js.

See:
  JXG.GeometryElement#hasPoint

Default Value:
  false

{Boolean} withLines
Is the polygon bordered by lines?
Defined in: Options.js.

Default Value:
  true

Field Detail
{Array} borders
References to the border lines of the polygon.

{Array} vertices
References to the points defining the polygon. The last vertex is the same as the first vertex.
Method Detail
{JXG.Polygon} addPoints(%)
Add more points to the polygon. The new points will be inserted at the end.

Parameters:
{%} %
  Arbitrary number of points

Returns:
  {JXG.Polygon} Reference to the polygon

Area()
returns the area of the polygon

findPoint(p)
Finds the index to a given point reference.

Parameters:
{JXG.Point} p
  Reference to an element of type JXG.Point

getTextAnchor()
return TextAnchor

{Boolean} hasPoint(x, y)
Checks whether (x,y) is near the polygon.

Parameters:
{Number} x
  Coordinate in x direction, screen coordinates.
{Number} y
  Coordinate in y direction, screen coordinates.

Returns:
  {Boolean} Returns true, if (x,y) is inside or at the boundary the polygon, otherwise false.

hideElement()
Hide the polygon including its border lines. It will still exist but not visible on the board.

{JXG.Polygon} insertPoints(i, %)
Adds more points to the vertex list of the polygon, starting with index ``

Parameters:
{Number} i
  The position where the new vertices are inserted, starting with 0.
{%} %
  Arbitrary number of points to insert.

Returns:
  {JXG.Polygon} Reference to the polygon object

remove()
This method removes the SVG or VML nodes of the lines and the filled area from the renderer, to remove the object completely you should use JXG.Board#removeObject.

{JXG.Polygon} removePoints(%)
Removes given set of vertices from the polygon

Parameters:
{%} %
  Arbitrary number of vertices as JXG.Point elements or index numbers

Returns:
  {JXG.Polygon} Reference to the polygon

showElement()
Make the element visible.

updateRenderer()
Uses the boards renderer to update the polygon.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Apr 02 2012 17:54:09 GMT+0200 (MESZ)