Bounding Box

The bounding box encloses occupied coordinates, including objects outside an editing layout’s frame. Empty layouts have no minimum or maximum coordinate: getters return optional values in C++ and None in Python. Width and height are inclusive coordinate counts.

Header: fiction/layouts/bounding_box.hpp

template<typename Lyt>
class bounding_box

Cached two-dimensional bounds of every occupied coordinate, including positions outside the geometry.

Template Parameters:

Lyt – Gate-level layout or cell grid.

Public Functions

inline explicit bounding_box(const Lyt &lyt)

Computes occupied bounds.

Parameters:

lyt – Layout whose occupied positions are enclosed.

inline void update_bounding_box()

Recomputes bounds from live occupied coordinates. Empty layouts have no bounds.

inline std::optional<fiction::layouts::layout_base::coordinate> get_min() const noexcept

Returns the minimum occupied corner, or no coordinate for an empty layout.

inline std::optional<fiction::layouts::layout_base::coordinate> get_max() const noexcept

Returns the maximum occupied corner, or no coordinate for an empty layout.

inline uint64_t get_x_size() const noexcept

Counts occupied bounding columns; zero for an empty layout.

inline uint64_t get_y_size() const noexcept

Counts occupied bounding rows; zero for an empty layout.

bounding_box(self) → tuple[coordinate | None, coordinate | None]

Returns the minimum and maximum corner of the bounding box. A 2D bounding box object computes a minimum-sized box around all non-empty coordinates in a given layout. Layouts can be of arbitrary size and, thus, may be larger than their contained elements. Sometimes, it might be necessary to know exactly which space the associated layout internals occupy. A bounding box computes coordinates that span a minimum-sized rectangle that encloses all non- empty layout coordinates.

Returns:

The minimum and maximum enclosing coordinate in the associated layout.

bounding_box(self) → tuple[coordinate | None, coordinate | None]

Returns the minimum and maximum corner of the bounding box. A 2D bounding box object computes a minimum-sized box around all non-empty coordinates in a given layout. Layouts can be of arbitrary size and, thus, may be larger than their contained elements. Sometimes, it might be necessary to know exactly which space the associated layout internals occupy. A bounding box computes coordinates that span a minimum-sized rectangle that encloses all non- empty layout coordinates.

Returns:

The minimum and maximum enclosing coordinate in the associated layout.

bounding_box(self) → tuple[coordinate | None, coordinate | None]

Returns the minimum and maximum corner of the bounding box. A 2D bounding box object computes a minimum-sized box around all non-empty coordinates in a given layout. Layouts can be of arbitrary size and, thus, may be larger than their contained elements. Sometimes, it might be necessary to know exactly which space the associated layout internals occupy. A bounding box computes coordinates that span a minimum-sized rectangle that encloses all non- empty layout coordinates.

Returns:

The minimum and maximum enclosing coordinate in the associated layout.

bounding_box(self) → tuple[coordinate | None, coordinate | None]

Returns the minimum and maximum corner of the bounding box. A 2D bounding box object computes a minimum-sized box around all non-empty coordinates in a given layout. Layouts can be of arbitrary size and, thus, may be larger than their contained elements. Sometimes, it might be necessary to know exactly which space the associated layout internals occupy. A bounding box computes coordinates that span a minimum-sized rectangle that encloses all non- empty layout coordinates.

Returns:

The minimum and maximum enclosing coordinate in the associated layout.

bounding_box(self) → tuple[coordinate | None, coordinate | None]

Returns the minimum and maximum corner of the bounding box. A 2D bounding box object computes a minimum-sized box around all non-empty coordinates in a given layout. Layouts can be of arbitrary size and, thus, may be larger than their contained elements. Sometimes, it might be necessary to know exactly which space the associated layout internals occupy. A bounding box computes coordinates that span a minimum-sized rectangle that encloses all non- empty layout coordinates.

Returns:

The minimum and maximum enclosing coordinate in the associated layout.