Class JXG.Point
Extends
JXG.GeometryElement.
Creates a new point object. Do not use this constructor to create a point. Use JXG.Board#create with
type Point, Glider, or Intersection instead.
Defined in: Point.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Point(board, coordinates, id, name, show, withLabel, layer)
A point is the basic geometric element.
|
Field Attributes | Field Name and Description |
---|---|
There are different point styles which differ in appearance.
|
|
False: Point can be moved, True: Point can't be moved with the mouse.
|
|
If true, the infobox is shown on mouse over, else not.
|
|
Determines the size of a point.
|
|
There are different point styles which differ in appearance and size.
|
- Fields borrowed from class JXG.GeometryElement:
- ancestors, board, childElements, dash, descendants, draft, fillColor, fillOpacity, 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 Attributes | Method Name and Description |
---|---|
addConstraint(terms)
Convert the point to CAS point and call update().
|
|
addTransform(el, transform)
TODO
|
|
cloneToBackground(addToTrace)
Copy the element to the background.
|
|
Dist(point2)
Getter method for the distance to a second point, this is required for CAS-elements.
|
|
makeGlider(glideObject)
Convert the point to glider and update the construction.
|
|
moveAlong(path, time)
Starts an animation which moves the point along a given path in given time.
|
|
moveTo(where, time)
Starts an animated point movement towards the given coordinates where.
|
|
All point faces can be defined with more than one name, e.g.
|
|
remove()
Remove the point from the drawing.
|
|
setPosition(method, x, y)
Sets x and y coordinate and calls the point's update() method.
|
|
setPositionByTransform(method, x, y)
TODO
|
|
setPositionDirectly(method, x, y)
Sets x and y coordinate and calls the point's update() method.
|
|
update(fromParent)
Updates the position of the point.
|
|
TODO
|
|
visit(where, time, repeat)
Starts an animated point movement towards the given coordinates where.
|
|
X()
Getter method for x, this is used by for CAS-points to access point coordinates.
|
|
Y()
Getter method for y, this is used by CAS-points to access point coordinates.
|
|
Z()
Getter method for z, this is used by CAS-points to access point coordinates.
|
- Methods borrowed from class JXG.GeometryElement:
- addChild, addLabelToElement, animate, clearTrace, hideElement, highlight, labelColor, noHighlight, setArrow, setProperty, showElement
Class Detail
JXG.Point(board, coordinates, id, name, show, withLabel, layer)
A point is the basic geometric element. Based on points lines and circles can be constructed which can be intersected
which in turn are points again which can be used to construct new lines, circles, polygons, etc. This class holds methods for
all kind of points like free points, gliders, and intersection points.
- Parameters:
- {string|JXG.Board} board
- The board the new point is drawn on.
- {Array} coordinates
- An array with the affine user coordinates of the point.
- {String} id
- Unique identifier for the point. If null or an empty string is given, an unique id will be generated by Board
- {String} name
- Not necessarily unique name for the point. If null or an empty string is given, an unique name will be generated
- {boolean} show
- False if the point is invisible, True otherwise
- withLabel
- layer
- See:
- JXG.Board#generateName
- JXG.Board#addPoint
Field Detail
{string}
face
There are different point styles which differ in appearance.
Posssible values are
Value |
---|
cross |
circle |
square |
plus |
diamond |
triangleUp |
triangleDown |
triangleLeft |
triangleRight |
- See:
- #setStyle
- Default Value:
- circle
{boolean}
fixed
False: Point can be moved, True: Point can't be moved with the mouse.
- Default Value:
- false
{boolean}
showInfobox
If true, the infobox is shown on mouse over, else not.
- Default Value:
- true
{number}
size
Determines the size of a point.
Means radius resp. half the width of a point (depending on the face).
- See:
- JXG.Point#face
- #setStyle
- Default Value:
- 3
{number}
style
There are different point styles which differ in appearance and size.
Possible values are
Hint: This attribute is internally replaced by face and size, whose opportunities are wider, , as given in the table above.
Constant name | Value | Meaning | face | size |
---|---|---|---|---|
JXG.POINT_STYLE_X_SMALL | 0 | small sized x | cross or x | 2 |
JXG.POINT_STYLE_X | 1 | medium sized x | cross or x | 3 |
JXG.POINT_STYLE_X_BIG | 2 | big sized x | cross or x | 4 |
JXG.POINT_STYLE_CIRCLE_TINY | 3 | tiny circle | circle or o | 1 |
JXG.POINT_STYLE_CIRCLE_SMALL | 4 | small circle | circle or o | 2 |
JXG.POINT_STYLE_CIRCLE | 5 | medium circle | circle or o | 3 |
JXG.POINT_STYLE_CIRCLE_BIG | 6 | big circle | circle or o | 4 |
JXG.POINT_STYLE_SQUARE_SMALL | 7 | small rectangle | square or [] | 2 |
JXG.POINT_STYLE_SQUARE | 8 | medium rectangle | square or [] | 3 |
JXG.POINT_STYLE_SQUARE_BIG | 9 | big rectangle | square or [] | 4 |
JXG.POINT_STYLE_PLUS_SMALL | 10 | small + | plus or + | 2 |
JXG.POINT_STYLE_PLUS | 11 | medium + | plus or + | 3 |
JXG.POINT_STYLE_PLUS_BIG | 12 | big + | plus or + | 4 |
- See:
- JXG.Point#face
- JXG.Point#size
- #setStyle
- Default Value:
- JXG.Options.point#style
Method Detail
addConstraint(terms)
Convert the point to CAS point and call update().
- Parameters:
- {array} terms
- [[zterm], xterm, yterm] defining terms for the z, x and y coordinate.
The z-coordinate is optional and it is used for homogeneaous coordinates.
The coordinates may be either
- a JavaScript function,
- a string containing GEONExT syntax. This string will be converted into a JavaScript function here,
- a number
- a pointer to a slider object. This will be converted into a call of the Value()-method of this slider.
- See:
- JXG.GeonextParser#geonext2JS
addTransform(el, transform)
TODO
- Parameters:
- el
- TODO
- transform
- TODO
cloneToBackground(addToTrace)
Copy the element to the background.
- Parameters:
- {boolean} addToTrace
- If true the clone will be added to trace control and can be removed using JXG.GeometryElement#clearTrace. Currently not used, and always true.
{number}
Dist(point2)
Getter method for the distance to a second point, this is required for CAS-elements.
Here, function inlining seems to be worthwile (for plotting).
- Parameters:
- {JXG.Point} point2
- The point to which the distance shall be calculated.
- Returns:
- Distance in user coordinate to the given point
makeGlider(glideObject)
Convert the point to glider and update the construction.
- Parameters:
- {String|Object} glideObject
- The Object the point will be bound to.
moveAlong(path, time)
Starts an animation which moves the point along a given path in given time.
- Parameters:
- {Array|function} path
- The path the point is moved on. This can be either an array of arrays containing x and y values of the points of the path, or function taking the amount of elapsed time since the animation has started and returns an array containing a x and a y value or NaN. In case of NaN the animation stops.
- {Number} time
- The time in milliseconds in which to finish the animation
moveTo(where, time)
Starts an animated point movement towards the given coordinates where. The animation is done after time milliseconds.
- Parameters:
- {Array} where
- Array containing the x and y coordinate of the target location.
- {int} time
- Number of milliseconds the animation should last. If the second parameter is not given or is equal to 0, setPosition() is called, see #setPosition.
- See:
- #animate
{String}
normalizeFace(s)
All point faces can be defined with more than one name, e.g. a cross faced point can be given
by face equal to 'cross' or equal to 'x'. This method maps all possible values to fixed ones to
simplify if- and switch-clauses regarding point faces. The translation table is as follows:
Input | Output |
---|---|
cross, x | x |
circle, o | o |
square, [] | [] |
plus, + | + |
diamond, <> | <> |
triangleup, a, ^ | A |
triangledown, v | v |
triangleleft, < | < |
triangleright, > | > |
- Parameters:
- {String} s
- A string which should determine a valid point face.
- Returns:
- {String} Returns a normalized string or undefined if the given string is not a valid point face.
remove()
Remove the point from the drawing.
setPosition(method, x, y)
Sets x and y coordinate and calls the point's update() method.
- Parameters:
- {number} method
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {number} x
- x coordinate in screen/user units
- {number} y
- y coordinate in screen/user units
setPositionByTransform(method, x, y)
TODO
- Parameters:
- {number} method
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {number} x
- x coordinate in screen/user units
- {number} y
- y coordinate in screen/user units
setPositionDirectly(method, x, y)
Sets x and y coordinate and calls the point's update() method.
- Parameters:
- {number} method
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {number} x
- x coordinate in screen/user units
- {number} y
- y coordinate in screen/user units
update(fromParent)
Updates the position of the point.
- Parameters:
- fromParent
updateTransform()
TODO
visit(where, time, repeat)
Starts an animated point movement towards the given coordinates where. After arriving at where the point moves back to where it started.
The animation is done after time milliseconds.
- Parameters:
- {Array} where
- Array containing the x and y coordinate of the target location.
- {int} time
- Number of milliseconds the animation should last.
- {int} repeat
- Optional: How often the animation should be repeated. The time value is then taken for one repeat.
- See:
- #animate
{number}
X()
Getter method for x, this is used by for CAS-points to access point coordinates.
- Returns:
- User coordinate of point in x direction.
{number}
Y()
Getter method for y, this is used by CAS-points to access point coordinates.
- Returns:
- User coordinate of point in y direction.
{number}
Z()
Getter method for z, this is used by CAS-points to access point coordinates.
- Returns:
- User coordinate of point in z direction.