API reference - Class ICplxTrans

Notation used in Ruby API documentation

Description: A complex transformation

A complex transformation provides magnification, mirroring at the x-axis, rotation by an arbitary angle and a displacement. This is also the order, the operations are applied. This version can transform integer-coordinate objects into the same, which may involve rounding and can be inexact.

Complex transformations are extensions of the simple transformation classes (Trans in that case) and behave similar.

Transformations can be used to transform points or other objects. Transformations can be combined with the '*' operator to form the transformation which is equivalent to applying the second and then the first. Here is some code:

# Create a transformation that applies a magnication of 1.5, a rotation by 90 degree
# and displacement of 10 in x and 20 units in y direction:
t = RBA::ICplxTrans::new(1.5, 90, false, 10.0, 20.0)
t.to_s            # r90 *1.5 10,20
# compute the inverse:
t.inverted.to_s   # r270 *0.666666667 -13,7
# Combine with another displacement (applied after that):
(RBA::ICplxTrans::new(5, 5) * t).to_s    # r90 *1.5 15,25
# Transform a point:
t.trans(RBA::Point::new(100, 200)).to_s  # -290,170

This class has been introduced in version 0.18.

See The Database API for more details about the database objects.

Public constructors

new ICplxTrans ptrnew(const DCplxTrans trans)Creates a floating-point coordinate transformation from another coordinate flavour
new ICplxTrans ptrnew(const CplxTrans trans)Creates a floating-point coordinate transformation from another coordinate flavour
new ICplxTrans ptrnew(const VCplxTrans trans)Creates a floating-point coordinate transformation from another coordinate flavour
new ICplxTrans ptrnewCreates a unit transformation
new ICplxTrans ptrnew(const ICplxTrans c,
double m = 1,
const Vector u = 0,0)
Creates a transformation from another transformation plus a magnification and displacement
new ICplxTrans ptrnew(const ICplxTrans c,
double m,
int x,
int y)
Creates a transformation from another transformation plus a magnification and displacement
new ICplxTrans ptrnew(int x,
int y)
Creates a transformation from a x and y displacement
new ICplxTrans ptrnew(double m)Creates a transformation from a magnification
new ICplxTrans ptrnew(const Trans t,
double m)
Creates a transformation from a simple transformation and a magnification
new ICplxTrans ptrnew(const Trans t)Creates a transformation from a simple transformation alone
new ICplxTrans ptrnew(const Vector u)Creates a transformation from a displacement
new ICplxTrans ptrnew(double mag,
double rot,
bool mirrx,
const Vector u)
Creates a transformation using magnification, angle, mirror flag and displacement
new ICplxTrans ptrnew(double mag,
double rot,
bool mirrx,
int x,
int y)
Creates a transformation using magnification, angle, mirror flag and displacement

Public methods

