KLayout 0.29.8 (2024-10-28 63dd591e5) [master]

API reference - Class Region

Notation used in Ruby API documentation

Module: db

Description: A region (a potentially complex area consisting of multiple polygons)

Class hierarchy: Region » ShapeCollection

Sub-classes: RectFilter, OppositeFilter

This class was introduced to simplify operations on polygon sets like boolean or sizing operations. Regions consist of many polygons and thus are a generalization of single polygons which describes a single coherence set of points. Regions support a variety of operations and have several states.

The region's state can be empty (does not contain anything) or box-like, i.e. the region consists of a single box. In that case, some operations can be simplified. Regions can have merged state. In merged state, regions consist of merged (non-touching, non-self overlapping) polygons. Each polygon describes one coherent area in merged state.

The preferred representation of polygons inside the region are polygons with holes.

Regions are always expressed in database units. If you want to use regions from different database unit domains, scale the regions accordingly, i.e. by using the transformed method.

Regions provide convenient operators for the boolean operations. Hence it is often no longer required to work with the EdgeProcessor class. For example:

r1 = RBA::Region::new(RBA::Box::new(0, 0, 100, 100))
r2 = RBA::Region::new(RBA::Box::new(20, 20, 80, 80))
# compute the XOR:
r1_xor_r2 = r1 ^ r2

Regions can be used in two different flavors: in raw mode or merged semantics. With merged semantics (the default), connected polygons are considered to belong together and are effectively merged. Overlapping areas are counted once in that mode. Internal edges (i.e. arising from cut lines) are not considered. In raw mode (without merged semantics), each polygon is considered as it is. Overlaps between polygons may exists and merging has to be done explicitly using the merge method. The semantics can be selected using merged_semantics=.

This class has been introduced in version 0.23.

Public constructors

new Region ptrnewDefault constructor
new Region ptrnew(Polygon[] array)Constructor from a polygon array
new Region ptrnew(const Box box)Box constructor
new Region ptrnew(const Polygon polygon)Polygon constructor
new Region ptrnew(const SimplePolygon polygon)Simple polygon constructor
new Region ptrnew(const Path path)Path constructor
new Region ptrnew(const RecursiveShapeIterator shape_iterator)Constructor from a hierarchical shape set
new Region ptrnew(const RecursiveShapeIterator shape_iterator,
const ICplxTrans trans)
Constructor from a hierarchical shape set with a transformation
new Region ptrnew(const Shapes shapes)Constructor from a shapes container
new Region ptrnew(const Shapes shapes,
const ICplxTrans trans)
Constructor from a shapes container with a transformation
new Region ptrnew(const RecursiveShapeIterator shape_iterator,
DeepShapeStore deep_shape_store,
double area_ratio = 0,
unsigned long max_vertex_count = 0)
Constructor for a deep region from a hierarchical shape set
new Region ptrnew(const RecursiveShapeIterator shape_iterator,
DeepShapeStore deep_shape_store,
const ICplxTrans trans,
double area_ratio = 0,
unsigned long max_vertex_count = 0)
Constructor for a deep region from a hierarchical shape set
new Region ptrnew(const RecursiveShapeIterator shape_iterator,
string expr,
bool as_pattern = true,
int enl = 1)
Constructor from a text set
new Region ptrnew(const RecursiveShapeIterator shape_iterator,
DeepShapeStore dss,
string expr,
bool as_pattern = true,
int enl = 1)
Constructor from a text set

Public methods

