Rectangles

Back to Mathematics

A rectangle in is a Cartesian product of intervals.

Theory

Alternatively, a rectangle can be described by two points and in , such that

.

In this representation, is called the minimum point, and is called the maximum point.

Practice

In Pastel, a rectangle is modeled with the AlignedBox<integer, N> class using the min-max representation. The minimum point and the maximum point are initialized to infinity\(), and -(integer)Infinity(), respectively, to represent an empty rectangle. The same class template is used to represent axis-aligned boxes in , by providing a type modeling the Real concept. The PastelGeometry library takes this view further.

Learn more

Files

Algorithms for aligned boxes

Aligned box module

Axis-aligned box

Intersection between two aligned boxes

Set-difference between aligned boxes