[const]bool!=(const ICplxTrans other)Tests for inequality
[const]VCplxTrans*(const VCplxTrans t)Multiplication (concatenation) of transformations
[const]Point*(const Point p)Transforms a point
[const]Vector*(const Vector p)Transforms a vector
[const]Box*(const Box box)Transforms a box
[const]Edge*(const Edge edge)Transforms an edge
[const]Polygon*(const Polygon polygon)Transforms a polygon
[const]Path*(const Path path)Transforms a path
[const]Text*(const Text text)Transforms a text
[const]ICplxTrans*(const ICplxTrans t)Returns the concatenated transformation
[const]bool<(const ICplxTrans other)Provides a 'less' criterion for sorting
[const]bool==(const ICplxTrans other)Tests for equality
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[const]doubleangleGets the angle
voidangle=(double a)Sets the angle
voidassign(const ICplxTrans other)Assigns another object to self
[const]unsigned intctrans(unsigned int d)Transforms a distance
[const]VectordispGets the displacement
voiddisp=(const Vector u)Sets the displacement
[const]new ICplxTrans ptrdupCreates a copy of self
[const]unsigned longhashComputes a hash value
ICplxTransinvertInverts the transformation (in place)
[const]ICplxTransinvertedReturns the inverted transformation
[const]boolis_mag?Test, if the transformation is a magnifying one
[const]boolis_mirror?Gets the mirror flag
[const]boolis_ortho?Tests, if the transformation is an orthogonal transformation
[const]boolis_unity?Tests, whether this is a unit transformation
[const]doublemagGets the magnification
voidmag=(double m)Sets the magnification
voidmirror=(bool m)Sets the mirror flag
[const]introtReturns the respective simple transformation equivalent rotation code if possible
[const]Transs_transExtracts the simple transformation part
[const]DCplxTransto_itrans(double dbu = 1)Converts the transformation to another transformation with floating-point input and output coordinates
[const]stringto_sString conversion
[const]VCplxTransto_transConverts the transformation to another transformation with floating-point input coordinates
[const]CplxTransto_vtrans(double dbu = 1)Converts the transformation to another transformation with floating-point output coordinates
[const]Pointtrans(const Point p)Transforms a point
[const]Vectortrans(const Vector p)Transforms a vector
[const]Boxtrans(const Box box)Transforms a box
[const]Edgetrans(const Edge edge)Transforms an edge
[const]Polygontrans(const Polygon polygon)Transforms a polygon
[const]Pathtrans(const Path path)Transforms a path
[const]Texttrans(const Text text)Transforms a text

Public static methods and constants

ICplxTransM0A constant giving "mirrored at the x-axis" transformation
ICplxTransM135A constant giving "mirrored at the 135 degree axis" transformation
ICplxTransM45A constant giving "mirrored at the 45 degree axis" transformation
ICplxTransM90A constant giving "mirrored at the y (90 degree) axis" transformation
ICplxTransR0A constant giving "unrotated" (unit) transformation
ICplxTransR180A constant giving "rotated by 180 degree counterclockwise" transformation
ICplxTransR270A constant giving "rotated by 270 degree counterclockwise" transformation
ICplxTransR90A constant giving "rotated by 90 degree counterclockwise" transformation
new ICplxTrans ptrfrom_s(string s)Creates an object from a string

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[static]new ICplxTrans ptrfrom_dtrans(const DCplxTrans trans)Use of this method is deprecated. Use new instead
[static]new ICplxTrans ptrfrom_trans(const CplxTrans trans)Use of this method is deprecated. Use new instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

!=

Signature: [const] bool != (const ICplxTrans other)

Description: Tests for inequality

*

Signature: [const] VCplxTrans * (const VCplxTrans t)

Description: Multiplication (concatenation) of transformations

t:The transformation to apply before
Returns:The modified transformation

The * operator returns self*t ("t is applied before this transformation").

Signature: [const] Point * (const Point p)

Description: Transforms a point

p:The point to transform
Returns:The transformed point

The "trans" method or the * operator transforms the given point. q = t(p)

The * operator has been introduced in version 0.25.

Signature: [const] Vector * (const Vector p)

Description: Transforms a vector

v:The vector to transform
Returns:The transformed vector

The "trans" method or the * operator transforms the given vector. w = t(v)

Vector transformation has been introduced in version 0.25.

Signature: [const] Box * (const Box box)

Description: Transforms a box

box:The box to transform
Returns:The transformed box

't*box' or 't.trans(box)' is equivalent to box.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Edge * (const Edge edge)

Description: Transforms an edge

edge:The edge to transform
Returns:The transformed edge

't*edge' or 't.trans(edge)' is equivalent to edge.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Polygon * (const Polygon polygon)

Description: Transforms a polygon

polygon:The polygon to transform
Returns:The transformed polygon

't*polygon' or 't.trans(polygon)' is equivalent to polygon.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Path * (const Path path)

Description: Transforms a path

path:The path to transform
Returns:The transformed path

't*path' or 't.trans(path)' is equivalent to path.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Text * (const Text text)

Description: Transforms a text

text:The text to transform
Returns:The transformed text

