Notation used in Ruby API documentation
Module: db
Description: A simple transformation
Simple transformations only provide rotations about angles which a multiples of 90 degree. Together with the mirror options, this results in 8 distinct orientations (fixpoint transformations). These can be combined with a displacement which is applied after the rotation/mirror. This version acts on integer coordinates. A version for floating-point coordinates is DTrans.
Here are some examples for using the Trans class:
t = RBA::Trans::new(0, 100) # displacement by 100 DBU in y direction # the inverse: -> "r0 0,-100" t.inverted.to_s # concatenation: -> "r90 -100,0" (RBA::Trans::R90 * t).to_s # apply to a point: -> "0,100" RBA::Trans::R90.trans(RBA::Point::new(100, 0))
See The Database API for more details about the database objects.
new Trans ptr | new | (const DTrans dtrans) | Creates an integer coordinate transformation from a floating-point coordinate transformation |
new Trans ptr | new | Creates a unit transformation | |
new Trans ptr | new | (const Trans c, const Vector u = 0,0) | Creates a transformation from another transformation plus a displacement |
new Trans ptr | new | (const Trans c, int x = 0, int y = 0) | Creates a transformation from another transformation plus a displacement |
new Trans ptr | new | (int rot = 0, bool mirrx = false, const Vector u = 0,0) | Creates a transformation using angle and mirror flag |
new Trans ptr | new | (int rot = 0, bool mirrx = false, int x = 0, int y = 0) | Creates a transformation using angle and mirror flag and two coordinate values for displacement |
new Trans ptr | new | (const Vector u) | Creates a transformation using a displacement only |
new Trans ptr | new | (int x, int y) | Creates a transformation using a displacement given as two coordinates |
[const] | bool | != | (const Trans other) | Tests for inequality |
[const] | long | * | (long d) | Transforms a single distance |
[const] | Point | * | (const Point p) | Transforms a point |
[const] | Vector | * | (const Vector v) | 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] | Trans | * | (const Trans t) | Returns the concatenated transformation |
[const] | bool | < | (const Trans other) | Provides a 'less' criterion for sorting |
[const] | bool | == | (const Trans other) | Tests for equality |
[const] | Trans ptr | _const_cast | Returns a non-const reference to self. | |
void | _create | Ensures the C++ object is created | ||
void | _destroy | Explicitly 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 | _manage | Marks the object as managed by the script side. | ||
void | _unmanage | Marks the object as no longer owned by the script side. | ||
[const] | int | angle | Gets the angle in units of 90 degree | |
void | angle= | (int a) | Sets the angle in units of 90 degree | |
void | assign | (const Trans other) | Assigns another object to self | |
[const] | long | ctrans | (long d) | Transforms a single distance |
[const] | Vector | disp | Gets to the displacement vector | |
void | disp= | (const Vector u) | Sets the displacement | |
[const] | new Trans ptr | dup | Creates a copy of self | |
[const] | unsigned long | hash | Computes a hash value | |
Trans | invert | Inverts the transformation (in place) | ||
[const] | Trans | inverted | Returns the inverted transformation | |
[const] | bool | is_mirror? | Gets the mirror flag | |
void | mirror= | (bool m) | Sets the mirror flag | |
[const] | int | rot | Gets the angle/mirror code | |
void | rot= | (int r) | Sets the angle/mirror code | |
[const] | DTrans | to_dtype | (double dbu = 1) | Converts the transformation to a floating-point coordinate transformation |
[const] | string | to_s | (double dbu = 0) | String conversion |
[const] | Point | trans | (const Point p) | Transforms a point |
[const] | Vector | trans | (const Vector v) | Transforms a vector |
[const] | Box | trans | (const Box box) | Transforms a box |
[const] | Edge | trans | (const Edge edge) | Transforms an edge |
[const] | Polygon | trans | (const Polygon polygon) | Transforms a polygon |
[const] | Path | trans | (const Path path) | Transforms a path |
[const] | Text | trans | (const Text text) | Transforms a text |
Trans | M0 | A constant giving "mirrored at the x-axis" transformation | ||
Trans | M135 | A constant giving "mirrored at the 135 degree axis" transformation | ||
Trans | M45 | A constant giving "mirrored at the 45 degree axis" transformation | ||
Trans | M90 | A constant giving "mirrored at the y (90 degree) axis" transformation | ||
Trans | R0 | A constant giving "unrotated" (unit) transformation | ||
Trans | R180 | A constant giving "rotated by 180 degree counterclockwise" transformation | ||
Trans | R270 | A constant giving "rotated by 270 degree counterclockwise" transformation | ||
Trans | R90 | A constant giving "rotated by 90 degree counterclockwise" transformation | ||
new Trans ptr | from_s | (string s) | Creates a transformation from a string |
void | create | Use of this method is deprecated. Use _create instead | ||
void | destroy | Use of this method is deprecated. Use _destroy instead | ||
[const] | bool | destroyed? | Use of this method is deprecated. Use _destroyed? instead | |
[static] | new Trans ptr | from_dtrans | (const DTrans dtrans) | Use of this method is deprecated. Use new instead |
[const] | bool | is_const_object? | Use of this method is deprecated. Use _is_const_object? instead |
!= | Signature: [const] bool != (const Trans other) Description: Tests for inequality | |||||||
* | (1) Signature: [const] long * (long d) Description: Transforms a single distance
The "ctrans" method transforms the given distance. This is equivalent to multiplying with the magnification. For the simple transformations, there is no magnification and no modification of the distance. The product '*' has been added as a synonym in version 0.28. The distance can be signed since version 0.29.3. Python specific notes: | |||||||
(2) Signature: [const] Point * (const Point p) Description: Transforms a point
The "trans" method or the * operator transforms the given point. q = t(p) The * operator has been introduced in version 0.25. Python specific notes: | ||||||||
(3) Signature: [const] Vector * (const Vector v) Description: Transforms a vector
The "trans" method or the * operator transforms the given vector. w = t(v) Vector transformation has been introduced in version 0.25. Python specific notes: | ||||||||
(4) Signature: [const] Box * (const Box box) Description: Transforms a box
't*box' or 't.trans(box)' is equivalent to box.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(5) Signature: [const] Edge * (const Edge edge) Description: Transforms an edge
't*edge' or 't.trans(edge)' is equivalent to edge.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(6) Signature: [const] Polygon * (const Polygon polygon) Description: Transforms a polygon
't*polygon' or 't.trans(polygon)' is equivalent to polygon.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(7) Signature: [const] Path * (const Path path) Description: Transforms a path
't*path' or 't.trans(path)' is equivalent to path.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(8) Signature: [const] Text * (const Text text) Description: Transforms a text
't*text' or 't.trans(text)' is equivalent to text.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(9) Signature: [const] Trans * (const Trans t) Description: Returns the concatenated transformation
The * operator returns self*t ("t is applied before this transformation"). | ||||||||
< | Signature: [const] bool < (const Trans 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 Trans other) Description: Tests for equality | |||||||
M0 | Signature: [static] Trans 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. Python specific notes: | |||||||
M135 | Signature: [static] Trans 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. Python specific notes: | |||||||
M45 | Signature: [static] Trans 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. Python specific notes: | |||||||
M90 | Signature: [static] Trans 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. Python specific notes: | |||||||
R0 | Signature: [static] Trans R0 Description: A constant giving "unrotated" (unit) transformation The previous integer constant has been turned into a transformation in version 0.25. Python specific notes: | |||||||
R180 | Signature: [static] Trans 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. Python specific notes: | |||||||
R270 | Signature: [static] Trans 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. Python specific notes: | |||||||
R90 | Signature: [static] Trans 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. Python specific notes: | |||||||
_const_cast | Signature: [const] Trans ptr _const_cast Description: Returns a non-const reference to self. Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects. This method has been introduced in version 0.29.6. | |||||||
_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] int angle Description: Gets the angle in units of 90 degree This value delivers the rotation component. In addition, a mirroring at the x axis may be applied before if the is_mirror? property is true. Python specific notes: | |||||||
angle= | Signature: void angle= (int a) Description: Sets the angle in units of 90 degree
This method was introduced in version 0.20. Python specific notes: | |||||||
assign | Signature: void assign (const Trans 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 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. | |||||||
ctrans | Signature: [const] long ctrans (long d) Description: Transforms a single distance
The "ctrans" method transforms the given distance. This is equivalent to multiplying with the magnification. For the simple transformations, there is no magnification and no modification of the distance. The product '*' has been added as a synonym in version 0.28. The distance can be signed since version 0.29.3. Python specific notes: | |||||||
destroy | Signature: void destroy Description: Explicitly destroys the object Use of this method is deprecated. Use _destroy instead 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 Use of this method is deprecated. Use _destroyed? instead 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. | |||||||
disp | Signature: [const] Vector disp Description: Gets to the displacement vector Staring with version 0.25 the displacement type is a vector. Python specific notes: | |||||||
disp= | Signature: void disp= (const Vector u) Description: Sets the displacement
This method was introduced in version 0.20. Staring with version 0.25 the displacement type is a vector. Python specific notes: | |||||||
dup | Signature: [const] new Trans ptr dup Description: Creates a copy of self Python specific notes: | |||||||
from_dtrans | Signature: [static] new Trans ptr from_dtrans (const DTrans dtrans) Description: Creates an integer coordinate transformation from a floating-point coordinate transformation Use of this method is deprecated. Use new instead This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. Python specific notes: | |||||||
from_s | Signature: [static] new Trans ptr from_s (string s) Description: Creates a transformation from a string Creates the object from a string representation (as returned by to_s) This method has been added in version 0.23. | |||||||
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: | |||||||
invert | Signature: Trans invert Description: Inverts the transformation (in place)
Inverts the transformation and replaces this object by the inverted one. | |||||||
inverted | Signature: [const] Trans inverted Description: Returns the inverted transformation
Returns the inverted 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 This method returns true, if self is a const reference. In that case, only const methods may be called on self. | |||||||
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. Python specific notes: | |||||||
mirror= | Signature: void mirror= (bool m) Description: Sets the mirror flag
"mirroring" describes a reflection at the x-axis which is included in the transformation prior to rotation. This method was introduced in version 0.20. Python specific notes: | |||||||
new | (1) Signature: [static] new Trans ptr new (const DTrans dtrans) Description: Creates an integer coordinate transformation from a floating-point coordinate transformation This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. Python specific notes: | |||||||
(2) Signature: [static] new Trans ptr new Description: Creates a unit transformation Python specific notes: | ||||||||
(3) Signature: [static] new Trans ptr new (const Trans c, const Vector u = 0,0) Description: Creates a transformation from another transformation plus a 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: | ||||||||
(4) Signature: [static] new Trans ptr new (const Trans c, int x = 0, int y = 0) Description: Creates a transformation from another transformation plus a 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: | ||||||||
(5) Signature: [static] new Trans ptr new (int rot = 0, bool mirrx = false, const Vector u = 0,0) Description: Creates a transformation using angle and mirror flag
The sequence of operations is: mirroring at x axis, rotation, application of displacement. Python specific notes: | ||||||||
(6) Signature: [static] new Trans ptr new (int rot = 0, bool mirrx = false, int x = 0, int y = 0) Description: Creates a transformation using angle and mirror flag and two coordinate values for displacement
The sequence of operations is: mirroring at x axis, rotation, application of displacement. Python specific notes: | ||||||||
(7) Signature: [static] new Trans ptr new (const Vector u) Description: Creates a transformation using a displacement only
Python specific notes: | ||||||||
(8) Signature: [static] new Trans ptr new (int x, int y) Description: Creates a transformation using a displacement given as two coordinates
Python specific notes: | ||||||||
rot | Signature: [const] int rot Description: Gets the angle/mirror code The angle/mirror code is one of the constants R0, R90, R180, R270, M0, M45, M90 and M135. rx is the rotation by an angle of x counter clockwise. mx is the mirroring at the axis given by the angle x (to the x-axis). Python specific notes: | |||||||
rot= | Signature: void rot= (int r) Description: Sets the angle/mirror code
This method was introduced in version 0.20. Python specific notes: | |||||||
to_dtype | Signature: [const] DTrans to_dtype (double dbu = 1) Description: Converts the transformation to a floating-point coordinate transformation The database unit can be specified to translate the integer-coordinate transformation into a floating-point coordinate transformation in micron units. The database unit is basically a scaling factor. This method has been introduced in version 0.25. | |||||||
to_s | Signature: [const] string to_s (double dbu = 0) Description: String conversion If a DBU is given, the output units will be micrometers. The DBU argument has been added in version 0.27.6. Python specific notes: | |||||||
trans | (1) Signature: [const] Point trans (const Point p) Description: Transforms a point
The "trans" method or the * operator transforms the given point. q = t(p) The * operator has been introduced in version 0.25. Python specific notes: | |||||||
(2) Signature: [const] Vector trans (const Vector v) Description: Transforms a vector
The "trans" method or the * operator transforms the given vector. w = t(v) Vector transformation has been introduced in version 0.25. Python specific notes: | ||||||||
(3) Signature: [const] Box trans (const Box box) Description: Transforms a box
't*box' or 't.trans(box)' is equivalent to box.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(4) Signature: [const] Edge trans (const Edge edge) Description: Transforms an edge
't*edge' or 't.trans(edge)' is equivalent to edge.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(5) Signature: [const] Polygon trans (const Polygon polygon) Description: Transforms a polygon
't*polygon' or 't.trans(polygon)' is equivalent to polygon.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(6) Signature: [const] Path trans (const Path path) Description: Transforms a path
't*path' or 't.trans(path)' is equivalent to path.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: | ||||||||
(7) Signature: [const] Text trans (const Text text) Description: Transforms a text
't*text' or 't.trans(text)' is equivalent to text.transformed(t). This convenience method has been introduced in version 0.25. Python specific notes: |