Class Index

Classes


Class PDFNet.Matrix2D

PDFNet.Matrix2D

Class Summary
Constructor Attributes Constructor Name and Description
 
PDFNet.Matrix2D(m_a, m_b, m_c, m_d, m_h, m_v)
2D Matrix A Matrix2D object represents a 3x3 matrix that, in turn, represents an affine transformation.
Method Summary
Method Attributes Method Name and Description
 
concat(a, b, c, d, h, v)
the Concat method updates this matrix with the product of itself and another matrix specified through an argument list.
 
copy()
Assignment operator.
<static>  
PDFNet.Matrix2D.createIdentityMatrix()
Create identity matrix (1 0 0 1 0 0)
<static>  
PDFNet.Matrix2D.createRotationMatrix(angle)
<static>  
PDFNet.Matrix2D.createZeroMatrix()
Create zero matrix (0 0 0 0 0 0)
 
equals(m2)
The equality operator determines whether the elements of this matrix are equal to the elements of another matrix.
 
 
mult(x, y)
Transform/multiply the point (x, y) using this matrix
 
scale(h, v)
The Scale method updates this matrix with the product of itself and a scaling matrix.
 
set(a, b, c, d, h, v)
The Set method sets the elements of this matrix.
 
translate(h, v)
The Translate method updates this matrix with the product of itself and a translation matrix (i.e.
Class Detail
PDFNet.Matrix2D(m_a, m_b, m_c, m_d, m_h, m_v)
2D Matrix A Matrix2D object represents a 3x3 matrix that, in turn, represents an affine transformation. A Matrix2D object stores only six of the nine numbers in a 3x3 matrix because all 3x3 matrices that represent affine transformations have the same third column (0, 0, 1). Affine transformations include rotating, scaling, reflecting, shearing, and translating. In PDFNet, the Matrix2D class provides the foundation for performing affine transformations on vector drawings, images, and text. A transformation matrix specifies the relationship between two coordinate spaces. By modifying a transformation matrix, objects can be scaled, rotated, translated, or transformed in other ways. A transformation matrix in PDF is specified by six numbers, usually in the form of an array containing six elements. In its most general form, this array is denoted [a b c d h v]; The following table lists the arrays that specify the most common transformations: - Translations are specified as [1 0 0 1 tx ty], where tx and ty are the distances to translate the origin of the coordinate system in the horizontal and vertical dimensions, respectively. - Scaling is obtained by [sx 0 0 sy 0 0]. This scales the coordinates so that 1 unit in the horizontal and vertical dimensions of the new coordinate system is the same size as sx and sy units, respectively, in the previous coordinate system. - Rotations are produced by [cos(A) sin(A) -sin(A) cos(A) 0 0], which has the effect of rotating the coordinate system axes by an angle 'A' counterclockwise. - Skew is specified by [1 tan(A) tan(B) 1 0 0], which skews the x axis by an angle A and the y axis by an angle B. Matrix2D elements are positioned as follows : | m_a m_b 0 | | m_c m_d 0 | | m_h m_v 1 | A single Matrix2D object can store a single transformation or a sequence of transformations. The latter is called a composite transformation. The matrix of a composite transformation is obtained by multiplying (concatenating) the matrices of the individual transformations. Because matrix multiplication is not commutative-the order in which matrices are multiplied is significant. For example, if you first rotate, then scale, then translate, you get a different result than if you first translate, then rotate, then scale. -------------------- Since Matrix2D is a struct, it can be created manually by calling "new PDFNet.Matrix2D(m_a, m_b, m_c, m_d, m_h, m_v)" eg. var myfoo = new PDFNet.Matrix2D(1,0,0,1,0,0); Default values for a Matrix2D struct are: m_a = 0 m_b = 0 m_c = 0 m_d = 0 m_h = 0 m_v = 0
Parameters:
m_a
m_b
m_c
m_d
m_h
m_v
Method Detail
concat(a, b, c, d, h, v)
the Concat method updates this matrix with the product of itself and another matrix specified through an argument list.
Parameters:
{number} a
the matrix element in the first row, first column.
{number} b
the matrix element in the first row, second column.
{number} c
the matrix element in the second row, first column.
{number} d
the matrix element in the second row, second column.
{number} h
the matrix element in the third row, first column.
{number} v
the matrix element in the third row, second column.

{matrix2d} copy()
Assignment operator.
Returns:
{matrix2d} A promise that resolves to an object of type: "matrix2d" (generated documentation)

<static> {matrix2d} PDFNet.Matrix2D.createIdentityMatrix()
Create identity matrix (1 0 0 1 0 0)
Returns:
{matrix2d} A promise that resolves to an object of type: "matrix2d" (generated documentation)

<static> {matrix2d} PDFNet.Matrix2D.createRotationMatrix(angle)
Parameters:
{number} angle
the angle of rotation in radians. Positive values specify clockwise rotation.
Returns:
{matrix2d} A promise that resolves to a rotation matrix for a given angle.

<static> {matrix2d} PDFNet.Matrix2D.createZeroMatrix()
Create zero matrix (0 0 0 0 0 0)
Returns:
{matrix2d} A promise that resolves to an object of type: "matrix2d" (generated documentation)

{boolean} equals(m2)
The equality operator determines whether the elements of this matrix are equal to the elements of another matrix.
Parameters:
{matrix2d} m2
A Matrix object that is compared with this Matrix object.
Returns:
{boolean} A promise that resolves to a boolean regarding whether two matrices are the same.

{matrix2d} inverse()
Returns:
{matrix2d} A promise that resolves to if this matrix is invertible, the Inverse method returns its inverse matrix.

{Obj} mult(x, y)
Transform/multiply the point (x, y) using this matrix
Parameters:
x
x-coordinate of point to transform
y
y-coordinate of point to transform
Returns:
{Obj} A javascript object that contains an x value and y value

scale(h, v)
The Scale method updates this matrix with the product of itself and a scaling matrix.
Parameters:
{number} h
the horizontal scale factor.
{number} v
the vertical scale factor
Returns:
updated this matrix

set(a, b, c, d, h, v)
The Set method sets the elements of this matrix.
Parameters:
{number} a
the matrix element in the first row, first column.
{number} b
the matrix element in the first row, second column.
{number} c
the matrix element in the second row, first column.
{number} d
the matrix element in the second row, second column.
{number} h
the matrix element in the third row, first column.
{number} v
the matrix element in the third row, second column.

translate(h, v)
The Translate method updates this matrix with the product of itself and a translation matrix (i.e. it is equivalent to this.m_h += h; this.m_v += v).
Parameters:
{number} h
the horizontal component of the translation.
{number} v
the vertical component of the translation.
Returns:
updated this matrix

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 09 2016 14:32:40 GMT-0700 (PDT)