't*text' or 't.trans(text)' is equivalent to text.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] ICplxTrans * (const ICplxTrans t)

Description: Returns the concatenated transformation

t:The transformation to apply before
Returns:The modified transformation

The * operator returns self*t ("t is applied before this transformation").

<

Signature: [const] bool < (const ICplxTrans other)

Description: Provides a 'less' criterion for sorting

This method is provided to implement a sorting order. The definition of 'less' is opaque and might change in future versions.

==

Signature: [const] bool == (const ICplxTrans other)

Description: Tests for equality

M0

Signature: [static] ICplxTrans M0

Description: A constant giving "mirrored at the x-axis" transformation

The previous integer constant has been turned into a transformation in version 0.25.

M135

Signature: [static] ICplxTrans M135

Description: A constant giving "mirrored at the 135 degree axis" transformation

The previous integer constant has been turned into a transformation in version 0.25.

M45

Signature: [static] ICplxTrans M45

Description: A constant giving "mirrored at the 45 degree axis" transformation

The previous integer constant has been turned into a transformation in version 0.25.

M90

Signature: [static] ICplxTrans M90

Description: A constant giving "mirrored at the y (90 degree) axis" transformation

The previous integer constant has been turned into a transformation in version 0.25.

R0

Signature: [static] ICplxTrans R0

Description: A constant giving "unrotated" (unit) transformation

The previous integer constant has been turned into a transformation in version 0.25.

R180

Signature: [static] ICplxTrans R180

Description: A constant giving "rotated by 180 degree counterclockwise" transformation

The previous integer constant has been turned into a transformation in version 0.25.

R270

Signature: [static] ICplxTrans R270

Description: A constant giving "rotated by 270 degree counterclockwise" transformation

The previous integer constant has been turned into a transformation in version 0.25.

R90

Signature: [static] ICplxTrans R90

Description: A constant giving "rotated by 90 degree counterclockwise" transformation

The previous integer constant has been turned into a transformation in version 0.25.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

angle

Signature: [const] double angle

Description: Gets the angle

Returns:The rotation angle this transformation provides in degree units (0..360 deg).

Note that the simple transformation returns the angle in units of 90 degree. Hence for a simple trans (i.e. Trans), a rotation angle of 180 degree delivers a value of 2 for the angle attribute. The complex transformation, supporting any rotation angle returns the angle in degree.

Python specific notes:
The object exposes a readable attribute 'angle'. This is the getter.

angle=

Signature: void angle= (double a)

Description: Sets the angle

a:The new angle

See angle for a description of that attribute.

Python specific notes:
The object exposes a writable attribute 'angle'. This is the setter.

assign

Signature: void assign (const ICplxTrans other)

Description: Assigns another object to self

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

ctrans

Signature: [const] unsigned int ctrans (unsigned int d)

Description: Transforms a distance

d:The distance to transform
Returns:The transformed distance

The "ctrans" method transforms the given distance. e = t(d). For the simple transformations, there is no magnification and no modification of the distance therefore.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

disp

Signature: [const] Vector disp

Description: Gets the displacement

Python specific notes:
The object exposes a readable attribute 'disp'. This is the getter.

disp=

Signature: void disp= (const Vector u)

Description: Sets the displacement

u:The new displacement

Python specific notes:
The object exposes a writable attribute 'disp'. This is the setter.

dup

Signature: [const] new ICplxTrans ptr dup

Description: Creates a copy of self

from_dtrans

Signature: [static] new ICplxTrans ptr from_dtrans (const DCplxTrans trans)

Description: Creates a floating-point coordinate transformation from another coordinate flavour

Use of this method is deprecated. Use new instead

Python specific notes:
This method is the default initializer of the object

from_s

Signature: [static] new ICplxTrans ptr from_s (string s)

Description: Creates an object from a string

Creates the object from a string representation (as returned by to_s)

This method has been added in version 0.23.

from_trans

Signature: [static] new ICplxTrans ptr from_trans (const CplxTrans trans)

