PLplot: plaffine.c File Reference

PLplot 5.15.0

Functions
plaffine.c File Reference
`#include "plplotP.h"`

Go to the source code of this file.

## Functions
void | plP_affine_identity (PLFLT *affine_vector)
void | plP_affine_translate (PLFLT *affine_vector, PLFLT xtranslate, PLFLT ytranslate)
void | plP_affine_scale (PLFLT *affine_vector, PLFLT xscale, PLFLT yscale)
void | plP_affine_rotate (PLFLT *affine_vector, PLFLT angle)
void | plP_affine_xskew (PLFLT *affine_vector, PLFLT angle)
void | plP_affine_yskew (PLFLT *affine_vector, PLFLT angle)
void | plP_affine_multiply (PLFLT *affine_vectorA, PLFLT_VECTOR affine_vectorB, PLFLT_VECTOR affine_vectorC)

## Detailed Description

These function perform variuos affine transformations.

For background on these affine functions see SVG specification, e.g., http://www.w3.org/TR/SVGTiny12/coords.html#EstablishingANewUserSpace. Affine 3x3 matrices with elements A_i,j always have a last row of 0, 0, 1 so the elements are conveniently stored in a vector in the order A_1_1, A_2_1, A_1_2, A_2_2, A_1_3, A_2_3, with the last row implied.

N.B. The PLplot affine interpretation of translate, scale, etc., is as actions on coordinate systems, rather than actions on objects. This is identical to the SVG specficiation interpretation. However, the SVG specification interprets the affine matrix as follows: old_coord_vector = affine_matrix * new_coordinate vector. In PLplot we use the alternative interpretation new_coord_vector = affine_matrix * old_coordinate vector. The result is all affine matrices below are the inverses of the SVG equivalents.

N.B. All PLplot affine functions below return the affine matrix result (in vector form) as the first argument). It is the calling routine's responsibility to provide the space for all affine matrix arguments, i.e., a PLFLT array with a dimension of 6.

Definition in file plaffine.c.

## Function Documentation

## ◆ plP_affine_identity()

void plP_affine_identity | ( | PLFLT * | affine_vector | ) |

Returns affine identity matrix

Parameters

  affine_vector | Initialize a (pre-allocated) transform matrix.

Definition at line 56 of file plaffine.c.

## ◆ plP_affine_multiply()

void plP_affine_multiply | ( | PLFLT * | affine_vectorA,
|  | PLFLT_VECTOR | affine_vectorB,
|  | PLFLT_VECTOR | affine_vectorC
| ) |  |

Multiply two affine transformation matrices to form a third.

A = B * C

Parameters

  affine_vectorA | Pre-allocated storage for the result of multiplying matrix affine_vectorB by matrix affine_vectorC.
  affine_vectorB | First matrix to multiply.
  affine_vectorC | Second matrix to multiply.

Definition at line 184 of file plaffine.c.

## ◆ plP_affine_rotate()

void plP_affine_rotate | ( | PLFLT * | affine_vector,
|  | PLFLT | angle
| ) |  |

Rotate new coordinate system axes relative to the old. angle is in degrees.

Parameters

  affine_vector | Pre-allocated storage for a rotation matrix.
  angle | Amount to rotate in degrees.

Definition at line 123 of file plaffine.c.

## ◆ plP_affine_scale()

void plP_affine_scale | ( | PLFLT * | affine_vector,
|  | PLFLT | xscale,
|  | PLFLT | yscale
| ) |  |

Scale new coordinate system axes relative to the old.

Parameters

  affine_vector | Pre-allocate storage for a scale matrix.
  xscale | Amount to scale in x.
  yscale | Amount to scale in y.

Definition at line 93 of file plaffine.c.

## ◆ plP_affine_translate()

void plP_affine_translate | ( | PLFLT * | affine_vector,
|  | PLFLT | xtranslate,
|  | PLFLT | ytranslate
| ) |  |

Translate new coordinate system axes relative to the old.

Parameters

  affine_vector | Pre-allocated storage for a translation matrix.
  xtranslate | Amount to translate in x.
  ytranslate | Amount to translate in y.

Definition at line 73 of file plaffine.c.

## ◆ plP_affine_xskew()

void plP_affine_xskew | ( | PLFLT * | affine_vector,
|  | PLFLT | angle
| ) |  |

Skew new X coordinate axis relative to the old. angle is in degrees.

Parameters

  affine_vector | Pre-allocated storage for a skew (in x) matrix.
  angle | Amount to skew in degrees.

Definition at line 143 of file plaffine.c.

## ◆ plP_affine_yskew()

void plP_affine_yskew | ( | PLFLT * | affine_vector,
|  | PLFLT | angle
| ) |  |

Skew new Y coordinate axis relative to the old. angle is in degrees.

Parameters

  affine_vector | Pre-allocated storage for a skew (in y) matrix.
  angle | Amount to skew in degrees.

Definition at line 162 of file plaffine.c.