JXG.Coords

Class

This is the Coordinates class. All members a coordinate has to provide are defined here.

Members

Own

board : JXG.Board

Description

Stores the board the object is used on.

Type
JXG.Board
Source
base/coords.js, line 62

emitter : boolean

Description

If true, this coordinates object will emit update events every time the coordinates are set.

Type
boolean
Default Value
true
Source
base/coords.js, line 84

scrCoords : Array

Description

Stores coordinates for screen view as homogeneous coordinates.

Type
Array
Source
base/coords.js, line 75

usrCoords : Array

Description

Stores coordinates for user view as homogeneous coordinates.

Type
Array
Source
base/coords.js, line 68

Inherited

none

Methods

Own

(private) copy(obj, offset) → {Array}

Copy array, either scrCoords or usrCoords Uses slice() in case of standard arrays and set() in case of typed arrays.

Parameters

Name Type Description
obj String

Either 'scrCoords' or 'usrCoords'

offset Number

Offset, defaults to 0 if not given

Returns

Returns copy of the coords array either as standard array or as typed array.

Type
Array

Details

Source
base/coords.js, line 230

distance(coord_type, coordinates) → {Number}

Calculate distance of one point to another.

Parameters

Name Type Description
coord_type Number

The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.

coordinates JXG.Coords

The Coords object to which the distance is calculated.

Returns

The distance

Type
Number

Details

Source
base/coords.js, line 148

isReal() → {Boolean}

Test if one of the usrCoords is NaN or the coordinates are infinite.

Returns

true if the coordinates are finite, false otherwise.

Type
Boolean

Details

Source
base/coords.js, line 242

(private) normalizeUsrCoords()

Normalize homogeneous coordinates

Details

Source
base/coords.js, line 99

(private) screen2usr()

Compute user coordinates out of given screen coordinates.

Details

Source
base/coords.js, line 132

setCoordinates(coord_type, coordinates, doRoundopt, noeventopt) → {JXG.Coords}

Set coordinates by either user coordinates or screen coordinates and recalculate the other one.

Parameters

Name Type Attributes Default Description
coord_type Number

The type of coordinates used here. Possible values are COORDS_BY_USER and COORDS_BY_SCREEN.

coordinates Array

An array of affine coordinates the Coords object is set to.

doRound Boolean <optional>
true

flag If true or null round the coordinates in usr2screen. This is used in smooth curve plotting. The IE needs rounded coordinates. Id doRound==false we have to round in updatePathString.

noevent Boolean <optional>
false

Returns

Reference to the coords object.

Type
JXG.Coords

Details

Source
base/coords.js, line 179

(private) usr2screen()

Compute screen coordinates out of given user coordinates.

Details

Source
base/coords.js, line 111

Inherited

none

Events

Own

update

Triggered whenever the coordinates change.

Parameters

Name Type Description
ou Array

Old user coordinates

os Array

Old screen coordinates

Details

Source
base/coords.js, line 249

Inherited

none

Parameters

Name Type Attributes Default Description
method Number

The type of coordinates given by the user. Accepted values are COORDS_BY_SCREEN and COORDS_BY_USER.

coordinates Array

An array of affine coordinates.

board JXG.Board

A reference to a board.

emitter Boolean <optional>
true

Details

Source
base/coords.js, line 57