API Docs for: 0.99.4
Show:

JXG.Transformation Class

Module: JXG

A transformation consists of a 3x3 matrix, i.e. it is a projective transformation. Creates a new transformation object. Do not use this constructor to create a transformation. Use JXG.Board#create with type Transformation instead.

Constructor

JXG.Transformation

(
  • board
  • type
  • params
)

Parameters:

  • board JXG.Board

    The board the new circle is drawn on.

  • type String

    Can be

    • 'translate'
    • 'scale'
    • 'reflect'
    • 'rotate'
    • 'shear'
    • 'generic'
  • 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 transformation:

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

Methods

apply

(
  • p
  • 'self'
)
Array

Transform a GeometryElement: First, the transformation matrix is updated, the do the matrix-vector-multiplication.

Parameters:

  • p JXG.GeometryElement

    element which is transformed

  • 'self' String

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

Returns:

applyOnce

(
  • p
)
JXG.Transform chainable

Applies a transformation once to a GeometryElement. If it is a free point, then it can be dragged around later and will overwrite the transformed coordinates.

Parameters:

  • p JXG.Point,Array

Returns:

JXG.Transform:

returns pointer to itself

bindTo

(
  • p
)
JXG.Transform chainable

Binds a transformation to a GeometryElement. In every update of the GeometryElement, the transformation is executed.

Parameters:

  • p Array,JXG.Object

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

Returns:

JXG.Transform:

returns pointer to itself

melt

(
  • t
)
JXG.Transform chainable

Combine two transformations to one transformations. This only works if the both 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:

  • t JXG.Transform

    Transformation which is the left multiplicand

Returns:

JXG.Transform:

returns pointer to itself

setAttribute

(
  • term
)
JXG.Transform chainable

Empty method. Unused.

Parameters:

  • term Object

    Key-value pairs of the attributes.

Returns:

JXG.Transform:

returns pointer to itself

setMatrix

(
  • board
  • type
  • params
  • x,y
  • scale_x,scale_y
  • line|point_pair|"four
  • angle,x,y
  • shear_x,shear_y
  • a,b,c,d,e,f,g,h,i
)
JXG.Transform chainable

Set the transformation matrix for different types of standard transforms.

Parameters:

  • board JXG.Board
  • type String

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

  • params Array

    Parameters for the various transformation types.

    These are

  • x,y Array

    Shift vector (number or function) in case of 'translate'.

  • scale_x,scale_y Array

    Scale vector (number or function) in case of 'scale'.

  • line|point_pair|"four Array

    coordinates" In case of 'reflect' the parameters could be a line, a pair of points or four number (or functions) p_x, p_y, q_x, q_y, determining a line through points (p_x, p_y) and (q_x, q_y).

  • angle,x,y Array

    In case of 'rotate' the parameters are an angle or angle function, returning the angle in Radians and - optionally - a coordinate pair or a point defining the returning the angle in Radians and - optionally - a coordinate pair defining the reotation center. If the rotation center is not given, the transformation rotates around (0,0).

  • shear_x,shear_y Array

    Shear vector (number or function) in case of 'shear'.

  • a,b,c,d,e,f,g,h,i Array

    Nine matrix entries (numbers or functions) for a generic projective transformation in case of 'generic'.

    A transformation with a generic matrix looks like:

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

Returns:

JXG.Transform:

returns pointer to itself

setProperty

(
  • term
)
deprecated

Unused. USe setAttribute.

Parameters:

update

() JXG.Transform private chainable

Returns:

JXG.Transform:

returns pointer to itself