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.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Polygon(board, vertices, attributes)
Creates a new instance of JXG.Polygon.
|
Field Attributes | Field Name and Description |
---|---|
If true, moving the mouse over inner points triggers hasPoint.
|
|
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 Attributes | Field Name and Description |
---|---|
References to the border lines of the polygon.
|
|
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 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.
|
|
return TextAnchor
|
|
hasPoint(x, y)
Checks whether (x,y) is near the polygon.
|
|
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
|
|
Make the element visible.
|
|
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.
Defined in: Options.js.
- Default Value:
- false
{Boolean}
withLines
Is the polygon bordered by lines?
Defined in: Options.js.
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.
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.