Bounding Box

Header: fiction/layouts/bounding_box.hpp

template<typename Lyt>
class bounding_box_2d

A 2D bounding box object that 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.

The bounding box does not automatically updated when the layout changes. Call update_bounding_box() to recompute it.

Template Parameters:

Lyt – Gate-level or cell-level layout type.

Public Functions

inline explicit bounding_box_2d(const Lyt &lyt) noexcept

Standard constructor that computes an initial bounding box.

Parameters:

lyt – Gate-level or cell-level layout whose bounding box is desired.

inline void update_bounding_box()

The bounding box is not automatically updated when the layout changes. This function recomputes the bounding box.

inline coordinate<Lyt> get_min() const noexcept

Returns the minimum corner of the bounding box.

In a cartesian_layout<offset::ucoord_t> object, this location represents the most north-western coordinate of the bounding box enclosing every non-empty coordinate.

Returns:

The minimum enclosing coordinate in the associated layout.

inline coordinate<Lyt> get_max() const noexcept

Returns the maximum corner of the bounding box.

In a cartesian_layout<offset::ucoord_t> object, this location represents the most south-eastern coordinate of the bounding box enclosing every non-empty coordinate.

Returns:

The maximum enclosing coordinate in the associated layout.

inline auto get_x_size() const noexcept

Returns the horizontal size of the bounding box in layout coordinates.

Returns:

Bounding box size along the x-axis.

inline auto get_y_size() const noexcept

Returns the vertical size of the bounding box in layout coordinates.

Returns:

Bounding box size along the y-axis.