Class Line
JXG.GeometryElement
↳ JXG.Line
↳ Line
This element is used to provide a constructor for a general line. A general line is given by two points. By setting additional properties
a line can be used as an arrow and/or axis.
Defined in: line.js.
Extends
JXG.Line.
Constructor Attributes | Constructor Name and Description |
---|---|
Line(point1,point2, c,a,b, f)
|
- Fields borrowed from class JXG.Line:
- defaultTicks, parentPolygon
- Fields borrowed from class JXG.GeometryElement:
- _org_type, _pos, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, scalable, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, transitionDuration, type, visible, visProp, visPropCalc, withLabel
Field Attributes | Field Name and Description |
---|---|
Line has an arrow head at the position of its first point or the corresponding
intersection with the canvas border.
|
|
Attributes for the line label.
|
|
Line has an arrow head at the position of its second point or the corresponding
intersection with the canvas border.
|
|
Line endings (linecap) of a straight line.
|
|
Attributes for first defining point of the line.
|
|
Attributes for second defining point of the line.
|
|
Defines together with JXG.Point#snapSizeY the grid the point snaps on to.
|
|
Defines together with JXG.Point#snapSizeX the grid the point snaps on to.
|
|
If set to true, the point will snap to a grid defined by
JXG.Point#snapSizeX and JXG.Point#snapSizeY.
|
|
If true, line stretches infinitely in direction of its first point.
|
|
If true, line stretches infinitely in direction of its second point.
|
|
Attributes for ticks of the line.
|
|
If set to true and Line#firstArrow is set to true, the arrow head will just touch
the circle line of the start point of the line.
|
|
If set to true and Line#lastArrow is set to true, the arrow head will just touch
the circle line of the start point of the line.
|
- Fields borrowed from class JXG.Line:
- defaultTicks, parentPolygon
- Fields borrowed from class JXG.GeometryElement:
- _org_type, _pos, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, scalable, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, transitionDuration, type, visible, visProp, visPropCalc, withLabel
- Methods borrowed from class JXG.Line:
- addTicks, addTransform, generatePolynomial, getAngle, getRise, getSlope, hasPoint, L, maxX, minX, removeAllTicks, removeTicks, setLabelRelativeCoords, setStraight, updateRenderer, updateSegmentFixedLength, updateStdform, X, Y, Z
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addParents, addRotation, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, fullUpdate, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, handleSnapToGrid, hideElement, labelColor, noHighlight, normalize, prepareUpdate, remove, removeChild, removeDescendants, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, showElement, snapToPoints, update, updateVisibility
- Events borrowed from class JXG.GeometryElement:
- attribute, attribute:<attribute><attribute>, down, drag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, touchdown, touchdrag, touchup, up
Class Detail
Line(point1,point2, c,a,b, f)
- Parameters:
- {JXG.Point|array|function_JXG.Point|array|function} point1,point2
- Parent elements can be two elements either of type JXG.Point or array of numbers describing the coordinates of a point. In the latter case the point will be constructed automatically as a fixed invisible point. It is possible to provide a function returning an array or a point, instead of providing an array or a point.
- {Number|function_Number|function_Number|function} c,a,b
- A line can also be created providing three numbers. The line is then described by the set of solutions of the equation a*x+b*y+c*z = 0. It is possible to provide three functions returning numbers, too.
- {function} f
- This function must return an array containing three numbers forming the line's homogeneous coordinates.
Additionally, a line can be created by providing a line and a transformation (or an array of transformations). Then, the result is a line which is the transformation of the supplied line.
- Throws:
- {Exception}
- If the element cannot be constructed with the given parent objects an exception is thrown.
- Examples:
// Create a line using point and coordinates/ // The second point will be fixed and invisible. var p1 = board.create('point', [4.5, 2.0]); var l1 = board.create('line', [p1, [1.0, 1.0]]);
// Create a line using three coordinates var l1 = board.create('line', [1.0, -2.0, 3.0]);
// Create a line (l2) as reflection of another line (l1) // reflection line var li = board.create('line', [1,1,1], {strokeColor: '#aaaaaa'}); var reflect = board.create('transform', [li], {type: 'reflect'}); var l1 = board.create('line', [1,-5,1]); var l2 = board.create('line', [l1, reflect]);
Field Detail
{Boolean / Object}
firstArrow
Line has an arrow head at the position of its first point or the corresponding
intersection with the canvas border.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Label}
label
Attributes for the line label.
Defined in: options.js.
Defined in: options.js.
{Boolean / Object}
lastArrow
Line has an arrow head at the position of its second point or the corresponding
intersection with the canvas border.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
lineCap
Line endings (linecap) of a straight line.
Possible values are:
Defined in: options.js.
- 'butt',
- 'round',
- 'square'.
Defined in: options.js.
- Default Value:
- 'butt'
{Point}
point1
Attributes for first defining point of the line.
Defined in: options.js.
Defined in: options.js.
{Point}
point2
Attributes for second defining point of the line.
Defined in: options.js.
Defined in: options.js.
{Number}
snapSizeX
Defines together with JXG.Point#snapSizeY the grid the point snaps on to.
The point will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
If this value is equal to or less than 0, it will use the grid displayed by the major ticks
of the default ticks of the default x axes of the board.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- 1
{Number}
snapSizeY
Defines together with JXG.Point#snapSizeX the grid the point snaps on to.
The point will only snap on integer multiples to snapSizeX in x and snapSizeY in y direction.
If this value is equal to or less than 0, it will use the grid displayed by the major ticks
of the default ticks of the default y axes of the board.
Defined in: options.js.
Defined in: options.js.
- See:
- Point#snapToGrid
- Point#snapSizeX
- Board#defaultAxes
- Default Value:
- 1
{Boolean}
snapToGrid
If set to true, the point will snap to a grid defined by
JXG.Point#snapSizeX and JXG.Point#snapSizeY.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
{Boolean}
straightFirst
If true, line stretches infinitely in direction of its first point.
Otherwise it ends at point1.
Defined in: options.js.
Defined in: options.js.
- See:
- Line#straightLast
- Default Value:
- true
{Boolean}
straightLast
If true, line stretches infinitely in direction of its second point.
Otherwise it ends at point2.
Defined in: options.js.
Defined in: options.js.
- See:
- Line#straightFirst
- Default Value:
- true
{Ticks}
ticks
Attributes for ticks of the line.
Defined in: options.js.
Defined in: options.js.
{Boolean}
touchFirstPoint
If set to true and Line#firstArrow is set to true, the arrow head will just touch
the circle line of the start point of the line.
Defined in: options.js.
Defined in: options.js.
- See:
- Line#firstArrow
- Default Value:
- false
{Boolean}
touchLastPoint
If set to true and Line#lastArrow is set to true, the arrow head will just touch
the circle line of the start point of the line.
Defined in: options.js.
Defined in: options.js.
- See:
- Line#firstArrow
- Default Value:
- false