Class JXG.Transformation
↳ JXG.Transformation
Creates a new transformation object. Do not use this constructor to create a transformation.
Use JXG.Board#create with
type Transformation instead.
Defined in: transformation.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Transformation(board, type, params)
A transformation consists of a 3x3 matrix, i.e.
|
Method Attributes | Method Name and Description |
---|---|
<private> |
apply(p, 'self')
Transform a GeometryElement:
First, the transformation matrix is updated, then do the matrix-vector-multiplication.
|
applyOnce(p)
Applies a transformation once to a GeometryElement or an array of elements.
|
|
bindTo(p)
Binds a transformation to a GeometryElement or an array of elements.
|
|
melt(t)
Combine two transformations to one transformation.
|
|
setAttribute(term)
Empty method.
|
|
setMatrix(board, type, params, x,y, scale_x,scale_y, line|point_pair|"four, angle,x,y|angle,[x,y], shear_x,shear_y, a,b,c,d,e,f,g,h,i)
Set the transformation matrix for different types of standard transforms.
|
|
<deprecated> |
setProperty(term)
Unused
|
update()
Updates the numerical data for the transformation, i.e.
|
Class Detail
JXG.Transformation(board, type, params)
A transformation consists of a 3x3 matrix, i.e. it is a projective transformation.
- Parameters:
- {JXG.Board} board
- The board the new circle is drawn on.
- {String} type
- Can be
- 'translate'
- 'scale'
- 'reflect'
- 'rotate'
- 'shear'
- 'generic'
- {Object} params
- 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 )
Method Detail
<private>
{Array}
apply(p, 'self')
Transform a GeometryElement:
First, the transformation matrix is updated, then do the matrix-vector-multiplication.
- Parameters:
- {JXG.GeometryElement} p
- element which is transformed
- {String} 'self'
- Apply the transformation to the initialCoords instead of the coords if this is set.
- Returns:
- {Array}
applyOnce(p)
Applies a transformation once to a GeometryElement or an array of elements.
If it is a free point, then it can be dragged around later
and will overwrite the transformed coordinates.
- Parameters:
- {JXG.Point|Array} p
bindTo(p)
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, a call of board.update() has to follow.
- Parameters:
- {Array|JXG.Object} p
- JXG.Object or array of JXG.Object to which the transformation is bound to.
{JXG.Transform}
melt(t)
Combine two transformations to one transformation. This only works if
both of transformation matrices consist solely of numbers, and do not
contain functions.
Multiplies the transformation with a transformation t from the left.
i.e. (this) = (t) join (this)
- Parameters:
- {JXG.Transform} t
- Transformation which is the left multiplicand
- Returns:
- {JXG.Transform} the transformation object.
setAttribute(term)
Empty method. Unused.
- Parameters:
- {Object} term
- Key-value pairs of the attributes.
setMatrix(board, type, params, x,y, scale_x,scale_y, line|point_pair|"four, angle,x,y|angle,[x,y], shear_x,shear_y, a,b,c,d,e,f,g,h,i)
Set the transformation matrix for different types of standard transforms.
- Parameters:
- {JXG.Board} board
- {String} type
- Transformation type, possible values are 'translate', 'scale', 'reflect', 'rotate', 'shear', 'generic'.
- {Array} params
- Parameters for the various transformation types.
These are
- {Array} x,y
- Shift vector (number or function) in case of 'translate'.
- {Array} scale_x,scale_y
- Scale vector (number or function) in case of 'scale'.
- {Array} line|point_pair|"four
- 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).
- {Array} angle,x,y|angle,[x,y]
- 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 rotation center. If the rotation center is not given, the transformation rotates around (0,0).
- {Array} shear_x,shear_y
- Shear vector (number or function) in case of 'shear'.
- {Array} a,b,c,d,e,f,g,h,i
- 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 )
setProperty(term)
Unused
- Parameters:
- term
- Deprecated:
- Use setAttribute
{JXG.Transform}
update()
Updates the numerical data for the transformation, i.e. the entry of the subobject matrix.
- Returns:
- {JXG.Transform} returns pointer to itself