Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvTransformer Class Reference

Geometric transformation class. More...

#include <ilviews/ilv.h>

Public Member Functions

 IlvTransformer ()
 Constructor. More...
 
 IlvTransformer (const IlvPoint &center, IlvTransfoParam angle)
 Constructor. More...
 
 IlvTransformer (const IlvPoint &delta)
 Constructor. More...
 
 IlvTransformer (const IlvRect &src, const IlvRect &dst)
 Constructor. More...
 
 IlvTransformer (IlvTransfoParam m11, IlvTransfoParam m12, IlvTransfoParam m21, IlvTransfoParam m22, IlvTransfoParam x0, IlvTransfoParam y0)
 Constructor. More...
 
 IlvTransformer (IlvTransfoParam sx, IlvTransfoParam sy, IlvPoint *point=0)
 Constructor. More...
 
void apply (IlUInt count, IlvPoint *points) const
 Applies the transformer to a point set. More...
 
void apply (IlvDoublePoint &p) const
 Applies the transformer to a point. More...
 
void apply (IlvFloatPoint &p) const
 Applies the transformer to a point. More...
 
void apply (IlvPoint &p) const
 Applies the transformer. More...
 
void apply (IlvRect &rect) const
 Applies the transformer to a rectangle. More...
 
void applyAndFill (IlvRect &rect) const
 Applies the transformer. More...
 
void compose (const IlvTransformer &t)
 Computes the composition of two transformers. More...
 
IlBoolean compute (const IlvRect &src, const IlvRect &dst)
 Stores the scaling and translation factors. More...
 
IlBoolean computeInverse (IlvTransformer &t) const
 Stores the inverse transformation values. More...
 
void deltaApply (IlvPoint &p) const
 Applies the transformer without the translation. More...
 
IlDouble getDeterminant () const
 Gets the determinant of the matrix. More...
 
void getValues (IlvTransfoParam &m11, IlvTransfoParam &m12, IlvTransfoParam &m21, IlvTransfoParam &m22, IlvTransfoParam &x0, IlvTransfoParam &y0) const
 Accesses the values stored in the object. More...
 
void getValues (IlvTransfoParam &x0, IlvTransfoParam &y0) const
 Accesses the values stored in the object. More...
 
IlBoolean inverse (IlvFloatPoint &p) const
 Applies the inverse transformation. More...
 
IlBoolean inverse (IlvPoint &p) const
 Applies the inverse transformation. More...
 
IlBoolean inverse (IlvRect &rect) const
 Applies the inverse transformation. More...
 
IlBoolean isBad () const
 Indicates whether the transformer is reversible. More...
 
IlBoolean isIdentity () const
 Indicates whether the current object represents the identity transformation. More...
 
IlBoolean isScale () const
 Indicates whether the current object is a scaling transformation. More...
 
IlBoolean isSimilar (const IlvTransformer &other) const
 Indicates whether a transformer is similar to the current transformer. More...
 
IlBoolean isTranslation () const
 Indicates whether the current object is a translation transformation. More...
 
void rotate (IlvTransfoParam centerx, IlvTransfoParam centery, IlvTransfoParam angle)
 Composes the transformer with a rotation. More...
 
void scale (IlvTransfoParam fixedx, IlvTransfoParam fixedy, IlvTransfoParam sx, IlvTransfoParam sy)
 Composes the transformer with a scaling operation. More...
 
void setValues (IlvTransfoParam m11, IlvTransfoParam m12, IlvTransfoParam m21, IlvTransfoParam m22, IlvTransfoParam x0, IlvTransfoParam y0)
 Sets the values that define the current IlvTransformer object. More...
 
void setValues (IlvTransfoParam x0, IlvTransfoParam y0)
 Sets the values that define the current IlvTransformer object. More...
 
void translate (IlvTransfoParam dx, IlvTransfoParam dy)
 Composes the transformer with a translation. More...
 

Detailed Description

Geometric transformation class.

Library: xviews or winviews or mviews (mutually exclusive)

The IlvTransformer class internally computes two-dimensional affine transformations, thus allowing geometrical transformations of graphic objects. The IlvTransformer API is based on the IlvTransfoParam type.

Constructor & Destructor Documentation

◆ IlvTransformer() [1/6]

IlvTransformer::IlvTransformer ( )

Constructor.

This constructor sets the values of the object so that the geometric transformation is the identity transformation; that is, a transformation that does not change its operands.

◆ IlvTransformer() [2/6]

IlvTransformer::IlvTransformer ( IlvTransfoParam  m11,
IlvTransfoParam  m12,
IlvTransfoParam  m21,
IlvTransfoParam  m22,
IlvTransfoParam  x0,
IlvTransfoParam  y0 
)

Constructor.

This constructor sets the values of the object so that the represented transformation will be applied by transforming the coordinates of a point p at (x, y) to a transformed point tp at (tx, ty) according to the following formula:

which leads to:

These objects are used each time a geometrical transformation is computed.

◆ IlvTransformer() [3/6]

