class GRectMapper

Maps points from one rectangle to another rectangle.

Public Methods

[more] GRectMapper()
Constructs a rectangle mapper.
[more]void clear()
Resets the rectangle mapper state.
[more]void set_input(const GRect &rect)
Sets the input rectangle.
[more]void set_output(const GRect &rect)
Sets the output rectangle.
[more]void rotate(int count=1)
Composes the affine transform with a rotation of count quarter turns counter-clockwise.
[more]void mirrorx()
Composes the affine transform with a symmetry with respect to the vertical line crossing the center of the output rectangle.
[more]void mirrory()
Composes the affine transform with a symmetry with respect to the horizontal line crossing the center of the output rectangle.
[more]void map(int &x, int &y)
Maps a point according to the affine transform.
[more]void map(GRect &rect)
Maps a rectangle according to the affine transform.
[more]void unmap(int &x, int &y)
Maps a point according to the inverse of the affine transform.
[more]void unmap(GRect &rect)
Maps a rectangle according to the inverse of the affine transform.


Documentation

Maps points from one rectangle to another rectangle. This class represents a relation between the points of two rectangles. Given the coordinates of a point in the first rectangle (input rectangle), function map computes the coordinates of the corresponding point in the second rectangle (the output rectangle). This function actually implements an affine transform which maps the corners of the first rectangle onto the matching corners of the second rectangle. The scaling operation is performed using integer fraction arithmetic in order to maximize accuracy.
o GRectMapper()
Constructs a rectangle mapper.

ovoid clear()
Resets the rectangle mapper state. Both the input rectangle and the output rectangle are marked as undefined.

ovoid set_input(const GRect &rect)
Sets the input rectangle.

ovoid set_output(const GRect &rect)
Sets the output rectangle.

ovoid rotate(int count=1)
Composes the affine transform with a rotation of count quarter turns counter-clockwise. This operation essentially is a modification of the match between the corners of the input rectangle and the corners of the output rectangle.

ovoid mirrorx()
Composes the affine transform with a symmetry with respect to the vertical line crossing the center of the output rectangle. This operation essentially is a modification of the match between the corners of the input rectangle and the corners of the output rectangle.

ovoid mirrory()
Composes the affine transform with a symmetry with respect to the horizontal line crossing the center of the output rectangle. This operation essentially is a modification of the match between the corners of the input rectangle and the corners of the output rectangle.

ovoid map(int &x, int &y)
Maps a point according to the affine transform. Variables x and y initially contain the coordinates of a point. This operation overwrites these variables with the coordinates of a second point located in the same position relative to the corners of the output rectangle as the first point relative to the matching corners of the input rectangle.

ovoid map(GRect &rect)
Maps a rectangle according to the affine transform. This operation consists in mapping the rectangle corners and reordering the corners in the canonical rectangle representation. Variable rect is overwritten with the new rectangle coordinates.

ovoid unmap(int &x, int &y)
Maps a point according to the inverse of the affine transform. Variables x and y initially contain the coordinates of a point. This operation overwrites these variables with the coordinates of a second point located in the same position relative to the corners of input rectangle as the first point relative to the matching corners of the input rectangle.

ovoid unmap(GRect &rect)
Maps a rectangle according to the inverse of the affine transform. This operation consists in mapping the rectangle corners and reordering the corners in the canonical rectangle representation. Variable rect is overwritten with the new rectangle coordinates.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java