Description: Creates a floating-point coordinate transformation from another coordinate flavour

Use of this method is deprecated. Use new instead

Python specific notes:
This method is the default initializer of the object

hash

Signature: [const] unsigned long hash

Description: Computes a hash value

Returns a hash value for the given transformation. This method enables transformations as hash keys.

This method has been introduced in version 0.25.

Python specific notes:
This method is also available as 'hash(object)'

invert

Signature: ICplxTrans invert

Description: Inverts the transformation (in place)

Returns:The inverted transformation

Inverts the transformation and replaces this transformation by it's inverted one.

inverted

Signature: [const] ICplxTrans inverted

Description: Returns the inverted transformation

Returns:The inverted transformation

Returns the inverted transformation. This method does not modify the transformation.

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

is_mag?

Signature: [const] bool is_mag?

Description: Test, if the transformation is a magnifying one

This is the recommended test for checking if the transformation represents a magnification.

is_mirror?

Signature: [const] bool is_mirror?

Description: Gets the mirror flag

If this property is true, the transformation is composed of a mirroring at the x-axis followed by a rotation by the angle given by the angle property.

is_ortho?

Signature: [const] bool is_ortho?

Description: Tests, if the transformation is an orthogonal transformation

If the rotation is by a multiple of 90 degree, this method will return true.

is_unity?

Signature: [const] bool is_unity?

Description: Tests, whether this is a unit transformation

mag

Signature: [const] double mag

Description: Gets the magnification

Python specific notes:
The object exposes a readable attribute 'mag'. This is the getter.

mag=

Signature: void mag= (double m)

Description: Sets the magnification

m:The new magnification

Python specific notes:
The object exposes a writable attribute 'mag'. This is the setter.

mirror=

Signature: void mirror= (bool m)

Description: Sets the mirror flag

m:The new mirror flag

"mirroring" describes a reflection at the x-axis which is included in the transformation prior to rotation.

Python specific notes:
The object exposes a writable attribute 'mirror'. This is the setter.

new

Signature: [static] new ICplxTrans ptr new (const DCplxTrans trans)

Description: Creates a floating-point coordinate transformation from another coordinate flavour

This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const CplxTrans trans)

Description: Creates a floating-point coordinate transformation from another coordinate flavour

This constructor has been introduced in version 0.25 and replaces the previous static method 'from_trans'.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const VCplxTrans trans)

Description: Creates a floating-point coordinate transformation from another coordinate flavour

This constructor has been introduced in version 0.25.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new

Description: Creates a unit transformation

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const ICplxTrans c,double m = 1,const Vector u = 0,0)

Description: Creates a transformation from another transformation plus a magnification and displacement

c:The original transformation
u:The Additional displacement

Creates a new transformation from a existing transformation. This constructor is provided for creating duplicates and backward compatibility since the constants are transformations now. It will copy the original transformation and add the given displacement.

This variant has been introduced in version 0.25.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const ICplxTrans c,double m,int x,int y)

Description: Creates a transformation from another transformation plus a magnification and displacement

c:The original transformation
x:The Additional displacement (x)
y:The Additional displacement (y)

Creates a new transformation from a existing transformation. This constructor is provided for creating duplicates and backward compatibility since the constants are transformations now. It will copy the original transformation and add the given displacement.

This variant has been introduced in version 0.25.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (int x,int y)

Description: Creates a transformation from a x and y displacement

x:The x displacement
y:The y displacement

This constructor will create a transformation with the specified displacement but no rotation.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (double m)

Description: Creates a transformation from a magnification

Creates a magnifying transformation without displacement and rotation given the magnification m.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const Trans t,double m)

Description: Creates a transformation from a simple transformation and a magnification

Creates a magnifying transformation from a simple transformation and a magnification.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const Trans t)

Description: Creates a transformation from a simple transformation alone

Creates a magnifying transformation from a simple transformation and a magnification of 1.0.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (const Vector u)