IlvTransformer::IlvTransformer ( const IlvPoint center,
IlvTransfoParam  angle 
)

Constructor.

This constructor initializes a new IlvTransformer instance that corresponds to a rotation of angle degrees around the center point center.

Parameters
centerThe center point of the rotation.
angleThe angle of rotation in degrees.

◆ IlvTransformer() [4/6]

IlvTransformer::IlvTransformer ( IlvTransfoParam  sx,
IlvTransfoParam  sy,
IlvPoint point = 0 
)

Constructor.

This constructor initializes a new IlvTransformer instance that corresponds to a scaling operation specified by the sx and sy parameters. This transformation will leave the point coordinates unchanged. If you do not specify this point, (0, 0) will remain fixed.

Parameters
sxScaling in the x direction.
syScaling in the y direction.
pointOptional fixed point.

◆ IlvTransformer() [5/6]

IlvTransformer::IlvTransformer ( const IlvRect src,
const IlvRect dst 
)

Constructor.

This constructor initializes a new IlvTransformer instance that stores the scaling and translation factors that transforms the rectangle src to dst, with no rotation.

Parameters
srcThe initial rectangle.
dstThe final rectangle, after transformation.

◆ IlvTransformer() [6/6]

IlvTransformer::IlvTransformer ( const IlvPoint delta)

Constructor.

This constructor initializes a new IlvTransformer instance that corresponds to the translation specified in the delta parameter.

Parameters
deltaThe translation required.

Member Function Documentation

◆ apply() [1/5]

void IlvTransformer::apply ( IlUInt  count,
IlvPoint points 
) const

Applies the transformer to a point set.

Applies the transformer to the all points of the array points, replacing them by their transformed version.

Parameters
countThe number of points to transform.
pointsThe array of at least count points to transform.

◆ apply() [2/5]

void IlvTransformer::apply ( IlvDoublePoint p) const

Applies the transformer to a point.

Applies the transformer to the p parameter, which is modified by the function call.

Parameters
pThe point to transform.

◆ apply() [3/5]

void IlvTransformer::apply ( IlvFloatPoint p) const

Applies the transformer to a point.

Applies the transformer to the p parameter, which is modified by the function call.

Parameters
pThe point to transform.

◆ apply() [4/5]

void IlvTransformer::apply ( IlvPoint p) const

Applies the transformer.

Applies the transformer to the p parameter, which is modified by the function call.

Parameters
pThe point to transform.

◆ apply() [5/5]

void IlvTransformer::apply ( IlvRect rect) const

Applies the transformer to a rectangle.

Applies the transformer to the rect parameter, which is modified by the function call.

Parameters
rectThe rectangle to transform.

◆ applyAndFill()

void IlvTransformer::applyAndFill ( IlvRect rect) const

Applies the transformer.

Calls apply(IlvRect&) with the rect parameter. It ensures that the rectangle will not be returned empty once the transformer has been applied. It does so by setting to 1 any dimension previously set to 0.

Parameters
rectThe rectangle to transform.

◆ compose()

void IlvTransformer::compose ( const IlvTransformer t)

Computes the composition of two transformers.

Computes the composition of two transformers. It modifies the current IlvTransformer by composing it with the one given in the t parameter. Using a mixture of mathematical and C++ notation, one could define the composed transformer as T1.compose(T2) (x) = T2(T1(x)) = T2 o T1 (x).

Parameters
tThe transformer to compose with.

◆ compute()

IlBoolean IlvTransformer::compute ( const IlvRect src,
const IlvRect dst 
)

Stores the scaling and translation factors.

Stores, in the current object, the scaling and translation factors that transform the rectangle src to dst with no rotation. If this operation cannot be performed it leaves the current object unmodified.

Parameters
srcThe initial rectangle.
dstThe final rectangle, after transformation.
Returns
IlTrue if successful, and IlFalse otherwise.

◆ computeInverse()

IlBoolean IlvTransformer::computeInverse ( IlvTransformer t) const

Stores the inverse transformation values.

Stores, in the inverse parameter, the inverse transformation values of the current object.

If this operation cannot be performed it leaves inverse unmodified.

Returns
IlTrue if successful, and IlFalse otherwise.

◆ deltaApply()

void IlvTransformer::deltaApply ( IlvPoint p) const

Applies the transformer without the translation.

Applies the current transformer to the p parameter but without the translation parameters. This lets you compute transformed vectors.

Parameters
pThe point to transform.

◆ getDeterminant()

IlDouble IlvTransformer::getDeterminant ( ) const

Gets the determinant of the matrix.

Returns
The determinant of the matrix.

◆ getValues() [1/2]

void IlvTransformer::getValues ( IlvTransfoParam m11,
IlvTransfoParam m12,
IlvTransfoParam m21,
IlvTransfoParam m22,
IlvTransfoParam x0,
IlvTransfoParam y0 
) const

Accesses the values stored in the object.

Accesses the values stored in the object.

◆ getValues() [2/2]

void IlvTransformer::getValues ( IlvTransfoParam x0,
IlvTransfoParam y0 
) const