[const]Region&(const Region other)Returns the boolean AND between self and the other region
Region&=(const Region other)Performs the boolean AND between self and the other region in-place (modifying self)
[const]Region+(const Region other)Returns the combined region of self and the other region
Region+=(const Region other)Adds the polygons of the other region to self
[const]Region-(const Region other)Returns the boolean NOT between self and the other region
Region-=(const Region other)Performs the boolean NOT between self and the other region in-place (modifying self)
[const]const Polygon ptr[](unsigned long n)Returns the nth polygon of the region
[const]Region^(const Region other)Returns the boolean XOR between self and the other region
Region^=(const Region other)Performs the boolean XOR between self and the other region in-place (modifying self)
[const]Region 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]Regionand(const Region other,
PropertyConstraint property_constraint = IgnoreProperties)
Returns the boolean AND between self and the other region
Regionand_with(const Region other,
PropertyConstraint property_constraint = IgnoreProperties)
Performs the boolean AND between self and the other region in-place (modifying self)
[const]Region[]andnot(const Region other,
PropertyConstraint property_constraint = IgnoreProperties)
Returns the boolean AND and NOT between self and the other region
[const]longareaThe area of the region
[const]longarea(const Box rect)The area of the region (restricted to a rectangle)
voidassign(const Region other)Assigns another object to self
[const]unsigned intbase_verbosityGets the minimum verbosity for timing reports
voidbase_verbosity=(int verbosity)Sets the minimum verbosity for timing reports
[const]BoxbboxReturn the bounding box of the region
[const]variantbegin_merged_shapes_recReturns a recursive shape iterator plus a transformation for the shapes constituting the merged region.
[const]variantbegin_shapes_recReturns a recursive shape iterator plus a transformation for the shapes constituting this region.
voidbreak_polygons(unsigned long max_vertex_count,
double max_area_ratio = 0)
Breaks the polygons of the region into smaller ones
voidclearClears the region
variantcomplex_op(CompoundRegionOperationNode ptr node,
PropertyConstraint property_constraint = IgnoreProperties)
Executes a complex operation (see CompoundRegionOperationNode for details)
[const]Regioncorners(double angle_min = -180,
double angle_max = 180,
int dim = 1,
bool include_min_angle = true,
bool include_max_angle = true,
bool inverse = false,
bool absolute = false)
This method will select all corners whose attached edges satisfy the angle condition.
[const]Edgescorners_dots(double angle_start = -180,
double angle_end = 180,
bool include_min_angle = true,
bool include_max_angle = true,
bool inverse = false,
bool absolute = false)
This method will select all corners whose attached edges satisfy the angle condition.
[const]EdgePairscorners_edge_pairs(double angle_start = -180,
double angle_end = 180,
bool include_min_angle = true,
bool include_max_angle = true,
bool inverse = false,
bool absolute = false)
This method will select all corners whose attached edges satisfy the angle condition.
[const]unsigned longcountReturns the (flat) number of polygons in the region
[const]Regioncovering(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are completely covering polygons from the other region
[const]unsigned longdata_idReturns the data ID (a unique identifier for the underlying data storage)
[const]new Shapes ptrdecompose_convex(int preferred_orientation = Polygon#PO_any)Decomposes the region into convex pieces.
[const]new Region ptrdecompose_convex_to_region(int preferred_orientation = Polygon#PO_any)Decomposes the region into convex pieces into a region.
[const]new Shapes ptrdecompose_trapezoids(int mode = Polygon#TD_simple)Decomposes the region into trapezoids.
[const]new Region ptrdecompose_trapezoids_to_region(int mode = Polygon#TD_simple)Decomposes the region into trapezoids.
[const]RegiondelaunayComputes a constrained Delaunay triangulation from the given region
[const]Regiondelaunay(double max_area,
double min_b = 1)
Computes a refined, constrained Delaunay triangulation from the given region
voiddisable_progressDisable progress reporting
[const]Regiondrc_hull(Metrics metrics,
int space,
unsigned long n_circle = 64)
Computes a visualization of the forbidden region for a DRC space check
[const]new Region ptrdupCreates a copy of self
[const,iter]PolygoneachReturns each polygon of the region
[const,iter]Polygoneach_mergedReturns each merged polygon of the region
[const]Edgesedges(EdgeMode mode = All)Returns an edge collection representing all edges of the polygons in this region
voidenable_progress(string label)Enable progress reporting
voidenable_propertiesEnables properties for the given container.
[const]EdgePairsenclosed_check(const Region other,
unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs an inside check with options
[const]EdgePairsenclosing_check(const Region other,
unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs an enclosing check with options
[const]RegionextentsReturns a region with the bounding boxes of the polygons
[const]Regionextents(int d)Returns a region with the enlarged bounding boxes of the polygons
[const]Regionextents(int dx,
int dy)
Returns a region with the enlarged bounding boxes of the polygons
[const]voidfill(Cell ptr in_cell,
unsigned int fill_cell_index,
const Box fc_box,
const Point ptr origin = (0, 0),
Region ptr remaining_parts = nil,
const Vector fill_margin = 0,0,
Region ptr remaining_polygons = nil,
const Box glue_box = ())
A mapping of Cell#fill_region to the Region class
[const]voidfill(Cell ptr in_cell,
unsigned int fill_cell_index,
const Box fc_origin,
const Vector row_step,
const Vector column_step,
const Point ptr origin = (0, 0),
Region ptr remaining_parts = nil,
const Vector fill_margin = 0,0,
Region ptr remaining_polygons = nil,
const Box glue_box = ())
A mapping of Cell#fill_region to the Region class
[const]voidfill_multi(Cell ptr in_cell,
unsigned int fill_cell_index,
const Box fc_origin,
const Vector row_step,
const Vector column_step,
const Vector fill_margin = 0,0,
Region ptr remaining_polygons = nil,
const Box glue_box = ())
A mapping of Cell#fill_region to the Region class
voidfilter(const PolygonFilter ptr filter)Applies a generic filter in place (replacing the polygons from the Region)
voidfilter_properties(variant[] keys)Filters properties by certain keys.
[const]Regionfiltered(const PolygonFilter ptr filtered)Applies a generic filter and returns a filtered copy
RegionflattenExplicitly flattens a region
[const]EdgePairsgrid_check(int gx,
int gy)
Returns a marker for all vertices not being on the given grid
[const]boolhas_valid_polygons?Returns true if the region is flat and individual polygons can be accessed randomly
[const]unsigned longhier_countReturns the (hierarchical) number of polygons in the region
[const]RegionholesReturns the holes of the region
[const]RegionhullsReturns the hulls of the region
[const]Regionin(const Region other)Returns all polygons which are members of the other region
[const]Region[]in_and_out(const Region other)Returns all polygons which are members and not members of the other region
voidinsert(const Box box)Inserts a box
voidinsert(const Polygon polygon)Inserts a polygon
voidinsert(const SimplePolygon polygon)Inserts a simple polygon
voidinsert(const Path path)Inserts a path
voidinsert(RecursiveShapeIterator shape_iterator)Inserts all shapes delivered by the recursive shape iterator into this region
voidinsert(RecursiveShapeIterator shape_iterator,
ICplxTrans trans)
Inserts all shapes delivered by the recursive shape iterator into this region with a transformation
voidinsert(Polygon[] array)Inserts all polygons from the array into this region
voidinsert(const Region region)Inserts all polygons from the other region into this region
voidinsert(const Shapes shapes)Inserts all polygons from the shape collection into this region
voidinsert(const Shapes shapes,
const Trans trans)
Inserts all polygons from the shape collection into this region with transformation
voidinsert(const Shapes shapes,
const ICplxTrans trans)
Inserts all polygons from the shape collection into this region with complex transformation
[const]voidinsert_into(Layout ptr layout,
unsigned int cell_index,
unsigned int layer)
Inserts this region into the given layout, below the given cell and into the given layer.
[const]Regioninside(const Region other)Returns the polygons of this region which are completely inside polygons from the other region
[const]EdgePairsinside_check(const Region other,
unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs an inside check with options
[const]Regioninteracting(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which overlap or touch polygons from the other region
[const]Regioninteracting(const Edges other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which overlap or touch edges from the edge collection
[const]Regioninteracting(const Texts other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which overlap or touch texts
[const]boolis_box?Returns true, if the region is a simple box
[const]boolis_deep?Returns true if the region is a deep (hierarchical) one
[const]boolis_empty?Returns true if the region is empty
[const]boolis_merged?Returns true if the region is merged
[const]EdgePairsisolated_check(unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs a space check between edges of different polygons with options
[const]Regionjoin(const Region other)Returns the combined region of self and the other region
Regionjoin_with(const Region other)Adds the polygons of the other region to self
voidmap_properties(map<variant,variant> key_map)Maps properties by name key.
[const]Regionmembers_of(const Region other)Returns all polygons which are members of the other region
RegionmergeMerge the region
Regionmerge(int min_wc)Merge the region with options
Regionmerge(bool min_coherence,
int min_wc)
Merge the region with options
[const]RegionmergedReturns the merged region
Regionmerged(int min_wc)Returns the merged region (with options)
Regionmerged(bool min_coherence,
int min_wc)
Returns the merged region (with options)
voidmerged_semantics=(bool f)Enables or disables merged semantics
[const]boolmerged_semantics?Gets a flag indicating whether merged semantics is enabled
voidmin_coherence=(bool f)Enable or disable minimum coherence
[const]boolmin_coherence?Gets a flag indicating whether minimum coherence is selected
[const]Regionminkowski_sum(const Edge e)Compute the Minkowski sum of the region and an edge
[const]Regionminkowski_sum(const Polygon p)Compute the Minkowski sum of the region and a polygon
[const]Regionminkowski_sum(const Box b)Compute the Minkowski sum of the region and a box
[const]Regionminkowski_sum(Point[] b)Compute the Minkowski sum of the region and a contour of points (a trace)
Regionmove(const Vector v)Moves the region
Regionmove(int x,
int y)
Moves the region
[const]Regionmoved(const Vector v)Returns the moved region (does not modify self)
[const]Regionmoved(int x,
int y)
Returns the moved region (does not modify self)
[const]Regionnets(LayoutToNetlist extracted,
variant net_prop_name = nil,
const Net ptr[] ptr net_filter = nil)
Pulls the net shapes from a LayoutToNetlist database
[const]Regionnon_rectanglesReturns all polygons which are not rectangles
[const]Regionnon_rectilinearReturns all polygons which are not rectilinear
[const]Regionnon_squaresReturns all polygons which are not squares
[const]Regionnot(const Region other,
PropertyConstraint property_constraint = IgnoreProperties)
Returns the boolean NOT between self and the other region
[const]Regionnot_covering(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are not completely covering polygons from the other region
[const]Regionnot_in(const Region other)Returns all polygons which are not members of the other region
[const]Regionnot_inside(const Region other)Returns the polygons of this region which are not completely inside polygons from the other region
[const]Regionnot_interacting(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which do not overlap or touch polygons from the other region
[const]Regionnot_interacting(const Edges other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which do not overlap or touch edges from the edge collection
[const]Regionnot_interacting(const Texts other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which do not overlap or touch texts
[const]Regionnot_members_of(const Region other)Returns all polygons which are not members of the other region
[const]Regionnot_outside(const Region other)Returns the polygons of this region which are not completely outside polygons from the other region
[const]Regionnot_overlapping(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which do not overlap polygons from the other region
Regionnot_with(const Region other,
PropertyConstraint property_constraint = IgnoreProperties)
Performs the boolean NOT between self and the other region in-place (modifying self)
[const]EdgePairsnotch_check(unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs a space check between edges of the same polygon with options
[const]Regionor(const Region other)Returns the boolean OR between self and the other region
Regionor_with(const Region other)Performs the boolean OR between self and the other region in-place (modifying self)
[const]Regionoutside(const Region other)Returns the polygons of this region which are completely outside polygons from the other region
[const]EdgePairsoverlap_check(const Region other,
unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs an overlap check with options
[const]Regionoverlapping(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which overlap polygons from the other region
[const]unsigned longperimeterThe total perimeter of the polygons
[const]unsigned longperimeter(const Box rect)The total perimeter of the polygons (restricted to a rectangle)
voidprocess(const PolygonOperator ptr process)Applies a generic polygon processor in place (replacing the polygons from the Region)
[const]Regionprocessed(const PolygonOperator ptr processed)Applies a generic polygon processor and returns a processed copy
[const]EdgePairsprocessed(const PolygonToEdgePairOperator ptr processed)Applies a generic polygon-to-edge-pair processor and returns an edge pair collection with the results
[const]Edgesprocessed(const PolygonToEdgeOperator ptr processed)Applies a generic polygon-to-edge processor and returns an edge collection with the results
[const]Regionpull_inside(const Region other)Returns all polygons of "other" which are inside polygons of this region
[const]Regionpull_interacting(const Region other)Returns all polygons of "other" which are interacting with (overlapping, touching) polygons of this region
[const]Edgespull_interacting(const Edges other)Returns all edges of "other" which are interacting with polygons of this region
[const]Textspull_interacting(const Texts other)Returns all texts of "other" which are interacting with polygons of this region
[const]Regionpull_overlapping(const Region other)Returns all polygons of "other" which are overlapping polygons of this region
[const]double[][]rasterize(const Point origin,
const Vector pixel_size,
unsigned int nx,
unsigned int ny)
A grayscale rasterizer delivering the area covered per pixel
[const]double[][]rasterize(const Point origin,
const Vector pixel_distance,
const Vector pixel_size,
unsigned int nx,
unsigned int ny)
A version of 'rasterize' that allows a pixel step distance which is larger than the pixel size
[const]RegionrectanglesReturns all polygons which are rectangles
[const]RegionrectilinearReturns all polygons which are rectilinear
voidremove_propertiesRemoves properties for the given container.
voidround_corners(double r_inner,
double r_outer,
unsigned int n)
Corner rounding
[const]Regionrounded_corners(double r_inner,
double r_outer,
unsigned int n)
Corner rounding
voidscale_and_snap(int gx,
int mx,
int dx,
int gy,
int my,
int dy)
Scales and snaps the region to the given grid
[const]Regionscaled_and_snapped(int gx,
int mx,
int dx,
int gy,
int my,
int dy)
Returns the scaled and snapped region
Regionselect_covering(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons of this region which are completely covering polygons from the other region
Regionselect_inside(const Region other)Selects the polygons of this region which are completely inside polygons from the other region
Regionselect_interacting(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons from this region which overlap or touch polygons from the other region
Regionselect_interacting(const Edges other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons from this region which overlap or touch edges from the edge collection
Regionselect_interacting(const Texts other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons of this region which overlap or touch texts
Regionselect_not_covering(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons of this region which are not completely covering polygons from the other region
Regionselect_not_inside(const Region other)Selects the polygons of this region which are not completely inside polygons from the other region
Regionselect_not_interacting(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons from this region which do not overlap or touch polygons from the other region
Regionselect_not_interacting(const Edges other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons from this region which do not overlap or touch edges from the edge collection
Regionselect_not_interacting(const Texts other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons of this region which do not overlap or touch texts
Regionselect_not_outside(const Region other)Selects the polygons of this region which are not completely outside polygons from the other region
Regionselect_not_overlapping(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons from this region which do not overlap polygons from the other region
Regionselect_outside(const Region other)Selects the polygons of this region which are completely outside polygons from the other region
Regionselect_overlapping(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Selects the polygons from this region which overlap polygons from the other region
[const]EdgePairsseparation_check(const Region other,
unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs a separation check with options
Regionsize(int dx,
int dy,
unsigned int mode)
Anisotropic sizing (biasing)
Regionsize(const Vector dv,
unsigned int mode = 2)
Anisotropic sizing (biasing)
Regionsize(int d,
unsigned int mode = 2)
Isotropic sizing (biasing)
Regionsize_inside(const Region inside,
int dx,
int dy,
int steps,
unsigned int mode)
Incremental, anisotropic sizing inside of another region
Regionsize_inside(const Region inside,
const Vector dv,
int steps,
unsigned int mode = 2)
Incremental, anisotropic sizing inside of another region
Regionsize_inside(const Region inside,
int d,
int steps,
unsigned int mode = 2)
Incremental, isotropic sizing inside of another region
Regionsize_outside(const Region outside,
int dx,
int dy,
int steps,
unsigned int mode)
Incremental, anisotropic sizing outside of another region
Regionsize_outside(const Region outside,
const Vector dv,
int steps,
unsigned int mode = 2)
Incremental, anisotropic sizing outside of another region
Regionsize_outside(const Region outside,
int d,
int steps,
unsigned int mode = 2)
Incremental, anisotropic sizing outside of another region
[const]Regionsized(int dx,
int dy,
unsigned int mode)
Returns the anisotropically sized region
[const]Regionsized(const Vector dv,
unsigned int mode = 2)
Returns the (an)isotropically sized region
[const]Regionsized(int d,
unsigned int mode = 2)
Returns the isotropically sized region
[const]Regionsized_inside(const Region inside,
int dx,
int dy,
int steps,
unsigned int mode)
Returns the incrementally and anisotropically sized region
[const]Regionsized_inside(const Region inside,
const Vector dv,
int steps,
unsigned int mode = 2)
Returns the incrementally and anisotropically sized region
[const]Regionsized_inside(const Region inside,
int d,
int steps,
unsigned int mode = 2)
Returns the incrementally sized region
[const]Regionsized_outside(const Region outside,
int dx,
int dy,
int steps,
unsigned int mode)
Incremental, anisotropic sizing outside of another region
[const]Regionsized_outside(const Region outside,
const Vector dv,
int steps,
unsigned int mode = 2)
Incremental, anisotropic sizing outside of another region
[const]Regionsized_outside(const Region outside,
int d,
int steps,
unsigned int mode = 2)
Incremental, anisotropic sizing outside of another region
voidsmooth(int d,
bool keep_hv = false)
Smoothing
[const]Regionsmoothed(int d,
bool keep_hv = false)
Smoothing
voidsnap(int gx,
int gy)
Snaps the region to the given grid
[const]Regionsnapped(int gx,
int gy)
Returns the snapped region
[const]EdgePairsspace_check(unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
Region::OppositeFilter opposite_filter = NoOppositeFilter,
Region::RectFilter rect_filter = NoRectFilter,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs a space check with options
[const]Region[]split_covering(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are completely covering polygons from the other region and the ones which are not at the same time
[const]Region[]split_inside(const Region other)Returns the polygons of this region which are completely inside polygons from the other region and the ones which are not at the same time
[const]Region[]split_interacting(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are interacting with polygons from the other region and the ones which are not at the same time
[const]Region[]split_interacting(const Edges other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are interacting with edges from the other edge collection and the ones which are not at the same time
[const]Region[]split_interacting(const Texts other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are interacting with texts from the other text collection and the ones which are not at the same time
[const]Region[]split_outside(const Region other)Returns the polygons of this region which are completely outside polygons from the other region and the ones which are not at the same time
[const]Region[]split_overlapping(const Region other,
unsigned long min_count = 1,
unsigned long max_count = unlimited)
Returns the polygons of this region which are overlapping with polygons from the other region and the ones which are not at the same time
[const]RegionsquaresReturns all polygons which are squares
[const]Regionstrange_polygon_checkReturns a region containing those parts of polygons which are "strange"
voidstrict_handling=(bool f)Enables or disables strict handling
[const]boolstrict_handling?Gets a flag indicating whether merged semantics is enabled
voidswap(Region other)Swap the contents of this region with the contents of another region
[const]stringto_sConverts the region to a string
[const]stringto_s(unsigned long max_count)Converts the region to a string
Regiontransform(const Trans t)Transform the region (modifies self)
Regiontransform(const ICplxTrans t)Transform the region with a complex transformation (modifies self)
Regiontransform(const IMatrix2d t)Transform the region (modifies self)
Regiontransform(const IMatrix3d t)Transform the region (modifies self)
[const]Regiontransformed(const Trans t)Transforms the region
[const]Regiontransformed(const ICplxTrans t)Transforms the region with a complex transformation
[const]Regiontransformed(const IMatrix2d t)Transforms the region
[const]Regiontransformed(const IMatrix3d t)Transforms the region
[const]EdgePairswidth_check(unsigned int d,
bool whole_edges = false,
Metrics metrics = Euclidian,
variant ignore_angle = default,
variant min_projection = 0,
variant max_projection = max,
bool shielded = true,
bool negative = false,
PropertyConstraint property_constraint = IgnoreProperties,
ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)
Performs a width check with options
[const]EdgePairswith_angle(double angle,
bool inverse)
Returns markers on every corner with the given angle (or not with the given angle)
[const]EdgePairswith_angle(double amin,
double amax,
bool inverse)
Returns markers on every corner with an angle of more than amin and less than amax (or the opposite)
[const]Regionwith_area(long area,
bool inverse)
Filter the polygons by area
[const]Regionwith_area(variant min_area,
variant max_area,
bool inverse)
Filter the polygons by area
[const]Regionwith_area_ratio(double ratio,
bool inverse)
Filters the polygons by the bounding box area to polygon area ratio
[const]Regionwith_area_ratio(variant min_ratio,
variant max_ratio,
bool inverse,
bool min_included = true,
bool max_included = true)
Filters the polygons by the aspect ratio of their bounding boxes
[const]Regionwith_bbox_aspect_ratio(double ratio,
bool inverse)
Filters the polygons by the aspect ratio of their bounding boxes
[const]Regionwith_bbox_aspect_ratio(variant min_ratio,
variant max_ratio,
bool inverse,
bool min_included = true,
bool max_included = true)
Filters the polygons by the aspect ratio of their bounding boxes
[const]Regionwith_bbox_height(unsigned int height,
bool inverse)
Filter the polygons by bounding box height
[const]Regionwith_bbox_height(variant min_height,
variant max_height,
bool inverse)
Filter the polygons by bounding box height
[const]Regionwith_bbox_max(unsigned int dim,
bool inverse)
Filter the polygons by bounding box width or height, whichever is larger
[const]Regionwith_bbox_max(variant min_dim,
variant max_dim,
bool inverse)
Filter the polygons by bounding box width or height, whichever is larger
[const]Regionwith_bbox_min(unsigned int dim,
bool inverse)
Filter the polygons by bounding box width or height, whichever is smaller
[const]Regionwith_bbox_min(variant min_dim,
variant max_dim,
bool inverse)
Filter the polygons by bounding box width or height, whichever is smaller
[const]Regionwith_bbox_width(unsigned int width,
bool inverse)
Filter the polygons by bounding box width
[const]Regionwith_bbox_width(variant min_width,
variant max_width,
bool inverse)
Filter the polygons by bounding box width
[const]Regionwith_holes(unsigned long nholes,
bool inverse)
Filters the polygons by their number of holes
[const]Regionwith_holes(variant min_bholes,
variant max_nholes,
bool inverse)
Filter the polygons by their number of holes
[const]Regionwith_perimeter(unsigned long perimeter,
bool inverse)
Filter the polygons by perimeter
[const]Regionwith_perimeter(variant min_perimeter,
variant max_perimeter,
bool inverse)
Filter the polygons by perimeter
[const]Regionwith_relative_height(double ratio,
bool inverse)
Filters the polygons by the ratio of height to width
[const]Regionwith_relative_height(variant min_ratio,
variant max_ratio,
bool inverse,
bool min_included = true,
bool max_included = true)
Filters the polygons by the bounding box height to width ratio
[const]voidwrite(string filename)Writes the region to a file
[const]Regionxor(const Region other)Returns the boolean XOR between self and the other region
Regionxor_with(const Region other)Performs the boolean XOR between self and the other region in-place (modifying self)
[const]Region|(const Region other)Returns the boolean OR between self and the other region
Region|=(const Region other)Performs the boolean OR between self and the other region in-place (modifying self)

Public static methods and constants

[static,const]EdgeModeAllSelects all edges
[static,const]EdgeModeConcaveSelects only concave edges
[static,const]EdgeModeConvexSelects only convex edges
[static,const]PropertyConstraintDifferentPropertiesConstraintSpecifies to consider shapes only if their user properties are different
[static,const]PropertyConstraintDifferentPropertiesConstraintDropSpecifies to consider shapes only if their user properties are different
[static,const]MetricsEuclidianSpecifies Euclidian metrics for the check functions
[static,const]Region::RectFilterFourSidesAllowedAllow errors when on all sides
[static,const]PropertyConstraintIgnorePropertiesSpecifies to ignore properties
[static,const]ZeroDistanceModeIncludeZeroDistanceWhenCollinearAndTouchingSpecifies that check functions should include edges when they are collinear and touch
[static,const]ZeroDistanceModeIncludeZeroDistanceWhenOverlappingSpecifies that check functions should include edges when they overlap
[static,const]ZeroDistanceModeIncludeZeroDistanceWhenTouchingSpecifies that check functions should include edges when they touch
[static,const]ZeroDistanceModeNeverIncludeZeroDistanceSpecifies that check functions should never include edges with zero distance.
[static,const]Region::OppositeFilterNoOppositeFilterNo opposite filtering
[static,const]PropertyConstraintNoPropertyConstraintSpecifies not to apply any property constraint
[static,const]Region::RectFilterNoRectFilterSpecifies no filtering
[static,const]EdgeModeNotConcaveSelects only edges which are not concave
[static,const]EdgeModeNotConvexSelects only edges which are not convex
[static,const]Region::OppositeFilterNotOppositeOnly errors NOT appearing on opposite sides of a figure will be reported
[static,const]EdgeModeNotStepSelects only edges which are not steps
[static,const]EdgeModeNotStepInSelects only edges which are not steps leading inside
[static,const]EdgeModeNotStepOutSelects only edges which are not steps leading outside
[static,const]Region::RectFilterOneSideAllowedAllow errors on one side
[static,const]Region::OppositeFilterOnlyOppositeOnly errors appearing on opposite sides of a figure will be reported
[static,const]MetricsProjectionSpecifies projected distance metrics for the check functions
[static,const]PropertyConstraintSamePropertiesConstraintSpecifies to consider shapes only if their user properties are the same
[static,const]PropertyConstraintSamePropertiesConstraintDropSpecifies to consider shapes only if their user properties are the same
[static,const]MetricsSquareSpecifies square metrics for the check functions
[static,const]EdgeModeStepSelects only step edges leading inside or outside
[static,const]EdgeModeStepInSelects only step edges leading inside
[static,const]EdgeModeStepOutSelects only step edges leading outside
[static,const]Region::RectFilterThreeSidesAllowedAllow errors when on three sides
[static,const]Region::RectFilterTwoConnectedSidesAllowedAllow errors on two sides ("L" configuration)
[static,const]Region::RectFilterTwoOppositeSidesAllowedAllow errors on two opposite sides
[static,const]Region::RectFilterTwoSidesAllowedAllow errors on two sides (not specified which)

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

voidbreak(unsigned long max_vertex_count,
double max_area_ratio = 0)
Use of this method is deprecated. Use break_polygons instead
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
[const]Regionminkowsky_sum(const Edge e)Use of this method is deprecated. Use minkowski_sum instead
[const]Regionminkowsky_sum(const Polygon p)Use of this method is deprecated. Use minkowski_sum instead
[const]Regionminkowsky_sum(const Box b)Use of this method is deprecated. Use minkowski_sum instead
[const]Regionminkowsky_sum(Point[] b)Use of this method is deprecated. Use minkowski_sum instead
[const]unsigned longsizeUse of this method is deprecated. Use count instead
Regiontransform_icplx(const ICplxTrans t)Use of this method is deprecated. Use transform instead
[const]Regiontransformed_icplx(const ICplxTrans t)Use of this method is deprecated. Use transformed instead

Detailed description

&

Signature: [const] Region & (const Region other)

Description: Returns the boolean AND between self and the other region

Returns:The result of the boolean AND operation

This method will compute the boolean AND (intersection) between two regions. The result is often but not necessarily always merged.

&=

Signature: Region &= (const Region other)

Description: Performs the boolean AND between self and the other region in-place (modifying self)

Returns:The region after modification (self)

This method will compute the boolean AND (intersection) between two regions. The result is often but not necessarily always merged.

Note that in Ruby, the '&=' operator actually does not exist, but is emulated by '&' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'and_with' instead.

+

Signature: [const] Region + (const Region other)

Description: Returns the combined region of self and the other region

Returns:The resulting region

This operator adds the polygons of the other region to self and returns a new combined region. This usually creates unmerged regions and polygons may overlap. Use merge if you want to ensure the result region is merged.

The 'join' alias has been introduced in version 0.28.12.

+=

Signature: Region += (const Region other)

Description: Adds the polygons of the other region to self

Returns:The region after modification (self)

This operator adds the polygons of the other region to self. This usually creates unmerged regions and polygons may overlap. Use merge if you want to ensure the result region is merged.

Note that in Ruby, the '+=' operator actually does not exist, but is emulated by '+' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'join_with' instead.

The 'join_with' alias has been introduced in version 0.28.12.

-

Signature: [const] Region - (const Region other)

Description: Returns the boolean NOT between self and the other region

Returns:The result of the boolean NOT operation

This method will compute the boolean NOT (intersection) between two regions. The result is often but not necessarily always merged.

-=

Signature: Region -= (const Region other)

Description: Performs the boolean NOT between self and the other region in-place (modifying self)

Returns:The region after modification (self)

This method will compute the boolean NOT (intersection) between two regions. The result is often but not necessarily always merged.

Note that in Ruby, the '-=' operator actually does not exist, but is emulated by '-' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'not_with' instead.

All

Signature: [static,const] EdgeMode All

Description: Selects all edges

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

Concave

Signature: [static,const] EdgeMode Concave

Description: Selects only concave edges

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

Convex

Signature: [static,const] EdgeMode Convex

Description: Selects only convex edges

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

DifferentPropertiesConstraint

Signature: [static,const] PropertyConstraint DifferentPropertiesConstraint

Description: Specifies to consider shapes only if their user properties are different

When using this constraint - for example on a boolean operation - shapes are considered only if their user properties are different. Properties are generated on the output shapes where applicable.

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

DifferentPropertiesConstraintDrop

Signature: [static,const] PropertyConstraint DifferentPropertiesConstraintDrop

Description: Specifies to consider shapes only if their user properties are different

When using this constraint - for example on a boolean operation - shapes are considered only if their user properties are the same. No properties are generated on the output shapes.

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

Euclidian

Signature: [static,const] Metrics Euclidian

Description: Specifies Euclidian metrics for the check functions

This value can be used for the metrics parameter in the check functions, i.e. width_check. This value specifies Euclidian metrics, i.e. the distance between two points is measured by:

d = sqrt(dx^2 + dy^2)

All points within a circle with radius d around one point are considered to have a smaller distance than d.

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

FourSidesAllowed

Signature: [static,const] Region::RectFilter FourSidesAllowed

Description: Allow errors when on all sides

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

IgnoreProperties

Signature: [static,const] PropertyConstraint IgnoreProperties

Description: Specifies to ignore properties

When using this constraint - for example on a boolean operation - properties are ignored and are not generated in the output.

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

IncludeZeroDistanceWhenCollinearAndTouching

Signature: [static,const] ZeroDistanceMode IncludeZeroDistanceWhenCollinearAndTouching

Description: Specifies that check functions should include edges when they are collinear and touch

With this specification, the check functions will also check edges if they share at least one common point and are collinear. This is the mode that includes checking the 'kissing corner' cases when the kissing edges are collinear. This mode was default up to version 0.28.

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

IncludeZeroDistanceWhenOverlapping

Signature: [static,const] ZeroDistanceMode IncludeZeroDistanceWhenOverlapping

Description: Specifies that check functions should include edges when they overlap

With this specification, the check functions will also check edges which are collinear and share more than a single point. This is the mode that excludes the 'kissing corner' cases.

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

IncludeZeroDistanceWhenTouching

Signature: [static,const] ZeroDistanceMode IncludeZeroDistanceWhenTouching

Description: Specifies that check functions should include edges when they touch

With this specification, the check functions will also check edges if they share at least one common point. This is the mode that includes checking the 'kissing corner' cases. This mode is default for version 0.28.16 and later.

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

NeverIncludeZeroDistance

Signature: [static,const] ZeroDistanceMode NeverIncludeZeroDistance

Description: Specifies that check functions should never include edges with zero distance.

With this specification, the check functions will ignore edges which are collinear or touch.

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

NoOppositeFilter

Signature: [static,const] Region::OppositeFilter NoOppositeFilter

Description: No opposite filtering

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

NoPropertyConstraint

Signature: [static,const] PropertyConstraint NoPropertyConstraint

Description: Specifies not to apply any property constraint

When using this constraint - for example on a boolean operation - shapes are considered regardless of their user properties. Properties are generated on the output shapes where applicable.

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

NoRectFilter

Signature: [static,const] Region::RectFilter NoRectFilter

Description: Specifies no filtering

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

NotConcave

Signature: [static,const] EdgeMode NotConcave

Description: Selects only edges which are not concave

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

NotConvex

Signature: [static,const] EdgeMode NotConvex

Description: Selects only edges which are not convex

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

NotOpposite

Signature: [static,const] Region::OppositeFilter NotOpposite

Description: Only errors NOT appearing on opposite sides of a figure will be reported

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

NotStep

Signature: [static,const] EdgeMode NotStep

Description: Selects only edges which are not steps

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

NotStepIn

Signature: [static,const] EdgeMode NotStepIn

Description: Selects only edges which are not steps leading inside

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

NotStepOut

Signature: [static,const] EdgeMode NotStepOut

Description: Selects only edges which are not steps leading outside

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

OneSideAllowed

Signature: [static,const] Region::RectFilter OneSideAllowed

Description: Allow errors on one side

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

OnlyOpposite

Signature: [static,const] Region::OppositeFilter OnlyOpposite

Description: Only errors appearing on opposite sides of a figure will be reported

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

Projection

Signature: [static,const] Metrics Projection

Description: Specifies projected distance metrics for the check functions

This value can be used for the metrics parameter in the check functions, i.e. width_check. This value specifies projected metrics, i.e. the distance is defined as the minimum distance measured perpendicular to one edge. That implies that the distance is defined only where two edges have a non-vanishing projection onto each other.

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

SamePropertiesConstraint

Signature: [static,const] PropertyConstraint SamePropertiesConstraint

Description: Specifies to consider shapes only if their user properties are the same

When using this constraint - for example on a boolean operation - shapes are considered only if their user properties are the same. Properties are generated on the output shapes where applicable.

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

SamePropertiesConstraintDrop

Signature: [static,const] PropertyConstraint SamePropertiesConstraintDrop

Description: Specifies to consider shapes only if their user properties are the same

When using this constraint - for example on a boolean operation - shapes are considered only if their user properties are the same. No properties are generated on the output shapes.

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

Square

Signature: [static,const] Metrics Square

Description: Specifies square metrics for the check functions

This value can be used for the metrics parameter in the check functions, i.e. width_check. This value specifies square metrics, i.e. the distance between two points is measured by:

d = max(abs(dx), abs(dy))

All points within a square with length 2*d around one point are considered to have a smaller distance than d in this metrics.

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

Step

Signature: [static,const] EdgeMode Step

Description: Selects only step edges leading inside or outside

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

StepIn

Signature: [static,const] EdgeMode StepIn

Description: Selects only step edges leading inside

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

StepOut

Signature: [static,const] EdgeMode StepOut

Description: Selects only step edges leading outside

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

ThreeSidesAllowed

Signature: [static,const] Region::RectFilter ThreeSidesAllowed

Description: Allow errors when on three sides

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

TwoConnectedSidesAllowed

Signature: [static,const] Region::RectFilter TwoConnectedSidesAllowed

Description: Allow errors on two sides ("L" configuration)

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

TwoOppositeSidesAllowed

Signature: [static,const] Region::RectFilter TwoOppositeSidesAllowed

Description: Allow errors on two opposite sides

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

TwoSidesAllowed

Signature: [static,const] Region::RectFilter TwoSidesAllowed

Description: Allow errors on two sides (not specified which)

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

[]

Signature: [const] const Polygon ptr [] (unsigned long n)

Description: Returns the nth polygon of the region

This method returns nil if the index is out of range. It is available for flat regions only - i.e. those for which has_valid_polygons? is true. Use flatten to explicitly flatten a region. This method returns the raw polygon (not merged polygons, even if merged semantics is enabled).

The each iterator is the more general approach to access the polygons.

^

Signature: [const] Region ^ (const Region other)

Description: Returns the boolean XOR between self and the other region

Returns:The result of the boolean XOR operation

This method will compute the boolean XOR (intersection) between two regions. The result is often but not necessarily always merged.

The 'xor' alias has been introduced in version 0.28.12.

^=

Signature: Region ^= (const Region other)

Description: Performs the boolean XOR between self and the other region in-place (modifying self)

Returns:The region after modification (self)

This method will compute the boolean XOR (intersection) between two regions. The result is often but not necessarily always merged.

Note that in Ruby, the '^=' operator actually does not exist, but is emulated by '^' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'xor_with' instead.

The 'xor_with' alias has been introduced in version 0.28.12.

_const_cast

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

and

Signature: [const] Region and (const Region other, PropertyConstraint property_constraint = IgnoreProperties)

Description: Returns the boolean AND between self and the other region

Returns:The result of the boolean AND operation

This method will compute the boolean AND (intersection) between two regions. The result is often but not necessarily always merged. It allows specification of a property constaint - e.g. only performing the boolean operation between shapes with the same user properties.

This variant has been introduced in version 0.28.4.

Python specific notes:
This attribute is available as 'and_' in Python.

and_with

Signature: Region and_with (const Region other, PropertyConstraint property_constraint = IgnoreProperties)

Description: Performs the boolean AND between self and the other region in-place (modifying self)

Returns:The region after modification (self)

This method will compute the boolean AND (intersection) between two regions. The result is often but not necessarily always merged. It allows specification of a property constaint - e.g. only performing the boolean operation between shapes with the same user properties.

This variant has been introduced in version 0.28.4.

andnot

Signature: [const] Region[] andnot (const Region other, PropertyConstraint property_constraint = IgnoreProperties)

Description: Returns the boolean AND and NOT between self and the other region

Returns:A two-element array of regions with the first one being the AND result and the second one being the NOT result

This method will compute the boolean AND and NOT between two regions simultaneously. Because this requires a single sweep only, using this method is faster than doing AND and NOT separately.

This method has been added in version 0.27.

area

(1) Signature: [const] long area

Description: The area of the region

Merged semantics applies for this method (see merged_semantics= for a description of this concept) If merged semantics is not enabled, overlapping areas are counted twice.

(2) Signature: [const] long area (const Box rect)

Description: The area of the region (restricted to a rectangle)

This version will compute the area of the shapes, restricting the computation to the given rectangle.

Merged semantics applies for this method (see merged_semantics= for a description of this concept) If merged semantics is not enabled, overlapping areas are counted twice.

assign

Signature: void assign (const Region other)

Description: Assigns another object to self

base_verbosity

Signature: [const] unsigned int base_verbosity

Description: Gets the minimum verbosity for timing reports

See base_verbosity= for details.

This method has been introduced in version 0.26.

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

base_verbosity=

Signature: void base_verbosity= (int verbosity)

Description: Sets the minimum verbosity for timing reports

Timing reports will be given only if the verbosity is larger than this value. Detailed reports will be given when the verbosity is more than this value plus 10. In binary operations, the base verbosity of the first argument is considered.

This method has been introduced in version 0.26.

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

bbox

Signature: [const] Box bbox

Description: Return the bounding box of the region

The bounding box is the box enclosing all points of all polygons.

begin_merged_shapes_rec

Signature: [const] variant begin_merged_shapes_rec

Description: Returns a recursive shape iterator plus a transformation for the shapes constituting the merged region.

It can be used like begin_shapes_rec, but delivers shapes from the merged polygons pool.

This speciality method was introduced in version 0.29.5.

begin_shapes_rec

Signature: [const] variant begin_shapes_rec

Description: Returns a recursive shape iterator plus a transformation for the shapes constituting this region.

This method returns a pair consisting of a RecursiveShapeIterator plus a ICplxTrans transformation. Both objects allow accessing the shapes (polygons) of the region in a detailed fashion. To iterate the the polygons use a code like this:

iter, trans = region.begin_shapes_rec
iter.each do |i|
  polygon = trans * iter.trans * i.shape.polygon
  ...
end

This method is the most powerful way of accessing the shapes inside the region. I allows for example to obtain the properties attached to the polygons of the region. It is primarily intended for special applications like iterating net-annotated shapes.

This speciality method was introduced in version 0.29.5.

break

Signature: void break (unsigned long max_vertex_count, double max_area_ratio = 0)

Description: Breaks the polygons of the region into smaller ones

Use of this method is deprecated. Use break_polygons instead

There are two criteria for splitting a polygon: a polygon is split into parts with less then 'max_vertex_count' points and an bounding box-to-polygon area ratio less than 'max_area_ratio'. The area ratio is supposed to render polygons whose bounding box is a better approximation. This applies for example to 'L' shape polygons.

Using a value of 0 for either limit means that the respective limit isn't checked. Breaking happens by cutting the polygons into parts at 'good' locations. The algorithm does not have a specific goal to minimize the number of parts for example. The only goal is to achieve parts within the given limits.

This method has been introduced in version 0.26. The 'break_polygons' alias has been introduced in version 0.29.5 to avoid issues with reserved keywords.

Python specific notes:
This attribute is available as 'break_' in Python.

break_polygons

Signature: void break_polygons (unsigned long max_vertex_count, double max_area_ratio = 0)

Description: Breaks the polygons of the region into smaller ones

There are two criteria for splitting a polygon: a polygon is split into parts with less then 'max_vertex_count' points and an bounding box-to-polygon area ratio less than 'max_area_ratio'. The area ratio is supposed to render polygons whose bounding box is a better approximation. This applies for example to 'L' shape polygons.

Using a value of 0 for either limit means that the respective limit isn't checked. Breaking happens by cutting the polygons into parts at 'good' locations. The algorithm does not have a specific goal to minimize the number of parts for example. The only goal is to achieve parts within the given limits.

This method has been introduced in version 0.26. The 'break_polygons' alias has been introduced in version 0.29.5 to avoid issues with reserved keywords.

Python specific notes:
This attribute is available as 'break_' in Python.

clear

Signature: void clear

Description: Clears the region

complex_op

Signature: variant complex_op (CompoundRegionOperationNode ptr node, PropertyConstraint property_constraint = IgnoreProperties)

Description: Executes a complex operation (see CompoundRegionOperationNode for details)

This method has been introduced in version 0.27. The 'property_constraint' parameter controls whether properties are considered: with 'SamePropertiesConstraint' the operation is only applied between shapes with identical properties. With 'DifferentPropertiesConstraint' only between shapes with different properties. This option has been introduced in version 0.28.4.

corners

Signature: [const] Region corners (double angle_min = -180, double angle_max = 180, int dim = 1, bool include_min_angle = true, bool include_max_angle = true, bool inverse = false, bool absolute = false)

Description: This method will select all corners whose attached edges satisfy the angle condition.

The angle values specify a range of angles: all corners whose attached edges form an angle between angle_min and angle_max will be reported boxes with 2*dim x 2*dim dimension. The default dimension is 2x2 DBU.

If 'include_angle_min' is true, the angle condition is >= min. angle, otherwise it is > min. angle. Same for 'include_angle_,ax' and the max. angle.

With 'absolute' set to false (the default), the angle is measured between the incoming and the outcoming edge in mathematical sense: a positive value is a turn left while a negative value is a turn right. Since polygon contours are oriented clockwise, positive angles will report concave corners while negative ones report convex ones. With the 'absolute' option set to true, there is no such distinction and angle values are always positive.

With 'inverse' set to true, the method will select corners not meeting the angle criterion.

A similar function that reports corners as point-like edges is corners_dots.

This method has been introduced in version 0.25. 'include_min_angle' and 'include_max_angle' have been added in version 0.27. 'inverse' and 'absolute' have been added in version 0.29.1.

corners_dots

Signature: [const] Edges corners_dots (double angle_start = -180, double angle_end = 180, bool include_min_angle = true, bool include_max_angle = true, bool inverse = false, bool absolute = false)

Description: This method will select all corners whose attached edges satisfy the angle condition.

This method is similar to corners, but delivers an Edges collection with dot-like edges for each corner.

This method has been introduced in version 0.25. 'include_min_angle' and 'include_max_angle' have been added in version 0.27. 'inverse' and 'absolute' have been added in version 0.29.1.

corners_edge_pairs

Signature: [const] EdgePairs corners_edge_pairs (double angle_start = -180, double angle_end = 180, bool include_min_angle = true, bool include_max_angle = true, bool inverse = false, bool absolute = false)

Description: This method will select all corners whose attached edges satisfy the angle condition.

This method is similar to corners, but delivers an EdgePairs collection with an edge pairs for each corner. The first edge is the incoming edge of the corner, the second one the outgoing edge.

This method has been introduced in version 0.27.1. 'inverse' and 'absolute' have been added in version 0.29.1.

count

Signature: [const] unsigned long count

Description: Returns the (flat) number of polygons in the region

This returns the number of raw polygons (not merged polygons if merged semantics is enabled). The count is computed 'as if flat', i.e. polygons inside a cell are multiplied by the number of times a cell is instantiated.

The 'count' alias has been provided in version 0.26 to avoid ambiguity with the 'size' method which applies a geometrical bias.

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

covering

Signature: [const] Region covering (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are completely covering polygons from the other region

Returns:A new region containing the polygons which are covering polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This attribute is sometimes called 'enclosing' instead of 'covering', but this term is reserved for the respective DRC function.

This method has been introduced in version 0.27.

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.

data_id

Signature: [const] unsigned long data_id

Description: Returns the data ID (a unique identifier for the underlying data storage)

This method has been added in version 0.26.

decompose_convex

Signature: [const] new Shapes ptr decompose_convex (int preferred_orientation = Polygon#PO_any)

Description: Decomposes the region into convex pieces.

This method will return a Shapes container that holds a decomposition of the region into convex, simple polygons. See Polygon#decompose_convex for details. If you want Region output, you should use decompose_convex_to_region.

This method has been introduced in version 0.25.

decompose_convex_to_region

Signature: [const] new Region ptr decompose_convex_to_region (int preferred_orientation = Polygon#PO_any)

Description: Decomposes the region into convex pieces into a region.

This method is identical to decompose_convex, but delivers a Region object.

This method has been introduced in version 0.25.

decompose_trapezoids

Signature: [const] new Shapes ptr decompose_trapezoids (int mode = Polygon#TD_simple)

Description: Decomposes the region into trapezoids.

This method will return a Shapes container that holds a decomposition of the region into trapezoids. See Polygon#decompose_trapezoids for details. If you want Region output, you should use decompose_trapezoids_to_region.

This method has been introduced in version 0.25.

decompose_trapezoids_to_region

Signature: [const] new Region ptr decompose_trapezoids_to_region (int mode = Polygon#TD_simple)

Description: Decomposes the region into trapezoids.

This method is identical to decompose_trapezoids, but delivers a Region object.

This method has been introduced in version 0.25.

delaunay

(1) Signature: [const] Region delaunay

Description: Computes a constrained Delaunay triangulation from the given region

Returns:A new region holding the triangles of the constrained Delaunay triangulation.

Note that the result is a region in raw mode as otherwise the triangles are likely to get merged later on.

This method has been introduced in version 0.29.

(2) Signature: [const] Region delaunay (double max_area, double min_b = 1)

Description: Computes a refined, constrained Delaunay triangulation from the given region

Returns:A new region holding the triangles of the refined, constrained Delaunay triangulation.

Refinement is implemented by Chew's second algorithm. A maximum area can be given. Triangles larger than this area will be split. In addition 'skinny' triangles will be resolved where possible. 'skinny' is defined in terms of shortest edge to circumcircle radius ratio (b). A minimum number for b can be given. The default of 1.0 corresponds to a minimum angle of 30 degree and is usually a good choice. The algorithm is stable up to roughly 1.2 which corresponds to a minimum angle of abouth 37 degree.

The minimum angle of the resulting triangles relates to the 'b' parameter as: @t min_angle = arcsin(B/2) @/t.

The area value is given in terms of DBU units. Picking a value of 0.0 for area and min b will make the implementation skip the refinement step. In that case, the results are identical to the standard constrained Delaunay triangulation.

Note that the result is a region in raw mode as otherwise the triangles are likely to get merged later on.

This method has been introduced in version 0.29.

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.

disable_progress

Signature: void disable_progress

Description: Disable progress reporting

Calling this method will disable progress reporting. See enable_progress.

drc_hull

Signature: [const] Region drc_hull (Metrics metrics, int space, unsigned long n_circle = 64)

Description: Computes a visualization of the forbidden region for a DRC space check

metrics:The metrics to apply
space:The space value to apply
n_circle:The full-circle number of points for the Euclidian space visualization
Returns:The new polygons representing the forbidden region.

This method has been introduced in version 0.29.1.

dup

Signature: [const] new Region ptr dup

Description: Creates a copy of self

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

each

Signature: [const,iter] Polygon each

Description: Returns each polygon of the region

This returns the raw polygons (not merged polygons if merged semantics is enabled).

Python specific notes:
This method enables iteration of the object.

each_merged

Signature: [const,iter] Polygon each_merged

Description: Returns each merged polygon of the region

This returns the raw polygons if merged semantics is disabled or the merged ones if merged semantics is enabled.

edges

Signature: [const] Edges edges (EdgeMode mode = All)

Description: Returns an edge collection representing all edges of the polygons in this region

This method will decompose the polygons into the individual edges. Edges making up the hulls of the polygons are oriented clockwise while edges making up the holes are oriented counterclockwise.

The 'mode' parameter allows selecting specific edges, such as convex or concave ones. By default, all edges are selected.

The edge collection returned can be manipulated in various ways. See Edges for a description of the features of the edge collection.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The mode argument has been added in version 0.29.

enable_progress

Signature: void enable_progress (string label)

Description: Enable progress reporting

After calling this method, the region will report the progress through a progress bar while expensive operations are running. The label is a text which is put in front of the progress bar. Using a progress bar will imply a performance penalty of a few percent typically.

enable_properties

Signature: void enable_properties

Description: Enables properties for the given container.

This method has an effect mainly on original layers and will import properties from such layers. By default, properties are not enabled on original layers. Alternatively you can apply filter_properties or map_properties to enable properties with a specific name key.

This method has been introduced in version 0.28.4.

enclosed_check

Signature: [const] EdgePairs enclosed_check (const Region other, unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs an inside check with options

d:The minimum distance for which the polygons are checked
other:The other region against which to check
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:Negative output from the first input
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

If "negative" is true, only edges from the first input are output as pseudo edge-pairs where the distance is larger or equal to the limit. This is a way to flag the parts of the first input where the distance to the second input is bigger. Note that only the first input's edges are output. The output is still edge pairs, but each edge pair contains one edge from the original input and the reverse version of the edge as the second edge.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. The interpretation of the 'negative' flag has been restriced to first-layout only output in 0.27.1. The 'enclosed_check' alias was introduced in version 0.27.5. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

enclosing_check

Signature: [const] EdgePairs enclosing_check (const Region other, unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs an enclosing check with options

d:The minimum enclosing distance for which the polygons are checked
other:The other region against which to check
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:Negative output from the first input
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

If "negative" is true, only edges from the first input are output as pseudo edge-pairs where the enclosure is larger or equal to the limit. This is a way to flag the parts of the first input where the enclosure vs. the second input is bigger. Note that only the first input's edges are output. The output is still edge pairs, but each edge pair contains one edge from the original input and the reverse version of the edge as the second edge.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. The interpretation of the 'negative' flag has been restriced to first-layout only output in 0.27.1. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

extents

(1) Signature: [const] Region extents

Description: Returns a region with the bounding boxes of the polygons

This method will return a region consisting of the bounding boxes of the polygons. The boxes will not be merged, so it is possible to determine overlaps of these boxes for example.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region extents (int d)

Description: Returns a region with the enlarged bounding boxes of the polygons

This method will return a region consisting of the bounding boxes of the polygons enlarged by the given distance d. The enlargement is specified per edge, i.e the width and height will be increased by 2*d. The boxes will not be merged, so it is possible to determine overlaps of these boxes for example.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(3) Signature: [const] Region extents (int dx, int dy)

Description: Returns a region with the enlarged bounding boxes of the polygons

This method will return a region consisting of the bounding boxes of the polygons enlarged by the given distance dx in x direction and dy in y direction. The enlargement is specified per edge, i.e the width will be increased by 2*dx. The boxes will not be merged, so it is possible to determine overlaps of these boxes for example.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

fill

(1) Signature: [const] void fill (Cell ptr in_cell, unsigned int fill_cell_index, const Box fc_box, const Point ptr origin = (0, 0), Region ptr remaining_parts = nil, const Vector fill_margin = 0,0, Region ptr remaining_polygons = nil, const Box glue_box = ())

Description: A mapping of Cell#fill_region to the Region class

This method is equivalent to Cell#fill_region, but is based on Region (with the cell being the first parameter).

This method has been introduced in version 0.27.

(2) Signature: [const] void fill (Cell ptr in_cell, unsigned int fill_cell_index, const Box fc_origin, const Vector row_step, const Vector column_step, const Point ptr origin = (0, 0), Region ptr remaining_parts = nil, const Vector fill_margin = 0,0, Region ptr remaining_polygons = nil, const Box glue_box = ())

Description: A mapping of Cell#fill_region to the Region class

This method is equivalent to Cell#fill_region, but is based on Region (with the cell being the first parameter).

This method has been introduced in version 0.27.

fill_multi

Signature: [const] void fill_multi (Cell ptr in_cell, unsigned int fill_cell_index, const Box fc_origin, const Vector row_step, const Vector column_step, const Vector fill_margin = 0,0, Region ptr remaining_polygons = nil, const Box glue_box = ())

Description: A mapping of Cell#fill_region to the Region class

This method is equivalent to Cell#fill_region, but is based on Region (with the cell being the first parameter).

This method has been introduced in version 0.27.

filter

Signature: void filter (const PolygonFilter ptr filter)

Description: Applies a generic filter in place (replacing the polygons from the Region)

See PolygonFilter for a description of this feature.

This method has been introduced in version 0.29.

filter_properties

Signature: void filter_properties (variant[] keys)

Description: Filters properties by certain keys.

Calling this method on a container will reduce the properties to values with name keys from the 'keys' list. As a side effect, this method enables properties on original layers.

This method has been introduced in version 0.28.4.

filtered

Signature: [const] Region filtered (const PolygonFilter ptr filtered)

Description: Applies a generic filter and returns a filtered copy

See PolygonFilter for a description of this feature.

This method has been introduced in version 0.29.

flatten

Signature: Region flatten

Description: Explicitly flattens a region

If the region is already flat (i.e. has_valid_polygons? returns true), this method will not change it.

Returns 'self', so this method can be used in a dot concatenation.

This method has been introduced in version 0.26.

grid_check

Signature: [const] EdgePairs grid_check (int gx, int gy)

Description: Returns a marker for all vertices not being on the given grid

This method will return an edge pair object for every vertex whose x coordinate is not a multiple of gx or whose y coordinate is not a multiple of gy. The edge pair objects contain two edges consisting of the same single point - the original vertex.

If gx or gy is 0 or less, the grid is not checked in that direction.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

has_valid_polygons?

Signature: [const] bool has_valid_polygons?

Description: Returns true if the region is flat and individual polygons can be accessed randomly

This method has been introduced in version 0.26.

hier_count

Signature: [const] unsigned long hier_count

Description: Returns the (hierarchical) number of polygons in the region

This returns the number of raw polygons (not merged polygons if merged semantics is enabled). The count is computed 'hierarchical', i.e. polygons inside a cell are counted once even if the cell is instantiated multiple times.

This method has been introduced in version 0.27.

holes

Signature: [const] Region holes

Description: Returns the holes of the region

This method returns all holes as filled polygons.

Merged semantics applies for this method (see merged_semantics= for a description of this concept) If merge semantics is not enabled, the holes may not be detected if the polygons are taken from a hole-less representation (i.e. GDS2 file). Use explicit merge (merge method) in order to merge the polygons and detect holes.

hulls

Signature: [const] Region hulls

Description: Returns the hulls of the region

This method returns all hulls as polygons. The holes will be removed (filled). Merged semantics applies for this method (see merged_semantics= for a description of this concept) If merge semantics is not enabled, the hull may also enclose holes if the polygons are taken from a hole-less representation (i.e. GDS2 file). Use explicit merge (merge method) in order to merge the polygons and detect holes.

in

Signature: [const] Region in (const Region other)

Description: Returns all polygons which are members of the other region

This method returns all polygons in self which can be found in the other region as well with exactly the same geometry.

Python specific notes:
This attribute is available as 'in_' in Python.

in_and_out

Signature: [const] Region[] in_and_out (const Region other)

Description: Returns all polygons which are members and not members of the other region

This method is equivalent to calling members_of and not_members_of, but delivers both results at the same time and is more efficient than two separate calls. The first element returned is the members_of part, the second is the not_members_of part.

This method has been introduced in version 0.28.

insert

(1) Signature: void insert (const Box box)

Description: Inserts a box

Inserts a box into the region.

(2) Signature: void insert (const Polygon polygon)

Description: Inserts a polygon

Inserts a polygon into the region.

(3) Signature: void insert (const SimplePolygon polygon)

Description: Inserts a simple polygon

Inserts a simple polygon into the region.

(4) Signature: void insert (const Path path)

Description: Inserts a path

Inserts a path into the region.

(5) Signature: void insert (RecursiveShapeIterator shape_iterator)

Description: Inserts all shapes delivered by the recursive shape iterator into this region

This method will insert all shapes delivered by the shape iterator and insert them into the region. Text objects and edges are not inserted, because they cannot be converted to polygons.

(6) Signature: void insert (RecursiveShapeIterator shape_iterator, ICplxTrans trans)

Description: Inserts all shapes delivered by the recursive shape iterator into this region with a transformation

This method will insert all shapes delivered by the shape iterator and insert them into the region. Text objects and edges are not inserted, because they cannot be converted to polygons. This variant will apply the given transformation to the shapes. This is useful to scale the shapes to a specific database unit for example.

(7) Signature: void insert (Polygon[] array)

Description: Inserts all polygons from the array into this region

(8) Signature: void insert (const Region region)

Description: Inserts all polygons from the other region into this region

This method has been introduced in version 0.25.

(9) Signature: void insert (const Shapes shapes)

Description: Inserts all polygons from the shape collection into this region

This method takes each "polygon-like" shape from the shape collection and inserts this shape into the region. Paths and boxes are converted to polygons during this process. Edges and text objects are ignored.

This method has been introduced in version 0.25.

(10) Signature: void insert (const Shapes shapes, const Trans trans)

Description: Inserts all polygons from the shape collection into this region with transformation

This method takes each "polygon-like" shape from the shape collection and inserts this shape into the region after applying the given transformation. Paths and boxes are converted to polygons during this process. Edges and text objects are ignored.

This method has been introduced in version 0.25.

(11) Signature: void insert (const Shapes shapes, const ICplxTrans trans)

Description: Inserts all polygons from the shape collection into this region with complex transformation

This method takes each "polygon-like" shape from the shape collection and inserts this shape into the region after applying the given complex transformation. Paths and boxes are converted to polygons during this process. Edges and text objects are ignored.

This method has been introduced in version 0.25.

insert_into

Signature: [const] void insert_into (Layout ptr layout, unsigned int cell_index, unsigned int layer)

Description: Inserts this region into the given layout, below the given cell and into the given layer.

If the region is a hierarchical one, a suitable hierarchy will be built below the top cell or and existing hierarchy will be reused.

This method has been introduced in version 0.26.

inside

Signature: [const] Region inside (const Region other)

Description: Returns the polygons of this region which are completely inside polygons from the other region

Returns:A new region containing the polygons which are inside polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

inside_check

Signature: [const] EdgePairs inside_check (const Region other, unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs an inside check with options

d:The minimum distance for which the polygons are checked
other:The other region against which to check
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:Negative output from the first input
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

If "negative" is true, only edges from the first input are output as pseudo edge-pairs where the distance is larger or equal to the limit. This is a way to flag the parts of the first input where the distance to the second input is bigger. Note that only the first input's edges are output. The output is still edge pairs, but each edge pair contains one edge from the original input and the reverse version of the edge as the second edge.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. The interpretation of the 'negative' flag has been restriced to first-layout only output in 0.27.1. The 'enclosed_check' alias was introduced in version 0.27.5. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

interacting

(1) Signature: [const] Region interacting (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which overlap or touch polygons from the other region

Returns:A new region containing the polygons overlapping or touching polygons from the other region

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with (different) polygons of the other region to make the polygon selected. A polygon is selected by this method if the number of polygons interacting with a polygon of this region is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The min_count and max_count arguments have been added in version 0.27.

(2) Signature: [const] Region interacting (const Edges other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which overlap or touch edges from the edge collection

Returns:A new region containing the polygons overlapping or touching edges from the edge collection

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with edges of the edge collection to make the polygon selected. A polygon is selected by this method if the number of edges interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.25. The min_count and max_count arguments have been added in version 0.27.

(3) Signature: [const] Region interacting (const Texts other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which overlap or touch texts

Returns:A new region containing the polygons overlapping or touching texts

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with texts of the text collection to make the polygon selected. A polygon is selected by this method if the number of texts interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27

is_box?

Signature: [const] bool is_box?

Description: Returns true, if the region is a simple box

Returns:True if the region is a box.

This method does not apply implicit merging if merge semantics is enabled. If the region is not merged, this method may return false even if the merged region would be a box.

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_deep?

Signature: [const] bool is_deep?

Description: Returns true if the region is a deep (hierarchical) one

This method has been added in version 0.26.

is_empty?

Signature: [const] bool is_empty?

Description: Returns true if the region is empty

is_merged?

Signature: [const] bool is_merged?

Description: Returns true if the region is merged

If the region is merged, polygons will not touch or overlap. You can ensure merged state by calling merge.

isolated_check

Signature: [const] EdgePairs isolated_check (unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs a space check between edges of different polygons with options

d:The minimum space for which the polygons are checked
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:If true, edges not violation the condition will be output as pseudo-edge pairs
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

join

Signature: [const] Region join (const Region other)

Description: Returns the combined region of self and the other region

Returns:The resulting region

This operator adds the polygons of the other region to self and returns a new combined region. This usually creates unmerged regions and polygons may overlap. Use merge if you want to ensure the result region is merged.

The 'join' alias has been introduced in version 0.28.12.

join_with

Signature: Region join_with (const Region other)

Description: Adds the polygons of the other region to self

Returns:The region after modification (self)

This operator adds the polygons of the other region to self. This usually creates unmerged regions and polygons may overlap. Use merge if you want to ensure the result region is merged.

Note that in Ruby, the '+=' operator actually does not exist, but is emulated by '+' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'join_with' instead.

The 'join_with' alias has been introduced in version 0.28.12.

map_properties

Signature: void map_properties (map<variant,variant> key_map)

Description: Maps properties by name key.

Calling this method on a container will reduce the properties to values with name keys from the 'keys' hash and renames the properties. Properties not listed in the key map will be removed. As a side effect, this method enables properties on original layers.

This method has been introduced in version 0.28.4.

members_of

Signature: [const] Region members_of (const Region other)

Description: Returns all polygons which are members of the other region

This method returns all polygons in self which can be found in the other region as well with exactly the same geometry.

Python specific notes:
This attribute is available as 'in_' in Python.

merge

(1) Signature: Region merge

Description: Merge the region

Returns:The region after is has been merged (self).

Merging removes overlaps and joins touching polygons. If the region is already merged, this method does nothing

(2) Signature: Region merge (int min_wc)

Description: Merge the region with options

min_wc:Overlap selection
Returns:The region after is has been merged (self).

Merging removes overlaps and joins touching polygons. This version provides one additional option: "min_wc" controls whether output is only produced if multiple polygons overlap. The value specifies the number of polygons that need to overlap. A value of 2 means that output is only produced if two or more polygons overlap.

This method is equivalent to "merge(false, min_wc).

(3) Signature: Region merge (bool min_coherence, int min_wc)

Description: Merge the region with options

min_coherence:A flag indicating whether the resulting polygons shall have minimum coherence
min_wc:Overlap selection
Returns:The region after is has been merged (self).

Merging removes overlaps and joins touching polygons. This version provides two additional options: if "min_coherence" is set to true, "kissing corners" are resolved by producing separate polygons. "min_wc" controls whether output is only produced if multiple polygons overlap. The value specifies the number of polygons that need to overlap. A value of 2 means that output is only produced if two or more polygons overlap.

merged

(1) Signature: [const] Region merged

Description: Returns the merged region

Returns:The region after is has been merged.

Merging removes overlaps and joins touching polygons. If the region is already merged, this method does nothing. In contrast to merge, this method does not modify the region but returns a merged copy.

(2) Signature: Region merged (int min_wc)

Description: Returns the merged region (with options)

Returns:The region after is has been merged.

This version provides one additional options: "min_wc" controls whether output is only produced if multiple polygons overlap. The value specifies the number of polygons that need to overlap. A value of 2 means that output is only produced if two or more polygons overlap.

This method is equivalent to "merged(false, min_wc)".

In contrast to merge, this method does not modify the region but returns a merged copy.

(3) Signature: Region merged (bool min_coherence, int min_wc)

Description: Returns the merged region (with options)

min_coherence:A flag indicating whether the resulting polygons shall have minimum coherence
min_wc:Overlap selection
Returns:The region after is has been merged (self).

Merging removes overlaps and joins touching polygons. This version provides two additional options: if "min_coherence" is set to true, "kissing corners" are resolved by producing separate polygons. "min_wc" controls whether output is only produced if multiple polygons overlap. The value specifies the number of polygons that need to overlap. A value of 2 means that output is only produced if two or more polygons overlap.

In contrast to merge, this method does not modify the region but returns a merged copy.

merged_semantics=

Signature: void merged_semantics= (bool f)

Description: Enables or disables merged semantics

If merged semantics is enabled (the default), coherent polygons will be considered as single regions and artificial edges such as cut-lines will not be considered. Merged semantics thus is equivalent to considering coherent areas rather than single polygons

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

merged_semantics?

Signature: [const] bool merged_semantics?

Description: Gets a flag indicating whether merged semantics is enabled

See merged_semantics= for a description of this attribute.

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

min_coherence=

Signature: void min_coherence= (bool f)

Description: Enable or disable minimum coherence

If minimum coherence is set, the merge operations (explicit merge with merge or implicit merge through merged_semantics) are performed using minimum coherence mode. The coherence mode determines how kissing-corner situations are resolved. If minimum coherence is selected, they are resolved such that multiple polygons are created which touch at a corner).

The default setting is maximum coherence (min_coherence = false).

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

min_coherence?

Signature: [const] bool min_coherence?

Description: Gets a flag indicating whether minimum coherence is selected

See min_coherence= for a description of this attribute.

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

minkowski_sum

(1) Signature: [const] Region minkowski_sum (const Edge e)

Description: Compute the Minkowski sum of the region and an edge

e:The edge.
Returns:The new polygons representing the Minkowski sum with the edge e.

The Minkowski sum of a region and an edge basically results in the area covered when "dragging" the region along the line given by the edge. The effect is similar to drawing the line with a pencil that has the shape of the given region.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region minkowski_sum (const Polygon p)

Description: Compute the Minkowski sum of the region and a polygon

p:The first argument.
Returns:The new polygons representing the Minkowski sum of self and p.

The Minkowski sum of a region and a polygon is basically the result of "painting" the region with a pen that has the shape of the second polygon.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

(3) Signature: [const] Region minkowski_sum (const Box b)

Description: Compute the Minkowski sum of the region and a box

b:The box.
Returns:The new polygons representing the Minkowski sum of self and the box.

The result is equivalent to the region-with-polygon Minkowski sum with the box used as the second polygon.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

(4) Signature: [const] Region minkowski_sum (Point[] b)

Description: Compute the Minkowski sum of the region and a contour of points (a trace)

b:The contour (a series of points forming the trace).
Returns:The new polygons representing the Minkowski sum of self and the contour.

The Minkowski sum of a region and a contour basically results in the area covered when "dragging" the region along the contour. The effect is similar to drawing the contour with a pencil that has the shape of the given region.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

minkowsky_sum

(1) Signature: [const] Region minkowsky_sum (const Edge e)

Description: Compute the Minkowski sum of the region and an edge

e:The edge.
Returns:The new polygons representing the Minkowski sum with the edge e.

Use of this method is deprecated. Use minkowski_sum instead

The Minkowski sum of a region and an edge basically results in the area covered when "dragging" the region along the line given by the edge. The effect is similar to drawing the line with a pencil that has the shape of the given region.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region minkowsky_sum (const Polygon p)

Description: Compute the Minkowski sum of the region and a polygon

p:The first argument.
Returns:The new polygons representing the Minkowski sum of self and p.

Use of this method is deprecated. Use minkowski_sum instead

The Minkowski sum of a region and a polygon is basically the result of "painting" the region with a pen that has the shape of the second polygon.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

(3) Signature: [const] Region minkowsky_sum (const Box b)

Description: Compute the Minkowski sum of the region and a box

b:The box.
Returns:The new polygons representing the Minkowski sum of self and the box.

Use of this method is deprecated. Use minkowski_sum instead

The result is equivalent to the region-with-polygon Minkowski sum with the box used as the second polygon.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

(4) Signature: [const] Region minkowsky_sum (Point[] b)

Description: Compute the Minkowski sum of the region and a contour of points (a trace)

b:The contour (a series of points forming the trace).
Returns:The new polygons representing the Minkowski sum of self and the contour.

Use of this method is deprecated. Use minkowski_sum instead

The Minkowski sum of a region and a contour basically results in the area covered when "dragging" the region along the contour. The effect is similar to drawing the contour with a pencil that has the shape of the given region.

The resulting polygons are not merged. In order to remove overlaps, use the merge or merged method.Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

move

(1) Signature: Region move (const Vector v)

Description: Moves the region

v:The distance to move the region.
Returns:The moved region (self).

Moves the polygon by the given offset and returns the moved region. The region is overwritten.

Starting with version 0.25 this method accepts a vector argument.

(2) Signature: Region move (int x, int y)

Description: Moves the region

x:The x distance to move the region.
y:The y distance to move the region.
Returns:The moved region (self).

Moves the region by the given offset and returns the moved region. The region is overwritten.

moved

(1) Signature: [const] Region moved (const Vector v)

Description: Returns the moved region (does not modify self)

p:The distance to move the region.
Returns:The moved region.

Moves the region by the given offset and returns the moved region. The region is not modified.

Starting with version 0.25 this method accepts a vector argument.

(2) Signature: [const] Region moved (int x, int y)

Description: Returns the moved region (does not modify self)

x:The x distance to move the region.
y:The y distance to move the region.
Returns:The moved region.

Moves the region by the given offset and returns the moved region. The region is not modified.

nets

Signature: [const] Region nets (LayoutToNetlist extracted, variant net_prop_name = nil, const Net ptr[] ptr net_filter = nil)

Description: Pulls the net shapes from a LayoutToNetlist database

This method will create a new layer with the net shapes from the LayoutToNetlist database, provided that this region was an input to the netlist extraction on this database.

A (circuit name, net name) tuple will be attached as properties to the shapes if 'net_prop_name' is given and not nil. This allows generating unique properties per shape, flagging the net the shape is on. This feature is good for performing net-dependent booleans and DRC checks.

A net filter can be provided with the 'net_filter' argument. If given, only nets from this set are produced. Example:

connect(metal1, via1)
connect(via1, metal2)

metal1_all_nets = metal1.nets

This method was introduced in version 0.28.4.

new

(1) Signature: [static] new Region ptr new

Description: Default constructor

This constructor creates an empty region.

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

(2) Signature: [static] new Region ptr new (Polygon[] array)

Description: Constructor from a polygon array

This constructor creates a region from an array of polygons.

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

(3) Signature: [static] new Region ptr new (const Box box)

Description: Box constructor

This constructor creates a region from a box.

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

(4) Signature: [static] new Region ptr new (const Polygon polygon)

Description: Polygon constructor

This constructor creates a region from a polygon.

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

(5) Signature: [static] new Region ptr new (const SimplePolygon polygon)

Description: Simple polygon constructor

This constructor creates a region from a simple polygon.

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

(6) Signature: [static] new Region ptr new (const Path path)

Description: Path constructor

This constructor creates a region from a path.

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

(7) Signature: [static] new Region ptr new (const RecursiveShapeIterator shape_iterator)

Description: Constructor from a hierarchical shape set

This constructor creates a region from the shapes delivered by the given recursive shape iterator. Text objects and edges are not inserted, because they cannot be converted to polygons. This method allows feeding the shapes from a hierarchy of cells into the region.

layout = ... # a layout
cell   = ... # the index of the initial cell
layer  = ... # the index of the layer from where to take the shapes from
r = RBA::Region::new(layout.begin_shapes(cell, layer))

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

(8) Signature: [static] new Region ptr new (const RecursiveShapeIterator shape_iterator, const ICplxTrans trans)

Description: Constructor from a hierarchical shape set with a transformation

This constructor creates a region from the shapes delivered by the given recursive shape iterator. Text objects and edges are not inserted, because they cannot be converted to polygons. On the delivered shapes it applies the given transformation. This method allows feeding the shapes from a hierarchy of cells into the region. The transformation is useful to scale to a specific database unit for example.

layout = ... # a layout
cell   = ... # the index of the initial cell
layer  = ... # the index of the layer from where to take the shapes from
dbu    = 0.1 # the target database unit
r = RBA::Region::new(layout.begin_shapes(cell, layer), RBA::ICplxTrans::new(layout.dbu / dbu))

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

(9) Signature: [static] new Region ptr new (const Shapes shapes)

Description: Constructor from a shapes container

This constructor creates a region from the shapes container. Text objects and edges are not inserted, because they cannot be converted to polygons. This method allows feeding the shapes from a hierarchy of cells into the region.

This constructor has been introduced in version 0.25 and extended in version 0.29.

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

(10) Signature: [static] new Region ptr new (const Shapes shapes, const ICplxTrans trans)

Description: Constructor from a shapes container with a transformation

This constructor creates a region from the shapes container after applying the transformation. Text objects and edges are not inserted, because they cannot be converted to polygons. This method allows feeding the shapes from a hierarchy of cells into the region.

This constructor variant has been introduced in version 0.29.

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

(11) Signature: [static] new Region ptr new (const RecursiveShapeIterator shape_iterator, DeepShapeStore deep_shape_store, double area_ratio = 0, unsigned long max_vertex_count = 0)

Description: Constructor for a deep region from a hierarchical shape set

shape_iterator:The recursive shape iterator which delivers the hierarchy to take
deep_shape_store:The hierarchical heap (see there)
area_ratio:The maximum ratio of bounding box to polygon area before polygons are split

This constructor creates a hierarchical region. Use a DeepShapeStore object to supply the hierarchical heap. See DeepShapeStore for more details.

'area_ratio' and 'max_vertex' supply two optimization parameters which control how big polygons are split to reduce the region's polygon complexity.

This method has been introduced in version 0.26.

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

(12) Signature: [static] new Region ptr new (const RecursiveShapeIterator shape_iterator, DeepShapeStore deep_shape_store, const ICplxTrans trans, double area_ratio = 0, unsigned long max_vertex_count = 0)

Description: Constructor for a deep region from a hierarchical shape set

shape_iterator:The recursive shape iterator which delivers the hierarchy to take
deep_shape_store:The hierarchical heap (see there)
area_ratio:The maximum ratio of bounding box to polygon area before polygons are split
trans:The transformation to apply when storing the layout data

This constructor creates a hierarchical region. Use a DeepShapeStore object to supply the hierarchical heap. See DeepShapeStore for more details.

'area_ratio' and 'max_vertex' supply two optimization parameters which control how big polygons are split to reduce the region's polygon complexity.

The transformation is useful to scale to a specific database unit for example.

This method has been introduced in version 0.26.

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

(13) Signature: [static] new Region ptr new (const RecursiveShapeIterator shape_iterator, string expr, bool as_pattern = true, int enl = 1)

Description: Constructor from a text set

shape_iterator:The iterator from which to derive the texts
expr:The selection string
as_pattern:If true, the selection string is treated as a glob pattern. Otherwise the match is exact.
enl:The per-side enlargement of the box to mark the text (1 gives a 2x2 DBU box)

This special constructor will create a region from the text objects delivered by the shape iterator. Each text object will give a small (non-empty) box that represents the text origin. Texts can be selected by their strings - either through a glob pattern or by exact comparison with the given string. The following options are available:

region = RBA::Region::new(iter, "*")           # all texts
region = RBA::Region::new(iter, "A*")          # all texts starting with an 'A'
region = RBA::Region::new(iter, "A*", false)   # all texts exactly matching 'A*'

This method has been introduced in version 0.25. The enlargement parameter has been added in version 0.26.

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

(14) Signature: [static] new Region ptr new (const RecursiveShapeIterator shape_iterator, DeepShapeStore dss, string expr, bool as_pattern = true, int enl = 1)

Description: Constructor from a text set

shape_iterator:The iterator from which to derive the texts
dss:The DeepShapeStore object that acts as a heap for hierarchical operations.
expr:The selection string
as_pattern:If true, the selection string is treated as a glob pattern. Otherwise the match is exact.
enl:The per-side enlargement of the box to mark the text (1 gives a 2x2 DBU box)

This special constructor will create a deep region from the text objects delivered by the shape iterator. Each text object will give a small (non-empty) box that represents the text origin. Texts can be selected by their strings - either through a glob pattern or by exact comparison with the given string. The following options are available:

region = RBA::Region::new(iter, dss, "*")           # all texts
region = RBA::Region::new(iter, dss, "A*")          # all texts starting with an 'A'
region = RBA::Region::new(iter, dss, "A*", false)   # all texts exactly matching 'A*'

This variant has been introduced in version 0.26.

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

non_rectangles

Signature: [const] Region non_rectangles

Description: Returns all polygons which are not rectangles

This method returns all polygons in self which are not rectangles.Merged semantics applies for this method (see merged_semantics= for a description of this concept)

non_rectilinear

Signature: [const] Region non_rectilinear

Description: Returns all polygons which are not rectilinear

This method returns all polygons in self which are not rectilinear.Merged semantics applies for this method (see merged_semantics= for a description of this concept)

non_squares

Signature: [const] Region non_squares

Description: Returns all polygons which are not squares

This method returns all polygons in self which are not squares.Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

not

Signature: [const] Region not (const Region other, PropertyConstraint property_constraint = IgnoreProperties)

Description: Returns the boolean NOT between self and the other region

Returns:The result of the boolean NOT operation

This method will compute the boolean NOT (intersection) between two regions. The result is often but not necessarily always merged. It allows specification of a property constaint - e.g. only performing the boolean operation between shapes with the same user properties.

This variant has been introduced in version 0.28.4.

Python specific notes:
This attribute is available as 'not_' in Python.

not_covering

Signature: [const] Region not_covering (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are not completely covering polygons from the other region

Returns:A new region containing the polygons which are not covering polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This attribute is sometimes called 'enclosing' instead of 'covering', but this term is reserved for the respective DRC function.

This method has been introduced in version 0.27.

not_in

Signature: [const] Region not_in (const Region other)

Description: Returns all polygons which are not members of the other region

This method returns all polygons in self which can not be found in the other region with exactly the same geometry.

not_inside

Signature: [const] Region not_inside (const Region other)

Description: Returns the polygons of this region which are not completely inside polygons from the other region

Returns:A new region containing the polygons which are not inside polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

not_interacting

(1) Signature: [const] Region not_interacting (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which do not overlap or touch polygons from the other region

Returns:A new region containing the polygons not overlapping or touching polygons from the other region

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with (different) polygons of the other region to make the polygon not selected. A polygon is not selected by this method if the number of polygons interacting with a polygon of this region is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The min_count and max_count arguments have been added in version 0.27.

(2) Signature: [const] Region not_interacting (const Edges other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which do not overlap or touch edges from the edge collection

Returns:A new region containing the polygons not overlapping or touching edges from the edge collection

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with edges of the edge collection to make the polygon not selected. A polygon is not selected by this method if the number of edges interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.25 The min_count and max_count arguments have been added in version 0.27.

(3) Signature: [const] Region not_interacting (const Texts other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which do not overlap or touch texts

Returns:A new region containing the polygons not overlapping or touching texts

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with texts of the text collection to make the polygon not selected. A polygon is not selected by this method if the number of texts interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27

not_members_of

Signature: [const] Region not_members_of (const Region other)

Description: Returns all polygons which are not members of the other region

This method returns all polygons in self which can not be found in the other region with exactly the same geometry.

not_outside

Signature: [const] Region not_outside (const Region other)

Description: Returns the polygons of this region which are not completely outside polygons from the other region

Returns:A new region containing the polygons which are not outside polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

not_overlapping

Signature: [const] Region not_overlapping (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which do not overlap polygons from the other region

Returns:A new region containing the polygons not overlapping polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The count options have been introduced in version 0.27.

not_with

Signature: Region not_with (const Region other, PropertyConstraint property_constraint = IgnoreProperties)

Description: Performs the boolean NOT between self and the other region in-place (modifying self)

Returns:The region after modification (self)

This method will compute the boolean NOT (intersection) between two regions. The result is often but not necessarily always merged. It allows specification of a property constaint - e.g. only performing the boolean operation between shapes with the same user properties.

This variant has been introduced in version 0.28.4.

notch_check

Signature: [const] EdgePairs notch_check (unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs a space check between edges of the same polygon with options

d:The minimum space for which the polygons are checked
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
negative:If true, edges not violation the condition will be output as pseudo-edge pairs
property_constraint:Specifies whether to consider only shapes with a certain property relation
property_constraint:Only IgnoreProperties and NoPropertyConstraint are allowed - in the last case, properties are copied from the original shapes to the output@param zero_distance_mode Specifies how to handle edges with zero distance

This version is similar to the simple version with one parameter. In addition, it allows to specify many more options.

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the space check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded' and 'negative' options have been introduced in version 0.27. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

or

Signature: [const] Region or (const Region other)

Description: Returns the boolean OR between self and the other region

Returns:The resulting region

The boolean OR is implemented by merging the polygons of both regions. To simply join the regions without merging, the + operator is more efficient. The 'or' alias has been introduced in version 0.28.12.

Python specific notes:
This attribute is available as 'or_' in Python.

or_with

Signature: Region or_with (const Region other)

Description: Performs the boolean OR between self and the other region in-place (modifying self)

Returns:The region after modification (self)

The boolean OR is implemented by merging the polygons of both regions. To simply join the regions without merging, the + operator is more efficient. Note that in Ruby, the '|=' operator actually does not exist, but is emulated by '|' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'or_with' instead.

The 'or_with' alias has been introduced in version 0.28.12.

outside

Signature: [const] Region outside (const Region other)

Description: Returns the polygons of this region which are completely outside polygons from the other region

Returns:A new region containing the polygons which are outside polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

overlap_check

Signature: [const] EdgePairs overlap_check (const Region other, unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs an overlap check with options

d:The minimum overlap for which the polygons are checked
other:The other region against which to check
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:Negative output from the first input
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

If "negative" is true, only edges from the first input are output as pseudo edge-pairs where the overlap is larger or equal to the limit. This is a way to flag the parts of the first input where the overlap vs. the second input is bigger. Note that only the first input's edges are output. The output is still edge pairs, but each edge pair contains one edge from the original input and the reverse version of the edge as the second edge.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. The interpretation of the 'negative' flag has been restriced to first-layout only output in 0.27.1. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

overlapping

Signature: [const] Region overlapping (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which overlap polygons from the other region

Returns:A new region containing the polygons overlapping polygons from the other region

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The count options have been introduced in version 0.27.

perimeter

(1) Signature: [const] unsigned long perimeter

Description: The total perimeter of the polygons

Merged semantics applies for this method (see merged_semantics= for a description of this concept) If merged semantics is not enabled, internal edges are counted as well.

(2) Signature: [const] unsigned long perimeter (const Box rect)

Description: The total perimeter of the polygons (restricted to a rectangle)

This version will compute the perimeter of the polygons, restricting the computation to the given rectangle. Edges along the border are handled in a special way: they are counted when they are oriented with their inside side toward the rectangle (in other words: outside edges must coincide with the rectangle's border in order to be counted).

Merged semantics applies for this method (see merged_semantics= for a description of this concept) If merged semantics is not enabled, internal edges are counted as well.

process

Signature: void process (const PolygonOperator ptr process)

Description: Applies a generic polygon processor in place (replacing the polygons from the Region)

See PolygonProcessor for a description of this feature.

This method has been introduced in version 0.29.

processed

(1) Signature: [const] Region processed (const PolygonOperator ptr processed)

Description: Applies a generic polygon processor and returns a processed copy

See PolygonProcessor for a description of this feature.

This method has been introduced in version 0.29.

(2) Signature: [const] EdgePairs processed (const PolygonToEdgePairOperator ptr processed)

Description: Applies a generic polygon-to-edge-pair processor and returns an edge pair collection with the results

See PolygonToEdgePairProcessor for a description of this feature.

This method has been introduced in version 0.29.

(3) Signature: [const] Edges processed (const PolygonToEdgeOperator ptr processed)

Description: Applies a generic polygon-to-edge processor and returns an edge collection with the results

See PolygonToEdgeProcessor for a description of this feature.

This method has been introduced in version 0.29.

pull_inside

Signature: [const] Region pull_inside (const Region other)

Description: Returns all polygons of "other" which are inside polygons of this region

Returns:The region after the polygons have been selected (from other)

The "pull_..." methods are similar to "select_..." but work the opposite way: they select shapes from the argument region rather than self. In a deep (hierarchical) context the output region will be hierarchically aligned with self, so the "pull_..." methods provide a way for re-hierarchization.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.26.1

pull_interacting

(1) Signature: [const] Region pull_interacting (const Region other)

Description: Returns all polygons of "other" which are interacting with (overlapping, touching) polygons of this region

Returns:The region after the polygons have been selected (from other)

See pull_inside for a description of the "pull_..." methods.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.26.1

(2) Signature: [const] Edges pull_interacting (const Edges other)

Description: Returns all edges of "other" which are interacting with polygons of this region

Returns:The edge collection after the edges have been selected (from other)

See pull_inside for a description of the "pull_..." methods.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.26.1

(3) Signature: [const] Texts pull_interacting (const Texts other)

Description: Returns all texts of "other" which are interacting with polygons of this region

Returns:The text collection after the texts have been selected (from other)

See pull_inside for a description of the "pull_..." methods.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27

pull_overlapping

Signature: [const] Region pull_overlapping (const Region other)

Description: Returns all polygons of "other" which are overlapping polygons of this region

Returns:The region after the polygons have been selected (from other)

See pull_inside for a description of the "pull_..." methods.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.26.1

rasterize

(1) Signature: [const] double[][] rasterize (const Point origin, const Vector pixel_size, unsigned int nx, unsigned int ny)

Description: A grayscale rasterizer delivering the area covered per pixel

origin:The lower-left corner of the lowest-left pixel
pixel_size:The dimension of each pixel (the x component gives the width, the y component the height)
nx:The number of pixels in horizontal direction
ny:The number of pixels in vertical direction

The method will create a grayscale, high-resolution density map of a rectangular region. The scan region is defined by the origin, the pixel size and the number of pixels in horizontal (nx) and vertical (ny) direction. The resulting array will contain the area covered by polygons from the region in square database units.

For non-overlapping polygons, the maximum density value is px*py. Overlapping polygons are counted multiple times, so the actual values may be larger. If you want overlaps removed, you have to merge the region before. Merge semantics does not apply for the 'rasterize' method.

The resulting area values are precise within the limits of double-precision floating point arithmetics.

A second version exists that allows specifying an active pixel size which is smaller than the pixel distance hence allowing pixels samples that do not cover the full area, but leave gaps between the pixels.

This method has been added in version 0.29.

(2) Signature: [const] double[][] rasterize (const Point origin, const Vector pixel_distance, const Vector pixel_size, unsigned int nx, unsigned int ny)

Description: A version of 'rasterize' that allows a pixel step distance which is larger than the pixel size

This version behaves like the first variant of 'rasterize', but the pixel distance (pixel-to-pixel step raster) can be specified separately from the pixel size. Currently, the pixel size must be equal or smaller than the pixel distance - i.e. the pixels must not overlap.

This method has been added in version 0.29.

rectangles

Signature: [const] Region rectangles

Description: Returns all polygons which are rectangles

This method returns all polygons in self which are rectangles.Merged semantics applies for this method (see merged_semantics= for a description of this concept)

rectilinear

Signature: [const] Region rectilinear

Description: Returns all polygons which are rectilinear

This method returns all polygons in self which are rectilinear.Merged semantics applies for this method (see merged_semantics= for a description of this concept)

remove_properties

Signature: void remove_properties

Description: Removes properties for the given container.

This will remove all properties on the given container.

This method has been introduced in version 0.28.4.

round_corners

Signature: void round_corners (double r_inner, double r_outer, unsigned int n)

Description: Corner rounding

r_inner:Inner corner radius (in database units)
r_outer:Outer corner radius (in database units)
n:The number of points per circle

This method rounds the corners of the polygons in the region. Inner corners will be rounded with a radius of r_inner and outer corners with a radius of r_outer. The circles will be approximated by segments using n segments per full circle.

This method modifies the region. rounded_corners is a method that does the same but returns a new region without modifying self. Merged semantics applies for this method.

rounded_corners

Signature: [const] Region rounded_corners (double r_inner, double r_outer, unsigned int n)

Description: Corner rounding

r_inner:Inner corner radius (in database units)
r_outer:Outer corner radius (in database units)
n:The number of points per circle

See round_corners for a description of this method. This version returns a new region instead of modifying self (out-of-place).

scale_and_snap

Signature: void scale_and_snap (int gx, int mx, int dx, int gy, int my, int dy)

Description: Scales and snaps the region to the given grid

This method will first scale the region by a rational factor of mx/dx horizontally and my/dy vertically and then snap the region to the given grid - each x or y coordinate is brought on the gx or gy grid by rounding to the nearest value which is a multiple of gx or gy.

If gx or gy is 0, the result is brought on a grid of 1.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.26.1.

scaled_and_snapped

Signature: [const] Region scaled_and_snapped (int gx, int mx, int dx, int gy, int my, int dy)

Description: Returns the scaled and snapped region

This method will scale and snap the region to the given grid and return the scaled and snapped region (see scale_and_snap). The original region is not modified.

This method has been introduced in version 0.26.1.

select_covering

Signature: Region select_covering (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons of this region which are completely covering polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This attribute is sometimes called 'enclosing' instead of 'covering', but this term is reserved for the respective DRC function.

This method has been introduced in version 0.27.

select_inside

Signature: Region select_inside (const Region other)

Description: Selects the polygons of this region which are completely inside polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

select_interacting

(1) Signature: Region select_interacting (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons from this region which overlap or touch polygons from the other region

Returns:The region after the polygons have been selected (self)

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with (different) polygons of the other region to make the polygon selected. A polygon is selected by this method if the number of polygons interacting with a polygon of this region is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The min_count and max_count arguments have been added in version 0.27.

(2) Signature: Region select_interacting (const Edges other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons from this region which overlap or touch edges from the edge collection

Returns:The region after the polygons have been selected (self)

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with edges of the edge collection to make the polygon selected. A polygon is selected by this method if the number of edges interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.25 The min_count and max_count arguments have been added in version 0.27.

(3) Signature: Region select_interacting (const Texts other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons of this region which overlap or touch texts

Returns:The region after the polygons have been selected (self)

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with texts of the text collection to make the polygon selected. A polygon is selected by this method if the number of texts interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27

select_not_covering

Signature: Region select_not_covering (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons of this region which are not completely covering polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This attribute is sometimes called 'enclosing' instead of 'covering', but this term is reserved for the respective DRC function.

This method has been introduced in version 0.27.

select_not_inside

Signature: Region select_not_inside (const Region other)

Description: Selects the polygons of this region which are not completely inside polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

select_not_interacting

(1) Signature: Region select_not_interacting (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons from this region which do not overlap or touch polygons from the other region

Returns:The region after the polygons have been selected (self)

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with (different) polygons of the other region to make the polygon not selected. A polygon is not selected by this method if the number of polygons interacting with a polygon of this region is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The min_count and max_count arguments have been added in version 0.27.

(2) Signature: Region select_not_interacting (const Edges other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons from this region which do not overlap or touch edges from the edge collection

Returns:The region after the polygons have been selected (self)

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with edges of the edge collection to make the polygon not selected. A polygon is not selected by this method if the number of edges interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.25 The min_count and max_count arguments have been added in version 0.27.

(3) Signature: Region select_not_interacting (const Texts other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons of this region which do not overlap or touch texts

Returns:The region after the polygons have been selected (self)

'min_count' and 'max_count' impose a constraint on the number of times a polygon of this region has to interact with texts of the text collection to make the polygon not selected. A polygon is not selected by this method if the number of texts interacting with the polygon is between min_count and max_count (including max_count).

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27

select_not_outside

Signature: Region select_not_outside (const Region other)

Description: Selects the polygons of this region which are not completely outside polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

select_not_overlapping

Signature: Region select_not_overlapping (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons from this region which do not overlap polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The count options have been introduced in version 0.27.

select_outside

Signature: Region select_outside (const Region other)

Description: Selects the polygons of this region which are completely outside polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

select_overlapping

Signature: Region select_overlapping (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Selects the polygons from this region which overlap polygons from the other region

Returns:The region after the polygons have been selected (self)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The count options have been introduced in version 0.27.

separation_check

Signature: [const] EdgePairs separation_check (const Region other, unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs a separation check with options

d:The minimum separation for which the polygons are checked
other:The other region against which to check
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:Negative output from the first input
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

If "negative" is true, only edges from the first input are output as pseudo edge-pairs where the separation is larger or equal to the limit. This is a way to flag the parts of the first input where the distance to the second input is bigger. Note that only the first input's edges are output. The output is still edge pairs, but each edge pair contains one edge from the original input and the reverse version of the edge as the second edge.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. The interpretation of the 'negative' flag has been restriced to first-layout only output in 0.27.1. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

size

(1) Signature: Region size (int dx, int dy, unsigned int mode)

Description: Anisotropic sizing (biasing)

Returns:The region after the sizing has applied (self)

Shifts the contour outwards (dx,dy>0) or inwards (dx,dy<0). dx is the sizing in x-direction and dy is the sizing in y-direction. The sign of dx and dy should be identical.

This method applies a sizing to the region. Before the sizing is done, the region is merged if this is not the case already.

The mode defines at which bending angle cutoff occurs (0:>0, 1:>45, 2:>90, 3:>135, 4:>approx. 168, other:>approx. 179)

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

The result is a set of polygons which may be overlapping, but are not self- intersecting. Polygons may overlap afterwards because they grew big enough to overlap their neighbors. In that case, merge can be used to detect this overlaps by setting the "min_wc" parameter to value 1:

r = RBA::Region::new
r.insert(RBA::Box::new(0, 0, 50, 50))
r.insert(RBA::Box::new(100, 0, 150, 50))
r.size(50, 2)
r.merge(false, 1)
# r now is (50,-50;50,100;100,100;100,-50)

(2) Signature: Region size (const Vector dv, unsigned int mode = 2)

Description: Anisotropic sizing (biasing)

Returns:The region after the sizing has applied (self)

This method is equivalent to "size(dv.x, dv.y, mode)".

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This variant has been introduced in version 0.28.

(3) Signature: Region size (int d, unsigned int mode = 2)

Description: Isotropic sizing (biasing)

Returns:The region after the sizing has applied (self)

This method is equivalent to "size(d, d, mode)".

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(4) Signature: [const] unsigned long size

Description: Returns the (flat) number of polygons in the region

Use of this method is deprecated. Use count instead

This returns the number of raw polygons (not merged polygons if merged semantics is enabled). The count is computed 'as if flat', i.e. polygons inside a cell are multiplied by the number of times a cell is instantiated.

The 'count' alias has been provided in version 0.26 to avoid ambiguity with the 'size' method which applies a geometrical bias.

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

size_inside

(1) Signature: Region size_inside (const Region inside, int dx, int dy, int steps, unsigned int mode)

Description: Incremental, anisotropic sizing inside of another region

inside:The region the incremental sizing will stay inside.
dx:The x sizing value
dy:The y sizing value
steps:The number of steps to take
mode:The sizing mode (see size)
Returns:The region after the sizing has been applied (self)

Sizes the region, keeping inside another region and performing the size in discrete steps.

Using this method is equivalent to applying a single-step size and consecutively doing a boolean AND with the 'inside' region. This is repeated until the full sizing value is applied.

This operation is employed to implement latch-up rules, where a device needs to be close to a well tap within the same well. For this, the tap footprint is incrementally sized, with the well as the 'inside' region. The steps is chosen so the per-step sizing is somewhat less than the minimum well space. Sizing the tap shape results in a growing footprint that follows the well contours and a small enough per-step sizing value ensures the sized contour does not cross well gaps.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.29.3.

(2) Signature: Region size_inside (const Region inside, const Vector dv, int steps, unsigned int mode = 2)

Description: Incremental, anisotropic sizing inside of another region

Returns:The region after the sizing has applied (self)

This method is equivalent to "size_inside(dv.x, dv.y, steps, mode)".

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.29.3.

(3) Signature: Region size_inside (const Region inside, int d, int steps, unsigned int mode = 2)

Description: Incremental, isotropic sizing inside of another region

Returns:The region after the sizing has applied (self)

This method is equivalent to "size_inside(d, d, steps, mode)".

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.29.3.

size_outside

(1) Signature: Region size_outside (const Region outside, int dx, int dy, int steps, unsigned int mode)

Description: Incremental, anisotropic sizing outside of another region

This method is equivalent to size_inside, except that sizing is performed outside the given 'outside' region. Technically this corresponds to a boolean 'NOT' operation instead of a boolean 'AND'.

This method has been introduced in version 0.29.3.

(2) Signature: Region size_outside (const Region outside, const Vector dv, int steps, unsigned int mode = 2)

Description: Incremental, anisotropic sizing outside of another region

This method is equivalent to size_inside, except that sizing is performed outside the given 'outside' region. Technically this corresponds to a boolean 'NOT' operation instead of a boolean 'AND'.

This method has been introduced in version 0.29.3.

(3) Signature: Region size_outside (const Region outside, int d, int steps, unsigned int mode = 2)

Description: Incremental, anisotropic sizing outside of another region

This method is equivalent to size_inside, except that sizing is performed outside the given 'outside' region. Technically this corresponds to a boolean 'NOT' operation instead of a boolean 'AND'.

This method has been introduced in version 0.29.3.

sized

(1) Signature: [const] Region sized (int dx, int dy, unsigned int mode)

Description: Returns the anisotropically sized region

Returns:The sized region

This method returns the sized region (see size), but does not modify self.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region sized (const Vector dv, unsigned int mode = 2)

Description: Returns the (an)isotropically sized region

Returns:The sized region

This method is equivalent to "sized(dv.x, dv.y, mode)". This method returns the sized region (see size), but does not modify self.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This variant has been introduced in version 0.28.

(3) Signature: [const] Region sized (int d, unsigned int mode = 2)

Description: Returns the isotropically sized region

Returns:The sized region

This method is equivalent to "sized(d, d, mode)". This method returns the sized region (see size), but does not modify self.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

sized_inside

(1) Signature: [const] Region sized_inside (const Region inside, int dx, int dy, int steps, unsigned int mode)

Description: Returns the incrementally and anisotropically sized region

Returns:The sized region

This method returns the incrementally sized region (see size_inside), but does not modify self.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region sized_inside (const Region inside, const Vector dv, int steps, unsigned int mode = 2)

Description: Returns the incrementally and anisotropically sized region

Returns:The sized region

This method returns the incrementally sized region (see size_inside), but does not modify self.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This variant has been introduced in version 0.28.

(3) Signature: [const] Region sized_inside (const Region inside, int d, int steps, unsigned int mode = 2)

Description: Returns the incrementally sized region

Returns:The sized region

This method returns the incrementally sized region (see size_inside), but does not modify self.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

sized_outside

(1) Signature: [const] Region sized_outside (const Region outside, int dx, int dy, int steps, unsigned int mode)

Description: Incremental, anisotropic sizing outside of another region

This method is equivalent to size_inside, except that sizing is performed outside the given 'outside' region. Technically this corresponds to a boolean 'NOT' operation instead of a boolean 'AND'.

This method has been introduced in version 0.29.3.

(2) Signature: [const] Region sized_outside (const Region outside, const Vector dv, int steps, unsigned int mode = 2)

Description: Incremental, anisotropic sizing outside of another region

This method is equivalent to size_inside, except that sizing is performed outside the given 'outside' region. Technically this corresponds to a boolean 'NOT' operation instead of a boolean 'AND'.

This method has been introduced in version 0.29.3.

(3) Signature: [const] Region sized_outside (const Region outside, int d, int steps, unsigned int mode = 2)

Description: Incremental, anisotropic sizing outside of another region

This method is equivalent to size_inside, except that sizing is performed outside the given 'outside' region. Technically this corresponds to a boolean 'NOT' operation instead of a boolean 'AND'.

This method has been introduced in version 0.29.3.

smooth

Signature: void smooth (int d, bool keep_hv = false)

Description: Smoothing

d:The smoothing tolerance (in database units)
keep_hv:If true, horizontal and vertical edges are maintained

This method will simplify the merged polygons of the region by removing vertexes if the resulting polygon stays equivalent with the original polygon. Equivalence is measured in terms of a deviation which is guaranteed to not become larger than d. This method modifies the region. smoothed is a method that does the same but returns a new region without modifying self. Merged semantics applies for this method.

smoothed

Signature: [const] Region smoothed (int d, bool keep_hv = false)

Description: Smoothing

d:The smoothing tolerance (in database units)
keep_hv:If true, horizontal and vertical edges are maintained

See smooth for a description of this method. This version returns a new region instead of modifying self (out-of-place). It has been introduced in version 0.25.

snap

Signature: void snap (int gx, int gy)

Description: Snaps the region to the given grid

This method will snap the region to the given grid - each x or y coordinate is brought on the gx or gy grid by rounding to the nearest value which is a multiple of gx or gy.

If gx or gy is 0, no snapping happens in that direction.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

snapped

Signature: [const] Region snapped (int gx, int gy)

Description: Returns the snapped region

This method will snap the region to the given grid and return the snapped region (see snap). The original region is not modified.

space_check

Signature: [const] EdgePairs space_check (unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, Region::OppositeFilter opposite_filter = NoOppositeFilter, Region::RectFilter rect_filter = NoRectFilter, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs a space check with options

d:The minimum space for which the polygons are checked
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
opposite_filter:Specifies a filter mode for errors happening on opposite sides of inputs shapes
rect_filter:Specifies an error filter for rectangular input shapes
negative:If true, edges not violation the condition will be output as pseudo-edge pairs
property_constraint:Specifies whether to consider only shapes with a certain property relation
zero_distance_mode:Specifies how to handle edges with zero distance

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

"opposite_filter" specifies whether to require or reject errors happening on opposite sides of a figure. "rect_filter" allows suppressing specific error configurations on rectangular input figures.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded', 'negative', 'not_opposite' and 'rect_sides' options have been introduced in version 0.27. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.29.

split_covering

Signature: [const] Region[] split_covering (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are completely covering polygons from the other region and the ones which are not at the same time

Returns:Two new regions: the first containing the result of covering, the second the result of not_covering

This method is equivalent to calling covering and not_covering, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

split_inside

Signature: [const] Region[] split_inside (const Region other)

Description: Returns the polygons of this region which are completely inside polygons from the other region and the ones which are not at the same time

Returns:Two new regions: the first containing the result of inside, the second the result of not_inside

This method is equivalent to calling inside and not_inside, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

split_interacting

(1) Signature: [const] Region[] split_interacting (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are interacting with polygons from the other region and the ones which are not at the same time

Returns:Two new regions: the first containing the result of interacting, the second the result of not_interacting

This method is equivalent to calling interacting and not_interacting, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

(2) Signature: [const] Region[] split_interacting (const Edges other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are interacting with edges from the other edge collection and the ones which are not at the same time

Returns:Two new regions: the first containing the result of interacting, the second the result of not_interacting

This method is equivalent to calling interacting and not_interacting, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

(3) Signature: [const] Region[] split_interacting (const Texts other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are interacting with texts from the other text collection and the ones which are not at the same time

Returns:Two new regions: the first containing the result of interacting, the second the result of not_interacting

This method is equivalent to calling interacting and not_interacting, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

split_outside

Signature: [const] Region[] split_outside (const Region other)

Description: Returns the polygons of this region which are completely outside polygons from the other region and the ones which are not at the same time

Returns:Two new regions: the first containing the result of outside, the second the result of not_outside

This method is equivalent to calling outside and not_outside, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

split_overlapping

Signature: [const] Region[] split_overlapping (const Region other, unsigned long min_count = 1, unsigned long max_count = unlimited)

Description: Returns the polygons of this region which are overlapping with polygons from the other region and the ones which are not at the same time

Returns:Two new regions: the first containing the result of overlapping, the second the result of not_overlapping

This method is equivalent to calling overlapping and not_overlapping, but is faster when both results are required. Merged semantics applies for this method (see merged_semantics= for a description of this concept).

This method has been introduced in version 0.27.

squares

Signature: [const] Region squares

Description: Returns all polygons which are squares

This method returns all polygons in self which are squares.Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

strange_polygon_check

Signature: [const] Region strange_polygon_check

Description: Returns a region containing those parts of polygons which are "strange"

Strange parts of polygons are self-overlapping parts or non-orientable parts (i.e. in the "8" configuration).

Merged semantics does not apply for this method (see merged_semantics= for a description of this concept)

strict_handling=

Signature: void strict_handling= (bool f)

Description: Enables or disables strict handling

Strict handling means to leave away some optimizations. Specifically the output of boolean operations will be merged even if one input is empty. Without strict handling, the operation will be optimized and output won't be merged.

Strict handling is disabled by default and optimization is in place.

This method has been introduced in version 0.23.2.

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

strict_handling?

Signature: [const] bool strict_handling?

Description: Gets a flag indicating whether merged semantics is enabled

See strict_handling= for a description of this attribute.

This method has been introduced in version 0.23.2.

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

swap

Signature: void swap (Region other)

Description: Swap the contents of this region with the contents of another region

This method is useful to avoid excessive memory allocation in some cases. For managed memory languages such as Ruby, those cases will be rare.

to_s

(1) Signature: [const] string to_s

Description: Converts the region to a string

The length of the output is limited to 20 polygons to avoid giant strings on large regions. For full output use "to_s" with a maximum count parameter.

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

(2) Signature: [const] string to_s (unsigned long max_count)

Description: Converts the region to a string

This version allows specification of the maximum number of polygons contained in the string.

transform

(1) Signature: Region transform (const Trans t)

Description: Transform the region (modifies self)

t:The transformation to apply.
Returns:The transformed region.

Transforms the region with the given transformation. This version modifies the region and returns a reference to self.

(2) Signature: Region transform (const ICplxTrans t)

Description: Transform the region with a complex transformation (modifies self)

t:The transformation to apply.
Returns:The transformed region.

Transforms the region with the given transformation. This version modifies the region and returns a reference to self.

(3) Signature: Region transform (const IMatrix2d t)

Description: Transform the region (modifies self)

t:The transformation to apply.
Returns:The transformed region.

Transforms the region with the given 2d matrix transformation. This version modifies the region and returns a reference to self.

This variant was introduced in version 0.27.

(4) Signature: Region transform (const IMatrix3d t)

Description: Transform the region (modifies self)

t:The transformation to apply.
Returns:The transformed region.

Transforms the region with the given 3d matrix transformation. This version modifies the region and returns a reference to self.

This variant was introduced in version 0.27.

transform_icplx

Signature: Region transform_icplx (const ICplxTrans t)

Description: Transform the region with a complex transformation (modifies self)

t:The transformation to apply.
Returns:The transformed region.

Use of this method is deprecated. Use transform instead

Transforms the region with the given transformation. This version modifies the region and returns a reference to self.

transformed

(1) Signature: [const] Region transformed (const Trans t)

Description: Transforms the region

t:The transformation to apply.
Returns:The transformed region.

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

(2) Signature: [const] Region transformed (const ICplxTrans t)

Description: Transforms the region with a complex transformation

t:The transformation to apply.
Returns:The transformed region.

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

(3) Signature: [const] Region transformed (const IMatrix2d t)

Description: Transforms the region

t:The transformation to apply.
Returns:The transformed region.

Transforms the region with the given 2d matrix transformation. Does not modify the region but returns the transformed region.

This variant was introduced in version 0.27.

(4) Signature: [const] Region transformed (const IMatrix3d t)

Description: Transforms the region

t:The transformation to apply.
Returns:The transformed region.

Transforms the region with the given 3d matrix transformation. Does not modify the region but returns the transformed region.

This variant was introduced in version 0.27.

transformed_icplx

Signature: [const] Region transformed_icplx (const ICplxTrans t)

Description: Transforms the region with a complex transformation

t:The transformation to apply.
Returns:The transformed region.

Use of this method is deprecated. Use transformed instead

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

width_check

Signature: [const] EdgePairs width_check (unsigned int d, bool whole_edges = false, Metrics metrics = Euclidian, variant ignore_angle = default, variant min_projection = 0, variant max_projection = max, bool shielded = true, bool negative = false, PropertyConstraint property_constraint = IgnoreProperties, ZeroDistanceMode zero_distance_mode = IncludeZeroDistanceWhenTouching)

Description: Performs a width check with options

d:The minimum width for which the polygons are checked
whole_edges:If true, deliver the whole edges
metrics:Specify the metrics type
ignore_angle:The angle above which no check is performed
min_projection:The lower threshold of the projected length of one edge onto another
max_projection:The upper limit of the projected length of one edge onto another
shielded:Enables shielding (see below)
negative:If true, edges not violation the condition will be output as pseudo-edge pairs
property_constraint:Only IgnoreProperties and NoPropertyConstraint are allowed - in the last case, properties are copied from the original shapes to the output. @param zero_distance_mode Specifies how to handle edges with zero distance

Other than 'width' allow more options here.

This version is similar to the simple version with one parameter. In addition, it allows to specify many more options.

If "whole_edges" is true, the resulting EdgePairs collection will receive the whole edges which contribute in the width check.

"metrics" can be one of the constants Euclidian, Square or Projection. See there for a description of these constants.

"ignore_angle" specifies the angle limit of two edges. If two edges form an angle equal or above the given value, they will not contribute in the check. Setting this value to 90 (the default) will exclude edges with an angle of 90 degree or more from the check. Use nil for this value to select the default.

"min_projection" and "max_projection" allow selecting edges by their projected value upon each other. It is sufficient if the projection of one edge on the other matches the specified condition. The projected length must be larger or equal to "min_projection" and less than "max_projection". If you don't want to specify one limit, pass nil to the respective value.

"shielded" controls whether shielding is applied. Shielding means that rule violations are not detected 'through' other features. Measurements are only made where the opposite edge is unobstructed. Shielding often is not optional as a rule violation in shielded case automatically comes with rule violations between the original and the shielding features. If not necessary, shielding can be disabled by setting this flag to false. In general, this will improve performance somewhat.

Merged semantics applies for the input of this method (see merged_semantics= for a description of this concept)

The 'shielded' and 'negative' options have been introduced in version 0.27. 'property_constraint' has been added in version 0.28.4. 'zero_distance_mode' has been added in version 0.28.16.

with_angle

(1) Signature: [const] EdgePairs with_angle (double angle, bool inverse)

Description: Returns markers on every corner with the given angle (or not with the given angle)

If the inverse flag is false, this method returns an error marker (an EdgePair object) for every corner whose connected edges form an angle with the given value (in degree). If the inverse flag is true, the method returns markers for every corner whose angle is not the given value.

The edge pair objects returned will contain both edges forming the angle.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] EdgePairs with_angle (double amin, double amax, bool inverse)

Description: Returns markers on every corner with an angle of more than amin and less than amax (or the opposite)

If the inverse flag is false, this method returns an error marker (an EdgePair object) for every corner whose connected edges form an angle whose value is more or equal to amin (in degree) or less (but not equal to) amax. If the inverse flag is true, the method returns markers for every corner whose angle is not matching that criterion.

The edge pair objects returned will contain both edges forming the angle.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_area

(1) Signature: [const] Region with_area (long area, bool inverse)

Description: Filter the polygons by area

Filters the polygons of the region by area. If "inverse" is false, only polygons which have the given area are returned. If "inverse" is true, polygons not having the given area are returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region with_area (variant min_area, variant max_area, bool inverse)

Description: Filter the polygons by area

Filters the polygons of the region by area. If "inverse" is false, only polygons which have an area larger or equal to "min_area" and less than "max_area" are returned. If "inverse" is true, polygons having an area less than "min_area" or larger or equal than "max_area" are returned.

If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_area_ratio

(1) Signature: [const] Region with_area_ratio (double ratio, bool inverse)

Description: Filters the polygons by the bounding box area to polygon area ratio

The area ratio is defined by the ratio of bounding box area to polygon area. It's a measure how much the bounding box is approximating the polygon. 'Thin polygons' have a large area ratio, boxes has an area ratio of 1. The area ratio is always larger or equal to 1. With 'inverse' set to false, this version filters polygons which have an area ratio equal to the given value. With 'inverse' set to true, all other polygons will be returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

(2) Signature: [const] Region with_area_ratio (variant min_ratio, variant max_ratio, bool inverse, bool min_included = true, bool max_included = true)

Description: Filters the polygons by the aspect ratio of their bounding boxes

The area ratio is defined by the ratio of bounding box area to polygon area. It's a measure how much the bounding box is approximating the polygon. 'Thin polygons' have a large area ratio, boxes has an area ratio of 1. The area ratio is always larger or equal to 1. With 'inverse' set to false, this version filters polygons which have an area ratio between 'min_ratio' and 'max_ratio'. With 'min_included' set to true, the 'min_ratio' value is included in the range, otherwise it's excluded. Same for 'max_included' and 'max_ratio'. With 'inverse' set to true, all other polygons will be returned.

If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

with_bbox_aspect_ratio

(1) Signature: [const] Region with_bbox_aspect_ratio (double ratio, bool inverse)

Description: Filters the polygons by the aspect ratio of their bounding boxes

Filters the polygons of the region by the aspect ratio of their bounding boxes. The aspect ratio is the ratio of larger to smaller dimension of the bounding box. A square has an aspect ratio of 1.

With 'inverse' set to false, this version filters polygons which have a bounding box aspect ratio equal to the given value. With 'inverse' set to true, all other polygons will be returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

(2) Signature: [const] Region with_bbox_aspect_ratio (variant min_ratio, variant max_ratio, bool inverse, bool min_included = true, bool max_included = true)

Description: Filters the polygons by the aspect ratio of their bounding boxes

Filters the polygons of the region by the aspect ratio of their bounding boxes. The aspect ratio is the ratio of larger to smaller dimension of the bounding box. A square has an aspect ratio of 1.

With 'inverse' set to false, this version filters polygons which have a bounding box aspect ratio between 'min_ratio' and 'max_ratio'. With 'min_included' set to true, the 'min_ratio' value is included in the range, otherwise it's excluded. Same for 'max_included' and 'max_ratio'. With 'inverse' set to true, all other polygons will be returned.

If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

with_bbox_height

(1) Signature: [const] Region with_bbox_height (unsigned int height, bool inverse)

Description: Filter the polygons by bounding box height

Filters the polygons of the region by the height of their bounding box. If "inverse" is false, only polygons whose bounding box has the given height are returned. If "inverse" is true, polygons whose bounding box does not have the given height are returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region with_bbox_height (variant min_height, variant max_height, bool inverse)

Description: Filter the polygons by bounding box height

Filters the polygons of the region by the height of their bounding box. If "inverse" is false, only polygons whose bounding box has a height larger or equal to "min_height" and less than "max_height" are returned. If "inverse" is true, all polygons not matching this criterion are returned. If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_bbox_max

(1) Signature: [const] Region with_bbox_max (unsigned int dim, bool inverse)

Description: Filter the polygons by bounding box width or height, whichever is larger

Filters the polygons of the region by the maximum dimension of their bounding box. If "inverse" is false, only polygons whose bounding box's larger dimension is equal to the given value are returned. If "inverse" is true, all polygons not matching this criterion are returned. Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region with_bbox_max (variant min_dim, variant max_dim, bool inverse)

Description: Filter the polygons by bounding box width or height, whichever is larger

Filters the polygons of the region by the minimum dimension of their bounding box. If "inverse" is false, only polygons whose bounding box's larger dimension is larger or equal to "min_dim" and less than "max_dim" are returned. If "inverse" is true, all polygons not matching this criterion are returned. If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_bbox_min

(1) Signature: [const] Region with_bbox_min (unsigned int dim, bool inverse)

Description: Filter the polygons by bounding box width or height, whichever is smaller

Filters the polygons inside the region by the minimum dimension of their bounding box. If "inverse" is false, only polygons whose bounding box's smaller dimension is equal to the given value are returned. If "inverse" is true, all polygons not matching this criterion are returned. Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region with_bbox_min (variant min_dim, variant max_dim, bool inverse)

Description: Filter the polygons by bounding box width or height, whichever is smaller

Filters the polygons of the region by the minimum dimension of their bounding box. If "inverse" is false, only polygons whose bounding box's smaller dimension is larger or equal to "min_dim" and less than "max_dim" are returned. If "inverse" is true, all polygons not matching this criterion are returned. If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_bbox_width

(1) Signature: [const] Region with_bbox_width (unsigned int width, bool inverse)

Description: Filter the polygons by bounding box width

Filters the polygons of the region by the width of their bounding box. If "inverse" is false, only polygons whose bounding box has the given width are returned. If "inverse" is true, polygons whose bounding box does not have the given width are returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region with_bbox_width (variant min_width, variant max_width, bool inverse)

Description: Filter the polygons by bounding box width

Filters the polygons of the region by the width of their bounding box. If "inverse" is false, only polygons whose bounding box has a width larger or equal to "min_width" and less than "max_width" are returned. If "inverse" is true, all polygons not matching this criterion are returned. If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_holes

(1) Signature: [const] Region with_holes (unsigned long nholes, bool inverse)

Description: Filters the polygons by their number of holes

Filters the polygons of the region by number of holes. If "inverse" is false, only polygons which have the given number of holes are returned. If "inverse" is true, polygons not having the given of holes are returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

(2) Signature: [const] Region with_holes (variant min_bholes, variant max_nholes, bool inverse)

Description: Filter the polygons by their number of holes

Filters the polygons of the region by number of holes. If "inverse" is false, only polygons which have a hole count larger or equal to "min_nholes" and less than "max_nholes" are returned. If "inverse" is true, polygons having a hole count less than "min_nholes" or larger or equal than "max_nholes" are returned.

If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

with_perimeter

(1) Signature: [const] Region with_perimeter (unsigned long perimeter, bool inverse)

Description: Filter the polygons by perimeter

Filters the polygons of the region by perimeter. If "inverse" is false, only polygons which have the given perimeter are returned. If "inverse" is true, polygons not having the given perimeter are returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

(2) Signature: [const] Region with_perimeter (variant min_perimeter, variant max_perimeter, bool inverse)

Description: Filter the polygons by perimeter

Filters the polygons of the region by perimeter. If "inverse" is false, only polygons which have a perimeter larger or equal to "min_perimeter" and less than "max_perimeter" are returned. If "inverse" is true, polygons having a perimeter less than "min_perimeter" or larger or equal than "max_perimeter" are returned.

If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

with_relative_height

(1) Signature: [const] Region with_relative_height (double ratio, bool inverse)

Description: Filters the polygons by the ratio of height to width

This method filters the polygons of the region by the ratio of height vs. width of their bounding boxes. 'Tall' polygons have a large value while 'flat' polygons have a small value. A square has a relative height of 1.

An alternative method is 'with_area_ratio' which can be more efficient because it's isotropic.

With 'inverse' set to false, this version filters polygons which have a relative height equal to the given value. With 'inverse' set to true, all other polygons will be returned.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

(2) Signature: [const] Region with_relative_height (variant min_ratio, variant max_ratio, bool inverse, bool min_included = true, bool max_included = true)

Description: Filters the polygons by the bounding box height to width ratio

This method filters the polygons of the region by the ratio of height vs. width of their bounding boxes. 'Tall' polygons have a large value while 'flat' polygons have a small value. A square has a relative height of 1.

An alternative method is 'with_area_ratio' which can be more efficient because it's isotropic.

With 'inverse' set to false, this version filters polygons which have a relative height between 'min_ratio' and 'max_ratio'. With 'min_included' set to true, the 'min_ratio' value is included in the range, otherwise it's excluded. Same for 'max_included' and 'max_ratio'. With 'inverse' set to true, all other polygons will be returned.

If you don't want to specify a lower or upper limit, pass nil to that parameter.

Merged semantics applies for this method (see merged_semantics= for a description of this concept)

This method has been introduced in version 0.27.

write

Signature: [const] void write (string filename)

Description: Writes the region to a file

This method is provided for debugging purposes. It writes the object to a flat layer 0/0 in a single top cell.

This method has been introduced in version 0.29.

xor

Signature: [const] Region xor (const Region other)

Description: Returns the boolean XOR between self and the other region

Returns:The result of the boolean XOR operation

This method will compute the boolean XOR (intersection) between two regions. The result is often but not necessarily always merged.

The 'xor' alias has been introduced in version 0.28.12.

xor_with

Signature: Region xor_with (const Region other)

Description: Performs the boolean XOR between self and the other region in-place (modifying self)

Returns:The region after modification (self)

This method will compute the boolean XOR (intersection) between two regions. The result is often but not necessarily always merged.

Note that in Ruby, the '^=' operator actually does not exist, but is emulated by '^' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'xor_with' instead.

The 'xor_with' alias has been introduced in version 0.28.12.

|

Signature: [const] Region | (const Region other)

Description: Returns the boolean OR between self and the other region

Returns:The resulting region

The boolean OR is implemented by merging the polygons of both regions. To simply join the regions without merging, the + operator is more efficient. The 'or' alias has been introduced in version 0.28.12.

Python specific notes:
This attribute is available as 'or_' in Python.

|=

Signature: Region |= (const Region other)

Description: Performs the boolean OR between self and the other region in-place (modifying self)

Returns:The region after modification (self)

The boolean OR is implemented by merging the polygons of both regions. To simply join the regions without merging, the + operator is more efficient. Note that in Ruby, the '|=' operator actually does not exist, but is emulated by '|' followed by an assignment. This is less efficient than the in-place operation, so it is recommended to use 'or_with' instead.

The 'or_with' alias has been introduced in version 0.28.12.