JXG.Transformation

Class

Creates a new transformation object. Do not use this constructor to create a transformation. Use JXG.Board#create with type Transformation instead.

Methods

Own

(private) apply(p, 'self') → {Array}

Transform a point element, that are: Point, Text, Image, Point3D. First, the transformation matrix is updated, then do the matrix-vector-multiplication.

Restricted to 2D transformations.

Parameters

Name Type Description
p JXG.GeometryElement

element which is transformed

'self' String

Apply the transformation to the initialCoords instead of the coords if this is set.

Returns

Type
Array

Details

Source
base/transformation.js, line 786

applyOnce(p)

Applies a transformation once to a point element, that are: Point, Text, Image, Point3D or to an array of such elements. If it is a free 2D point, then it can be dragged around later and will overwrite the transformed coordinates.

Parameters

Name Type Description
p Point | Array

Details

Source
base/transformation.js, line 807

bindTo(el)

Binds a transformation to a GeometryElement or an array of elements. In every update of the GeometryElement(s), the transformation is executed. That means, in order to immediately apply the transformation after calling bindTo, a call of board.update() has to follow.

The transformation is simply appended to the existing list of transformations of the object. It is not fused (melt) with an existing transformation.

Parameters

Name Type Description
el Array | JXG.Object

JXG.Object or array of JXG.Object to which the transformation is bound to.

Details

See
  • JXG.Transformation.meltTo
Source
base/transformation.js, line 838

clone() → {JXG.Transformation}

Create a copy of the transformation in case it is static, i.e. if the transformation matrix does not depend on other elements.

If the transformation matrix is not static, null will be returned.

Returns

Type
JXG.Transformation

Details

Source
base/transformation.js, line 901

melt(t) → {JXG.Transform}

Combine two transformations to one transformation. This only works if both of transformation matrices consist of numbers solely, and do not contain functions.

Multiplies the transformation with a transformation t from the left. i.e. (this) = (t) join (this)

Parameters

Name Type Description
t JXG.Transform

Transformation which is the left multiplicand

Returns

the transformation object.

Type
JXG.Transform

Details

Source
base/transformation.js, line 939

meltTo(el)

Binds a transformation to a GeometryElement or an array of elements. In every update of the GeometryElement(s), the transformation is executed. That means, in order to immediately apply the transformation after calling meltTo, a call of board.update() has to follow.

In case the last transformation of the element and this transformation are static, i.e. the transformation matrices do not depend on other elements, the transformation will be fused into (multiplied with) the last transformation of the element. Thus, the list of transformations is kept small. If the transformation will be the first transformation of the element, it will be cloned to prevent side effects.

Parameters

Name Type Description
el Array | JXG.Object

JXG.Object or array of JXG.Objects to which the transformation is bound to.

Details

See
Source
base/transformation.js, line 868

setAttribute(term)

Empty method. Unused.

Parameters

Name Type Description
term Object

Key-value pairs of the attributes.

Details

Source
base/transformation.js, line 927

setMatrix(board, type, params)

Set the transformation matrix for different types of standard transforms.

Parameters

Name Type Description
board JXG.Board
type String

Transformation type, possible values are 'translate', 'scale', 'reflect', 'rotate', 'shear', 'affine', 'affinematrix', 'generic', 'matrix'.

params Array

Parameters for the various transformation types.

A transformation with a generic matrix looks like:

( a  b  c )   ( z )
( d  e  f ) * ( x )
( g  h  i )   ( y )

The transformation matrix then looks like:

Translation matrix:

( 1  0  0)   ( z )
( a  1  0) * ( x )
( b  0  1)   ( y )

Scale matrix:

( 1  0  0)   ( z )
( 0  a  0) * ( x )
( 0  0  b)   ( y )

A rotation matrix with angle a (in Radians)

( 1    0        0      )   ( z )
( 0    cos(a)  -sin(a) ) * ( x )
( 0    sin(a)   cos(a) )   ( y )

Shear matrix:

( 1  0  0)   ( z )
( 0  1  a) * ( x )
( 0  b  1)   ( y )

Generic affine transformation (4 parameters):

( 1  0  0 )   ( z )
( 0  a  b ) * ( x )
( 0  c  d )   ( y )

Affine 2x2 matrix:

( 1  0  0 )   ( z )
( 0  M    ) * ( x )
( 0       )   ( y )

Generic transformation (9 parameters):

( a  b  c )   ( z )
( d  e  f ) * ( x )
( g  h  i )   ( y )

3x3 Matrix:

(         )   ( z )
(    M    ) * ( x )
(         )   ( y )

Details

Source
base/transformation.js, line 263

setMatrix3D(board, type, params)

Set the 3D transformation matrix for different types of standard transforms.

Parameters

Name Type Description
board JXG.Board
type String

Transformation type, possible values are 'translate', 'scale', 'rotateX', 'rotateY', 'rotateZ', 'rotate', 'affine', 'affinematrix', 'generic', 'matrix'.

params Array

Parameters for the various transformation types.

A transformation with a generic matrix looks like:

( a  b  c  d)   ( w )
( e  f  g  h) * ( x )
( i  j  k  l)   ( y )
( m  n  o  p)   ( z )

The transformation matrix then looks like:

Translation matrix:

( 1  0  0  0)   ( w )
( a  1  0  0) * ( x )
( b  0  1  0)   ( y )
( c  0  0  1)   ( z )

Scale matrix:

( 1  0  0  0)   ( w )
( 0  a  0  0) * ( x )
( 0  0  b  0)   ( y )
( 0  0  0  c)   ( z )

rotateX: a rotation matrix with angle a (in Radians)

( 1    0        0             )   ( w )
( 0    1        0         0   ) * ( x )
( 0    0      cos(a)  -sin(a) )   ( y )
( 0    0      sin(a)   cos(a) )   ( z )

rotateY: a rotation matrix with angle a (in Radians)

( 1      0       0           )   ( w )
( 0    cos(a)    0   -sin(a) ) * ( x )
( 0      0       1       0   )   ( y )
( 0    sin(a)    0    cos(a) )   ( z )

rotateZ: a rotation matrix with angle a (in Radians)

( 1      0                0  )   ( w )
( 0    cos(a)  -sin(a)    0  ) * ( x )
( 0    sin(a)   cos(a)    0  )   ( y )
( 0      0         0      1  )   ( z )

rotate: a rotation matrix with angle a (in Radians) and normal n.

Generic affine transformation (9 parameters):

( 1  0  0  0 )   ( w )
( 0  a  b  c ) * ( x )
( 0  d  e  f )   ( y )
( 0  g  h  i )   ( z )

Affine 3x3 matrix:

( 1  0  0  0 )   ( w )
( 0          ) * ( x )
( 0     M    )   ( y )
( 0          )   ( z )

Generic transformation (16 parameters):

( a  b  c  d )   ( w )
( e  f  ...  ) * ( x )
(    ...     )   ( y )
(    ...   p )   ( z )

Generic 4x4 matrix:

(            )   ( w )
(     M      ) * ( x )
(            )   ( y )
(            )   ( z )

Details

Source
base/transformation.js, line 588

setProperty(term)

Unused

Parameters

Name Type Description
term

Details

Deprecated
Use setAttribute
Source
base/transformation.js, line 919

update() → {JXG.Transform}

Updates the numerical data for the transformation, i.e. the entry of the subobject matrix.

Returns

returns pointer to itself

Type
JXG.Transform

Details

Source
base/transformation.js, line 176

Inherited

none

Parameters

Name Type Description
board JXG.Board

The board the transformation is part of.

type String

Can be

  • 'translate'
  • 'scale'
  • 'reflect'
  • 'rotate'
  • 'shear'
  • 'affine'
  • 'affinematrix'
  • 'generic'
  • 'matrix'
params Object

The parameters depend on the transformation type

Translation matrix:

( 1  0  0)   ( z )
( a  1  0) * ( x )
( b  0  1)   ( y )

Scale matrix:

( 1  0  0)   ( z )
( 0  a  0) * ( x )
( 0  0  b)   ( y )

A rotation matrix with angle a (in Radians)

( 1    0        0      )   ( z )
( 0    cos(a)  -sin(a) ) * ( x )
( 0    sin(a)   cos(a) )   ( y )

Shear matrix:

( 1  0  0)   ( z )
( 0  1  a) * ( x )
( 0  b  1)   ( y )

Generic affine transformation (4 parameters):

( 1  0  0 )   ( z )
( 0  a  b ) * ( x )
( 0  c  d )   ( y )

Affine 2x2 matrix:

( 1  0  0 )   ( z )
( 0  M    ) * ( x )
( 0       )   ( y )

Generic transformation (9 parameters):

( a  b  c )   ( z )
( d  e  f ) * ( x )
( g  h  i )   ( y )

3x3 Matrix:

(         )   ( z )
(    M    ) * ( x )
(         )   ( y )

Details

Source
base/transformation.js, line 125