Accesses the values stored in the object.

Accesses the values stored in the object.

◆ inverse() [1/3]

IlBoolean IlvTransformer::inverse ( IlvFloatPoint p) const

Applies the inverse transformation.

Applies the inverse transformation stored in this object to the p parameter, which is modified by the function call. The argument is not modified if the transformation cannot be inverted.

Parameters
pThe point to transform.
Returns
IlFalse if the transformation cannot be inverted. Otherwise, it returns IlTrue.

◆ inverse() [2/3]

IlBoolean IlvTransformer::inverse ( IlvPoint p) const

Applies the inverse transformation.

Applies the inverse transformation stored in this object to p, which is modified by the function call. The argument is not modified if the transformation cannot be inverted.

Parameters
pThe point to transform.
Returns
IlFalse if the transformation cannot be inverted. Otherwise, it returns IlTrue.

◆ inverse() [3/3]

IlBoolean IlvTransformer::inverse ( IlvRect rect) const

Applies the inverse transformation.

Applies the inverse transformation stored in this object to the rect parameter, which is modified by the function call. The argument is not modified if the transformation cannot be inverted.

Parameters
rectThe rectangle to transform.
Returns
IlFalse if the transformation cannot be inverted. Otherwise, it returns IlTrue.

◆ isBad()

IlBoolean IlvTransformer::isBad ( ) const

Indicates whether the transformer is reversible.

Returns an IlBoolean value that indicates whether the transformer is reversible. If it is not reversible, you cannot call inverse().

Returns
An IlBoolean value that, if IlTrue, indicates that the transformer is not reversible.

◆ isIdentity()

IlBoolean IlvTransformer::isIdentity ( ) const

Indicates whether the current object represents the identity transformation.

Indicates whether the current object represents the identity transformation; that is, a transformation that does not change its operands.

Returns
IlTrue if the current object represents the identity transformation. Otherwise, it returns IlFalse.

◆ isScale()

IlBoolean IlvTransformer::isScale ( ) const

Indicates whether the current object is a scaling transformation.

Indicates whether the current object is a scaling transformation; that is, a transformation that applies itself without changing the definition axis of the operands. If it returns IlFalse the transformer is more complex (for example, a rotation, or a shearing effect).

Returns
IlTrue if the current object is a scaling transformation. Otherwise, it returns IlFalse.

◆ isSimilar()

IlBoolean IlvTransformer::isSimilar ( const IlvTransformer other) const

Indicates whether a transformer is similar to the current transformer.

Two transformers are considered as similar if the composition of one with the inverse of the other result in a transformer that is considered the identity transformer.

Parameters
otherThe transformer that is tested to be similar to the current object.
Returns
IlTrue if the current object is similar to other and IlFalse if it is not. If the current transformer cannot be inverted this method returns IlFalse.

◆ isTranslation()

IlBoolean IlvTransformer::isTranslation ( ) const

Indicates whether the current object is a translation transformation.

Indicates whether the current object is a translation transformation; that is, a transformation that applies itself without changing the direction and dimensions of its operands.

Returns
IlTrue if the current object is a translation transformation. Otherwise, it returns IlFalse.

◆ rotate()

void IlvTransformer::rotate ( IlvTransfoParam  centerx,
IlvTransfoParam  centery,
IlvTransfoParam  angle 
)

Composes the transformer with a rotation.

Composes the current transformer with a rotation of angle degrees around the (centerx, centery) point.x

Parameters
centerxCenter of rotation in the x direction.
centeryCenter of rotation in the y direction.
angleAngle of rotation in degrees.

◆ scale()

void IlvTransformer::scale ( IlvTransfoParam  fixedx,
IlvTransfoParam  fixedy,
IlvTransfoParam  sx,
IlvTransfoParam  sy 
)

Composes the transformer with a scaling operation.

Composes the current transformer with a scaling operation of sx by sy, leaving the point (fixedx, fixedy) unchanged.

Parameters
fixedxx point to leave unchanged.
fixedyy point to leave unchanged.
sxScaling in the x direction.
syScaling in the y direction.

◆ setValues() [1/2]

void IlvTransformer::setValues ( IlvTransfoParam  m11,
IlvTransfoParam  m12,
IlvTransfoParam  m21,
IlvTransfoParam  m22,
IlvTransfoParam  x0,
IlvTransfoParam  y0 
)

Sets the values that define the current IlvTransformer object.

Changes the values that define the current IlvTransformer object.

◆ setValues() [2/2]

void IlvTransformer::setValues ( IlvTransfoParam  x0,
IlvTransfoParam  y0 
)

Sets the values that define the current IlvTransformer object.

Changes the values that define the current IlvTransformer object.

◆ translate()

void IlvTransformer::translate ( IlvTransfoParam  dx,
IlvTransfoParam  dy 
)

Composes the transformer with a translation.

Composes the current transformer with a (dx, dy) translation.

Parameters
dxDistance to translate in the x direction.
dyDistance to translate in the y direction.