Point

Element

Construct a free or a fixed point.

A free point is created if the given parent elements are all numbers and the attribute fixed is not set or set to false (default). If one or more parent elements are not a number but a function or a GEONExT string with a constraint, the point will be considered as constrained. That means that the user won't be able to change the point's position directly.

Usage (signatures)
board.create('point', [zopt, x, y]);

Parent elements can be two or three elements of type number, a function which takes no parameter and returns a number, or a string containing a GEONExT constraint.

Every parent element determines one coordinate. If a coordinate is given by a number, the number determines the initial position of a free point. If given by a string or a function that coordinate will be constrained that means the user won't be able to change the point's position directly by mouse because it will be calculated automatically depending on the string or the function's return value.

If two parent elements are given the coordinates will be interpreted as 2D affine Euclidean coordinates, if three such parent elements are given they will be interpreted as homogeneous coordinates.

Parameters
Name Type Attributes Description
z NumberLike <optional>
x NumberLike
y NumberLike
Examples

Create a free point using (affine) Euclidean coordinates

var p = board.create('point', [3.5, 2.0]);

Create a constrained point using anonymous function

var p1 = board.create('point', [3.5, 2.0]);
var p2 = board.create('point', [3.5, function () { return p1.X(); }]);
board.create('point', [p, t]);

A point can also be created providing a transformation or an array of transformations. The resulting point is a clone of the base point transformed by the given Transformation.

Parameters
Name Type Description
p Point

Point

t Transformation | Array

Transformation or array of transformations

Example
// Create a point using transformations
var trans = board.create('transform', [2, 0.5], {type:'scale'});
var p1 = board.create('point', [3.5, 2.0]);
var p2 = board.create('point', [p1, trans]);
Attributes

Own

attractToGrid

Description

If set to true, the point will only snap to (possibly invisibly) grid points when within Point#attractorDistance of such a grid point.

The coordinates of the grid points are either integer multiples of snapSizeX and snapSizeY (given in user coordinates, not pixels) or are the intersection points of the major ticks of the boards default axes in case that snapSizeX, snapSizeY are negative.

Type
Boolean
Default Value
false
See
Example
board.create('point', [3, 3], { attractToGrid: true, attractorDistance: 10, attractorunit: 'screen' });

Source
options.js, line 8227

attractorDistance

Description

If the distance of the point to one of its attractors is less than this number the point will be a glider on this attracting element. If set to zero nothing happens.

Type
Number
Default Value
0.0
Source
options.js, line 8181

attractorUnit

Description

Unit for attractorDistance and snatchDistance, used for magnetized points and for snapToPoints. Possible values are 'screen' and 'user'.

Type
String
Default Value
'user'
See
Source
options.js, line 8165

attractors

Description

List of attractor elements. If the distance of the point is less than attractorDistance the point is made to glider of this element.

Type
Array
Default Value
empty
Source
options.js, line 8153

face

Description

There are different point styles which differ in appearance. Posssible values are

Input Output
cross x
circle o
square, [] []
plus +
minus -
divide | |
diamond <>
diamond2 <> (bigger)
triangleup ^, a, A
triangledown v
triangleleft <
triangleright >
Type
String
Overrides
JXG.Point#face
Default Value
circle
See
Source
options.js, line 8034

ignoredSnapToPoints

Description

List of elements which are ignored by snapToPoints.

Type
Array
Default Value
empty
Source
options.js, line 8312

infoboxDigits

Description

Truncating rule for the digits in the infobox.

  • 'auto': done automatically by JXG.autoDigits()
  • 'none': no truncation
  • number: truncate after "number digits" with JXG.toFixed()
Type
String | Number
Default Value
'auto'
See
Source
options.js, line 8134

showInfobox

Description

If true, the infobox is shown on mouse/pen over, if false not. If the value is 'inherit', the value of JXG.Board#showInfobox is taken.

Values: true | false | 'inherit'

Type
Boolean | String
Default Value
true
See
Source
options.js, line 8119

size

Description

Size of a point, either in pixel or user coordinates. Means radius resp. half the width of a point (depending on the face).

Type
Number
Overrides
JXG.Point#size
Default Value
3
See
Source
options.js, line 8062

sizeUnit

Description

Unit for size. Possible values are 'screen' and 'user.

Type
String
Default Value
'screen'
See
Source
options.js, line 8077

snapSizeX

Description

Defines together with Point#snapSizeY the grid the point snaps on to. It is given in user coordinates, not in pixels. 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.

Type
Number
Default Value
1
See
Source
options.js, line 8263

snapSizeY

Description

Defines together with Point#snapSizeX the grid the point snaps on to. It is given in user coordinates, not in pixels. 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.

Type
Number
Default Value
1
See
Source
options.js, line 8281

snapToGrid

Description

If set to true, the point will snap to a grid of integer multiples of Point#snapSizeX and Point#snapSizeY (in user coordinates).

The coordinates of the grid points are either integer multiples of snapSizeX and snapSizeY (given in user coordinates, not pixels) or are the intersection points of the major ticks of the boards default axes in case that snapSizeX, snapSizeY are negative.

Type
Boolean
Overrides
JXG.Point#snapToGrid
Default Value
false
See
Source
options.js, line 8209

snapToPoints

Description

If set to true, the point will snap to the nearest point in distance of Point#attractorDistance.

Type
Boolean
Overrides
JXG.Point#snapToPoints
Default Value
false
See
Source
options.js, line 8299

snatchDistance

Description

If the distance of the point to one of its attractors is at least this number the point will be released from being a glider on the attracting element. If set to zero nothing happens.

Type
Number
Default Value
0.0
Source
options.js, line 8195

style

Description

This attribute was used to determined the point layout. It was derived from GEONExT and was replaced by Point#face and Point#size.

Type
Number
Deprecated
Yes
Default Value
5
See
Source
options.js, line 8019

zoom

Description

If true, the point size changes on zoom events.

Type
Boolean
Default Value
false
Source
options.js, line 8108

Inherited

Members

Own

none

Inherited

Methods

Own

none

Inherited

Events

Own

none

Inherited

Throws

If the element cannot be constructed with the given parent objects an exception is thrown.

Type
Exception

Details

Type
JXG.Point
See
Source
base/point.js, line 440

Extends