KLayout 0.29.8 (2024-11-26 926dac96c) [master]

API reference - Class DEdgePair

Notation used in Ruby API documentation

Module: db

Description: An edge pair (a pair of two edges)

Edge pairs are objects representing two edges or parts of edges. They play a role mainly in the context of DRC functions, where they specify a DRC violation by connecting two edges which violate the condition checked. Within the framework of polygon and edge collections which provide DRC functionality, edges pairs with integer coordinates (EdgePair type) are used in the form of edge pair collections (EdgePairs).

Edge pairs basically consist of two edges, called first and second. If created by a two-layer DRC function, the first edge will correspond to edges from the first layer and the second to edges from the second layer.

This class has been introduced in version 0.23.

Public constructors

new DEdgePair ptrnew(const EdgePair edge_pair)Creates a floating-point coordinate edge pair from an integer coordinate edge
new DEdgePair ptrnewDefault constructor
new DEdgePair ptrnew(const DEdge first,
const DEdge second,
bool symmetric = false)
Constructor from two edges

Public methods

[const]bool!=(const DEdgePair box)Inequality
[const]bool<(const DEdgePair box)Less operator
[const]bool==(const DEdgePair box)Equality
[const]DEdgePair ptr_const_castReturns a non-const reference to self.
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]doubleareaGets the area between the edges of the edge pair
voidassign(const DEdgePair other)Assigns another object to self
[const]DBoxbboxGets the bounding box of the edge pair
[const]doubledistanceGets the distance of the edges in the edge pair
[const]new DEdgePair ptrdupCreates a copy of self
[const]DEdgefirstGets the first edge
voidfirst=(const DEdge edge)Sets the first edge
[const]DEdgegreaterGets the 'greater' edge for symmetric edge pairs
[const]unsigned longhashComputes a hash value
[const]DEdgelesserGets the 'lesser' edge for symmetric edge pairs
[const]DEdgePairnormalizedNormalizes the edge pair
[const]doubleperimeterGets the perimeter of the edge pair
[const]DPolygonpolygon(double e)Convert an edge pair to a polygon
[const]DEdgesecondGets the second edge
voidsecond=(const DEdge edge)Sets the second edge
[const]DSimplePolygonsimple_polygon(double e)Convert an edge pair to a simple polygon
voidsymmetric=(bool flag)Sets a value indicating whether the edge pair is symmetric
[const]boolsymmetric?Returns a value indicating whether the edge pair is symmetric
[const]EdgePairto_itype(double dbu = 1)Converts the edge pair to an integer coordinate edge pair
[const]stringto_s(double dbu = 0)Returns a string representing the edge pair
[const]EdgePairtransformed(const VCplxTrans t)Transforms the edge pair with the given complex transformation
[const]DEdgePairtransformed(const DTrans t)Returns the transformed pair
[const]DEdgePairtransformed(const DCplxTrans t)Returns the transformed edge pair

Public static methods and constants

new DEdgePair 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
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

!=

Signature: [const] bool != (const DEdgePair box)

Description: Inequality

Returns true, if this edge pair and the given one are not equal

This method has been introduced in version 0.25.

<

Signature: [const] bool < (const DEdgePair box)

Description: Less operator

Returns true, if this edge pair is 'less' with respect to first and second edge

This method has been introduced in version 0.25.

==

Signature: [const] bool == (const DEdgePair box)

Description: Equality

Returns true, if this edge pair and the given one are equal

This method has been introduced in version 0.25.

_const_cast

Signature: [const] DEdgePair 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.

area

Signature: [const] double area

Description: Gets the area between the edges of the edge pair

This attribute has been introduced in version 0.28.

assign

Signature: void assign (const DEdgePair other)

Description: Assigns another object to self

bbox

Signature: [const] DBox bbox

Description: Gets the bounding box of the edge pair

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.

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.

distance

Signature: [const] double distance

Description: Gets the distance of the edges in the edge pair

The distance between the two edges is defined as the minimum distance between any two points on the two edges.

This attribute has been introduced in version 0.28.14.

dup

Signature: [const] new DEdgePair ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

first

Signature: [const] DEdge first

Description: Gets the first edge

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

first=

Signature: void first= (const DEdge edge)

Description: Sets the first edge

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

from_s

Signature: [static] new DEdgePair 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.

greater

Signature: [const] DEdge greater

Description: Gets the 'greater' edge for symmetric edge pairs

As first and second edges are commutable for symmetric edge pairs (see symmetric?), this accessor allows retrieving a 'second' edge in a way independent on the actual assignment.

This read-only attribute has been introduced in version 0.27.

hash

Signature: [const] unsigned long hash

Description: Computes a hash value

Returns a hash value for the given edge pair. This method enables edge pairs as hash keys.

This method has been introduced in version 0.25.

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

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.

