Matrix

Group: Affine Matrix

Summary
MatrixGroup: Affine Matrix
Functions
gdAffineApplyToPointFApplies an affine transformation to a point (floating point gdPointF)
gdAffineInvertFind the inverse of an affine transformation.
gdAffineFlipFlip an affine transformation horizontally or vertically.
gdAffineConcatConcat (Multiply) two affine transformation matrices.
gdAffineIdentitySet up the identity matrix.
gdAffineScaleSet up a scaling matrix.
gdAffineRotateSet up a rotation affine transform.
gdAffineShearHorizontalSet up a horizontal shearing matrix || becomes \\.
gdAffineShearVerticalSet up a vertical shearing matrix, columns are untouched.
gdAffineTranslateSet up a translation matrix.
gdAffineRectilinearDetermines whether the affine transformation is axis aligned.
gdAffineEqualDetermines whether two affine transformations are equal.

Functions

gdAffineApplyToPointF

int gdAffineApplyToPointF (gdPointFPtr dst,
const gdPointFPtr src,
const double affine[6])

Applies an affine transformation to a point (floating point gdPointF)

Parameters

dstWhere to store the resulting point
affineSource Point
flip_horzaffine matrix

Returns

GD_TRUE if the affine is rectilinear or GD_FALSE

gdAffineInvert

int gdAffineInvert (double dst[6],
const double src[6])

Find the inverse of an affine transformation.

All non-degenerate affine transforms are invertible.  Applying the inverted matrix will restore the original values.  Multiplying <src> by <dst> (commutative) will return the identity affine (rounding error possible).

Parameters

dstWhere to store the resulting affine transform
src_affineOriginal affine matrix
flip_horzWhether or not to flip horizontally
flip_vertWhether or not to flip vertically

See also

gdAffineIdentity

Returns

GD_TRUE if the affine is rectilinear or GD_FALSE

gdAffineFlip

int gdAffineFlip (double dst[6],
const double src[6],
const int flip_h,
const int flip_v)

Flip an affine transformation horizontally or vertically.

Flips the affine transform, giving GD_FALSE for <flip_horz> and <flip_vert> will clone the affine matrix.  GD_TRUE for both will copy a 180° rotation.

Parameters

dstWhere to store the resulting affine transform
src_affineOriginal affine matrix
flip_hWhether or not to flip horizontally
flip_vWhether or not to flip vertically

Returns

GD_TRUE on success or GD_FALSE

gdAffineConcat

int gdAffineConcat (double dst[6],
const double m1[6],
const double m2[6])

Concat (Multiply) two affine transformation matrices.

Concats two affine transforms together, i.e. the result will be the equivalent of doing first the transformation m1 and then m2.  All parameters can be the same matrix (safe to call using the same array for all three arguments).

Parameters

dstWhere to store the resulting affine transform
m1First affine matrix
m2Second affine matrix

Returns

GD_TRUE on success or GD_FALSE

gdAffineIdentity

int gdAffineIdentity (double dst[6])

Set up the identity matrix.

Parameters

dstWhere to store the resulting affine transform

Returns

GD_TRUE on success or GD_FALSE

gdAffineScale

int gdAffineScale (double dst[6],
const double scale_x,
const double scale_y)

Set up a scaling matrix.

Parameters

scale_xX scale factor
scale_yY scale factor

Returns

GD_TRUE on success or GD_FALSE

gdAffineRotate

int gdAffineRotate (double dst[6],
const double angle)

Set up a rotation affine transform.

Like the other angle in libGD, in which increasing y moves downward, this is a counterclockwise rotation.

Parameters

dstWhere to store the resulting affine transform
angleRotation angle in degrees

Returns

GD_TRUE on success or GD_FALSE

gdAffineShearHorizontal

int gdAffineShearHorizontal(double dst[6],
const double angle)

Set up a horizontal shearing matrix || becomes \\.

Parameters

dstWhere to store the resulting affine transform
angleShear angle in degrees

Returns

GD_TRUE on success or GD_FALSE

gdAffineShearVertical

int gdAffineShearVertical(double dst[6],
const double angle)

Set up a vertical shearing matrix, columns are untouched.

Parameters

dstWhere to store the resulting affine transform
angleShear angle in degrees

Returns

GD_TRUE on success or GD_FALSE

gdAffineTranslate

int gdAffineTranslate (double dst[6],
const double offset_x,
const double offset_y)

Set up a translation matrix.

Parameters

dstWhere to store the resulting affine transform
offset_xHorizontal translation amount
offset_yVertical translation amount

Returns

GD_TRUE on success or GD_FALSE

gdAffineRectilinear

int gdAffineRectilinear (const double m[6])

Determines whether the affine transformation is axis aligned.  A tolerance has been implemented using GD_EPSILON.

Parameters

mThe affine transformation

Returns

GD_TRUE if the affine is rectilinear or GD_FALSE

gdAffineEqual

int gdAffineEqual (const double m1[6],
const double m2[6])

Determines whether two affine transformations are equal.  A tolerance has been implemented using GD_EPSILON.

Parameters

m1The first affine transformation
m2The first affine transformation

Returns

GD_TRUE on success or GD_FALSE

int gdAffineApplyToPointF (gdPointFPtr dst,
const gdPointFPtr src,
const double affine[6])
Applies an affine transformation to a point (floating point gdPointF)
int gdAffineInvert (double dst[6],
const double src[6])
Find the inverse of an affine transformation.
int gdAffineFlip (double dst[6],
const double src[6],
const int flip_h,
const int flip_v)
Flip an affine transformation horizontally or vertically.
int gdAffineConcat (double dst[6],
const double m1[6],
const double m2[6])
Concat (Multiply) two affine transformation matrices.
int gdAffineIdentity (double dst[6])
Set up the identity matrix.
int gdAffineScale (double dst[6],
const double scale_x,
const double scale_y)
Set up a scaling matrix.
int gdAffineRotate (double dst[6],
const double angle)
Set up a rotation affine transform.
int gdAffineShearHorizontal(double dst[6],
const double angle)
Set up a horizontal shearing matrix || becomes \\.
int gdAffineShearVertical(double dst[6],
const double angle)
Set up a vertical shearing matrix, columns are untouched.
int gdAffineTranslate (double dst[6],
const double offset_x,
const double offset_y)
Set up a translation matrix.
int gdAffineRectilinear (const double m[6])
Determines whether the affine transformation is axis aligned.
int gdAffineEqual (const double m1[6],
const double m2[6])
Determines whether two affine transformations are equal.
Close