Class Index | File Index

Classes


Class JXG.Line


Extends JXG.GeometryElement.
Creates a new basic line object. Do not use this constructor to create a line. Use JXG.Board#create with type Line, Arrow, or Axis instead.
Defined in: Line.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
JXG.Line(board, p1, p2, id, name, withLabel, layer)
The Line class is a basic class for all kind of line objects, e.g.
Field Summary
Field Attributes Field Name and Description
 
Reference of the ticks created automatically when constructing an axis.
 
Determines if a line has an arrow at #point1.
 
Determines if a line has an arrow at #point1.
 
Startpoint of the line.
 
Endpoint of the line.
 
Determines if a line is drawn beyond #point1.
 
Determines if a line is drawn beyond #point2.
 
Array of ticks storing all the ticks on this line.
Fields borrowed from class JXG.GeometryElement:
ancestors, board, childElements, dash, descendants, draft, fillColor, fillOpacity, fixed, hasLabel, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isReal, layer, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, symbolic, trace, traces, transformations, visible, visProp
Method Summary
Method Attributes Method Name and Description
 
addTicks(ticks)
Adds ticks to this line.
 
addTransform(transform)
DESCRIPTION
 
cloneToBackground(addToTrace)
Clone the element to the background to leave a trail of it on the board.
 
Calculates the rise of the line.
 
Calculates the slope of the line.
 
hasPoint(x, y)
Checks whether (x,y) is near the line.
 
Removes all ticks from a line.
 
Removes ticks identified by parameter named tick from this line.
 
setPosition(method, x, y)
TODO DESCRIPTION.
 
X(phi)
Treat the line as parametric curve in homogeneuous coordinates.
 
Y(phi)
Treat the line as parametric curve in homogeneous coordinates.
 
Z(phi)
Treat the line as parametric curve in homogeneous coordinates.
Methods borrowed from class JXG.GeometryElement:
addChild, addLabelToElement, animate, clearTrace, hideElement, highlight, labelColor, noHighlight, remove, setArrow, setProperty, showElement, update
Class Detail
JXG.Line(board, p1, p2, id, name, withLabel, layer)
The Line class is a basic class for all kind of line objects, e.g. line, arrow, and axis. It is usually defined by two points and can be intersected with some other geometry elements.
Parameters:
{String|JXG.Board} board
The board the new line is drawn on.
{Point} p1
Startpoint of the line.
{Point} p2
Endpoint of the line.
{String} id
Unique identifier for this object. If null or an empty string is given, an unique id will be generated by Board
{String} name
Not necessarily unique name. If null or an empty string is given, an unique name will be generated.
{boolean} withLabel
construct label, yes/no
{integer} layer
display layer [0-9]
See:
JXG.Board#generateName
Field Detail
{JXG.Ticks} defaultTicks
Reference of the ticks created automatically when constructing an axis.
See:
JXG.Ticks

{boolean} firstArrow
Determines if a line has an arrow at #point1.
See:
JXG.Line#lastArrow
Default Value:
JXG.Options.line#firstArrow

{boolean} lastArrow
Determines if a line has an arrow at #point1.
See:
JXG.Line#firstArrow
Default Value:
JXG.Options.line#lastArrow

{JXG.Point} point1
Startpoint of the line. You really should not set this field directly as it may break JSXGraph's udpate system so your construction won't be updated properly.

{JXG.Point} point2
Endpoint of the line. Just like #point1 you shouldn't write this field directly.

{boolean} straightFirst
Determines if a line is drawn beyond #point1.
See:
JXG.Line#straightLast
Default Value:
JXG.Options.line#straightFirst

{boolean} straightLast
Determines if a line is drawn beyond #point2.
See:
JXG.Line#straightFirst
Default Value:
JXG.Options.line#straightLast

{array} ticks
Array of ticks storing all the ticks on this line. Do not set this field directly and use #addTicks and #removeTicks to add and remove ticks to and from the line.
See:
JXG.Ticks
Method Detail
{String} addTicks(ticks)
Adds ticks to this line. Ticks can be added to any kind of line: line, arrow, and axis.
Parameters:
{JXG.Ticks} ticks
Reference to a ticks object which is describing the ticks (color, distance, how many, etc.).
Returns:
Id of the ticks object.

addTransform(transform)
DESCRIPTION
Parameters:
{JXG.Transformation|array} transform
A #JXG.Transformation object or an array of it.

cloneToBackground(addToTrace)
Clone the element to the background to leave a trail of it on the board.
Parameters:
{boolean} addToTrace
Not used.

{float} getRise()
Calculates the rise of the line.
Returns:
The rise of the line.

{float} getSlope()
Calculates the slope of the line.
Returns:
The slope of the line or Infinity if the line is parallel to the y-axis.

{boolean} hasPoint(x, y)
Checks whether (x,y) is near the line.
Parameters:
{int} x
Coordinate in x direction, screen coordinates.
{int} y
Coordinate in y direction, screen coordinates.
Returns:
{boolean} True if (x,y) is near the line, False otherwise.

removeAllTicks()
Removes all ticks from a line.

removeTicks(tick)
Removes ticks identified by parameter named tick from this line.
Parameters:
{JXG.Ticks} tick
Reference to tick object to remove.

setPosition(method, x, y)
TODO DESCRIPTION. What is this method for? -- michael
Parameters:
method
TYPE & DESCRIPTION. UNUSED.
x
TYPE & DESCRIPTION
y
TYPE & DESCRIPTION

{float} X(phi)
Treat the line as parametric curve in homogeneuous coordinates.
x = 1 * sin(theta)*cos(phi)
y = 1 * sin(theta)*sin(phi)
z = 1 * sin(theta)
and the line is the set of solutions of a*x+b*y+c*z = 0. It follows:
sin(theta)*(a*cos(phi)+b*sin(phi))+c*cos(theta) = 0
Define:
  A = (a*cos(phi)+b*sin(phi))
  B = c
Then
cos(theta) = A/sqrt(A*A+B*B)
sin(theta) = -B/sqrt(A*A+B*B)
and X(phi) = x from above. phi runs from 0 to 1
Parameters:
phi
Returns:
X(phi) TODO description

{float} Y(phi)
Treat the line as parametric curve in homogeneous coordinates. See #X for a detailed description.
Parameters:
phi
Returns:
Y(phi) TODO description

{float} Z(phi)
Treat the line as parametric curve in homogeneous coordinates. See #X for a detailed description.
Parameters:
phi
Returns:
Z(phi) TODO description

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Oct 25 2011 00:43:19 GMT-0000 (UTC)