lesser

Signature: [const] DEdge lesser

Description: Gets the 'lesser' edge for symmetric edge pairs

As first and second edges are commutable for symmetric edge pairs (see symmetric?), this accessor allows retrieving a 'first' edge in a way independent on the actual assignment.

This read-only attribute has been introduced in version 0.27.

new

(1) Signature: [static] new DEdgePair ptr new (const EdgePair edge_pair)

Description: Creates a floating-point coordinate edge pair from an integer coordinate edge

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

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

(2) Signature: [static] new DEdgePair ptr new

Description: Default constructor

This constructor creates an default edge pair.

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

(3) Signature: [static] new DEdgePair ptr new (const DEdge first, const DEdge second, bool symmetric = false)

Description: Constructor from two edges

This constructor creates an edge pair from the two edges given. See symmetric? for a description of this attribute.

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

normalized

Signature: [const] DEdgePair normalized

Description: Normalizes the edge pair

This method normalized the edge pair such that when connecting the edges at their start and end points a closed loop is formed which is oriented clockwise. To achieve this, the points of the first and/or first and second edge are swapped. Normalization is a first step recommended before converting an edge pair to a polygon, because that way the polygons won't be self-overlapping and the enlargement parameter is applied properly.

perimeter

Signature: [const] double perimeter

Description: Gets the perimeter of the edge pair

The perimeter is defined as the sum of the lengths of both edges ('active perimeter').

This attribute has been introduced in version 0.28.

polygon

Signature: [const] DPolygon polygon (double e)

Description: Convert an edge pair to a polygon

e:The enlargement (set to zero for exact representation)

The polygon is formed by connecting the end and start points of the edges. It is recommended to use normalized before converting the edge pair to a polygon.

The enlargement parameter applies the specified enlargement parallel and perpendicular to the edges. Basically this introduces a bias which blows up edge pairs by the specified amount. That parameter is useful to convert degenerated edge pairs to valid polygons, i.e. edge pairs with coincident edges and edge pairs consisting of two point-like edges.

Another version for converting edge pairs to simple polygons is simple_polygon which renders a SimplePolygon object.

second

Signature: [const] DEdge second

Description: Gets the second edge

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

second=

Signature: void second= (const DEdge edge)

Description: Sets the second edge

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

simple_polygon

Signature: [const] DSimplePolygon simple_polygon (double e)

Description: Convert an edge pair to a simple polygon

e:The enlargement (set to zero for exact representation)

The polygon is formed by connecting the end and start points of the edges. It is recommended to use normalized before converting the edge pair to a polygon.

The enlargement parameter applies the specified enlargement parallel and perpendicular to the edges. Basically this introduces a bias which blows up edge pairs by the specified amount. That parameter is useful to convert degenerated edge pairs to valid polygons, i.e. edge pairs with coincident edges and edge pairs consisting of two point-like edges.

Another version for converting edge pairs to polygons is polygon which renders a Polygon object.

symmetric=

Signature: void symmetric= (bool flag)

Description: Sets a value indicating whether the edge pair is symmetric

See symmetric? for a description of this attribute.

Symmetric edge pairs have been introduced in version 0.27.

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

symmetric?

Signature: [const] bool symmetric?

Description: Returns a value indicating whether the edge pair is symmetric

For symmetric edge pairs, the edges are commutable. Specifically, a symmetric edge pair with (e1,e2) is identical to (e2,e1). Symmetric edge pairs are generated by some checks for which there is no directed error marker (width, space, notch, isolated).

Symmetric edge pairs have been introduced in version 0.27.

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

to_itype

Signature: [const] EdgePair to_itype (double dbu = 1)

Description: Converts the edge pair to an integer coordinate edge pair

The database unit can be specified to translate the floating-point coordinate edge pair in micron units to an integer-coordinate edge pair in database units. The edge pair's' coordinates will be divided by the database unit.

This method has been introduced in version 0.25.

to_s

Signature: [const] string to_s (double dbu = 0)

Description: Returns a string representing the edge pair

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:
This method is also available as 'str(object)'.

transformed

(1) Signature: [const] EdgePair transformed (const VCplxTrans t)

Description: Transforms the edge pair with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed edge pair (in this case an integer coordinate edge pair)

This method has been introduced in version 0.25.

(2) Signature: [const] DEdgePair transformed (const DTrans t)

Description: Returns the transformed pair

t:The transformation to apply.
Returns:The transformed edge pair

Transforms the edge pair with the given transformation. Does not modify the edge pair but returns the transformed edge.

(3) Signature: [const] DEdgePair transformed (const DCplxTrans t)

Description: Returns the transformed edge pair

t:The transformation to apply.
Returns:The transformed edge pair

Transforms the edge pair with the given complex transformation. Does not modify the edge pair but returns the transformed edge.