Skip to content

partition_rectanglePartitionRectanglePartitionRectanglepartition_rectanglepartition_rectangle🔗

Short description🔗

partition_rectanglePartitionRectanglePartitionRectanglepartition_rectanglepartition_rectangle — Partition a region into rectangles of approximately equal size.

Signature🔗

partition_rectangle( region Region, out region Partitioned, extent.x Width, extent.y Height )void PartitionRectangle( const HObject& Region, HObject* Partitioned, const HTuple& Width, const HTuple& Height )static void HOperatorSet.PartitionRectangle( HObject region, out HObject partitioned, HTuple width, HTuple height )def partition_rectangle( region: HObject, width: float, height: float ) -> HObject

Herror partition_rectangle( const Hobject Region, Hobject* Partitioned, double Width, double Height )

Herror T_partition_rectangle( const Hobject Region, Hobject* Partitioned, const Htuple Width, const Htuple Height )

HRegion HRegion::PartitionRectangle( double Width, double Height ) const

HRegion HRegion.PartitionRectangle( double width, double height )

Description🔗

partition_rectanglePartitionRectangle partitions the input region into rectangles having an extent of Widthwidthwidth times Heightheightheight. The rectangles are returned in Partitionedpartitionedpartitioned. The region is always split into rectangles of approximately equal size. If this is not possible with the requested rectangle size, then Widthwidthwidth and Heightheightheight are adapted so that the size of the resulting rectangles is approximately equal. If the region is smaller than the given size, its output remains unchanged. A partition is only done if the size of the region is at least 1.5 times the size of the rectangle given by the parameters.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region to be partitioned.

Partitionedpartitionedpartitioned (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Partitioned region.

Widthwidthwidth (input_control) extent.x → (real)HTuple (double)HTuple (double)floatHtuple (double)

Width of the individual rectangles.

Heightheightheight (input_control) extent.y → (real)HTuple (double)HTuple (double)floatHtuple (double)

Height of the individual rectangles.

Result🔗

partition_rectanglePartitionRectangle returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior in case of empty input (no regions given) can be set via set_system('no_object_result',<Result>), the behavior in case of an empty input region via set_system('empty_region_result',<Result>), and the behavior in case of an empty result region via set_system('store_empty_region',<'true'/'false'>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, connectionConnection

Alternatives

partition_dynamicPartitionDynamic

See also

intersectionIntersection, smallest_rectangle1SmallestRectangle1, shape_transShapeTrans, clip_regionClipRegion

Module🔗

Foundation