Description: Creates a transformation from a displacement

Creates a transformation with a displacement only.

This method has been added in version 0.25.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (double mag,double rot,bool mirrx,const Vector u)

Description: Creates a transformation using magnification, angle, mirror flag and displacement

mag:The magnification
rot:The rotation angle in units of degree
mirrx:True, if mirrored at x axis
u:The displacement

The sequence of operations is: magnification, mirroring at x axis, rotation, application of displacement.

Python specific notes:
This method is the default initializer of the object

Signature: [static] new ICplxTrans ptr new (double mag,double rot,bool mirrx,int x,int y)

Description: Creates a transformation using magnification, angle, mirror flag and displacement

mag:The magnification
rot:The rotation angle in units of degree
mirrx:True, if mirrored at x axis
x:The x displacement
y:The y displacement

The sequence of operations is: magnification, mirroring at x axis, rotation, application of displacement.

Python specific notes:
This method is the default initializer of the object

rot

Signature: [const] int rot

Description: Returns the respective simple transformation equivalent rotation code if possible

If this transformation is orthogonal (is_ortho () == true), then this method will return the corresponding fixpoint transformation, not taking into account magnification and displacement. If the transformation is not orthogonal, the result reflects the quadrant the rotation goes into.

s_trans

Signature: [const] Trans s_trans

Description: Extracts the simple transformation part

The simple transformation part does not reflect magnification or arbitrary angles. Rotation angles are rounded down to multiples of 90 degree. Magnification is fixed to 1.0.

to_itrans

Signature: [const] DCplxTrans to_itrans (double dbu = 1)

Description: Converts the transformation to another transformation with floating-point input and output coordinates

The database unit can be specified to translate the integer coordinate displacement in database units to a floating-point displacement in micron units. The displacement's' coordinates will be multiplied with the database unit.

This method has been introduced in version 0.25.

to_s

Signature: [const] string to_s

Description: String conversion

Python specific notes:
This method is also available as 'str(object)' and 'repr(object)'

to_trans

Signature: [const] VCplxTrans to_trans

Description: Converts the transformation to another transformation with floating-point input coordinates

This method has been introduced in version 0.25.

to_vtrans

Signature: [const] CplxTrans to_vtrans (double dbu = 1)

Description: Converts the transformation to another transformation with floating-point output coordinates

The database unit can be specified to translate the integer coordinate displacement in database units to a floating-point displacement in micron units. The displacement's' coordinates will be multiplied with the database unit.

This method has been introduced in version 0.25.

trans

Signature: [const] Point trans (const Point p)

Description: Transforms a point

p:The point to transform
Returns:The transformed point

The "trans" method or the * operator transforms the given point. q = t(p)

The * operator has been introduced in version 0.25.

Signature: [const] Vector trans (const Vector p)

Description: Transforms a vector

v:The vector to transform
Returns:The transformed vector

The "trans" method or the * operator transforms the given vector. w = t(v)

Vector transformation has been introduced in version 0.25.

Signature: [const] Box trans (const Box box)

Description: Transforms a box

box:The box to transform
Returns:The transformed box

't*box' or 't.trans(box)' is equivalent to box.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Edge trans (const Edge edge)

Description: Transforms an edge

edge:The edge to transform
Returns:The transformed edge

't*edge' or 't.trans(edge)' is equivalent to edge.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Polygon trans (const Polygon polygon)

Description: Transforms a polygon

polygon:The polygon to transform
Returns:The transformed polygon

't*polygon' or 't.trans(polygon)' is equivalent to polygon.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Path trans (const Path path)

Description: Transforms a path

path:The path to transform
Returns:The transformed path

't*path' or 't.trans(path)' is equivalent to path.transformed(t).

This convenience method has been introduced in version 0.25.

Signature: [const] Text trans (const Text text)

Description: Transforms a text

text:The text to transform
Returns:The transformed text

't*text' or 't.trans(text)' is equivalent to text.transformed(t).

This convenience method has been introduced in version 0.25.