ge211
ge211::geometry Namespace Reference

Detailed Description

Geometric objects and their operations.

Classes

struct  Basic_dimensions
 Represents the dimensions of an object, or more generally, the displacement between two Basic_positions. More...
 
struct  Basic_position
 A position in the T-valued Cartesian plane. More...
 
struct  Basic_rectangle
 Represents a positioned rectangle. More...
 
class  Transform
 A rendering transform, which can scale, flip, and rotate. More...
 

Typedefs

using Dimensions = Basic_dimensions< int >
 Type alias for the most common use of Basic_dimensions, which is with a coordinate type of int. More...
 
using Position = Basic_position< int >
 Type alias for the most common use of Basic_position, which is with a coordinate type of int. More...
 
using Rectangle = Basic_rectangle< int >
 Type alias for the most common use of Basic_rectangle, which is with a coordinate type of int. More...
 

Functions

bool operator== (const Transform &, const Transform &) noexcept
 Equality for transforms.
 
bool operator!= (const Transform &, const Transform &) noexcept
 Disequality for transforms.
 
template<class T >
bool operator== (Basic_dimensions< T > a, Basic_dimensions< T > b) noexcept(is_nothrow_comparable< T >())
 Equality for Basic_dimensions.
 
template<class T >
bool operator!= (Basic_dimensions< T > a, Basic_dimensions< T > b) noexcept(is_nothrow_comparable< T >())
 Disequality for Basic_dimensions.
 
template<class T >
Basic_dimensions< T > operator+ (Basic_dimensions< T > d1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Adds two Basic_dimensionses. This is vector addition.
 
template<class T >
Basic_dimensions< T > operator- (Basic_dimensions< T > d1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Subtracts two Basic_dimensionses. This is vector subtraction.
 
template<class T >
Basic_dimensions< T > operator* (Basic_dimensions< T > d1, T s2) noexcept(has_nothrow_arithmetic< T >())
 Multiplies a Basic_dimensions by a scalar.
 
template<class T >
Basic_dimensions< T > operator* (T s1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Multiplies a Basic_dimensions by a scalar.
 
template<class T , class = std::enable_if_t<!std::is_same<T, double>::value, void>>
Basic_dimensions< T > operator* (Basic_dimensions< T > d1, double s2) noexcept(has_nothrow_arithmetic< T, double >())
 Multiplies a Basic_dimensions by a double. More...
 
template<class T , class = std::enable_if_t<!std::is_same<T, double>::value, void>>
Basic_dimensions< T > operator* (double s1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< double, T >())
 Multiplies a Basic_dimensions by a double. More...
 
template<class T >
Basic_dimensions< T > operator/ (Basic_dimensions< T > d1, T s2) noexcept(has_nothrow_division< double, T >())
 Divides a Basic_dimensions by a T. More...
 
template<class T , class = std::enable_if_t<!std::is_same<T, double>::value, void>>
Basic_dimensions< T > operator/ (Basic_dimensions< T > d1, double s2) noexcept(has_nothrow_arithmetic< T, double >)
 Divides a Basic_dimensions by an double. More...
 
template<class T >
Basic_dimensions< T > & operator+= (Basic_dimensions< T > &d1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >)
 Succinct Basic_dimensions addition.
 
template<class T >
Basic_dimensions< T > & operator-= (Basic_dimensions< T > &d1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >)
 Succinct Basic_dimensions subtraction.
 
template<class T >
Basic_dimensions< T > & operator*= (Basic_dimensions< T > &d1, T s2) noexcept(has_nothrow_arithmetic< T >)
 Succinct Basic_dimensions-scalar multiplication.
 
template<class T >
Basic_dimensions< T > & operator*= (Basic_dimensions< T > &d1, double s2) noexcept(has_nothrow_arithmetic< T, double >)
 Succinct Basic_dimensions-scalar multiplication.
 
template<class T >
Basic_dimensions< T > & operator/= (Basic_dimensions< T > &d1, T s2) noexcept(has_nothrow_division< T >)
 Succinct Basic_dimensions-scalar division. More...
 
template<class T >
Basic_dimensions< T > & operator/= (Basic_dimensions< T > &d1, double s2) noexcept(has_nothrow_division< T, double >)
 Succinct Basic_dimensions-scalar division.
 
template<class T >
bool operator== (Basic_position< T > p1, Basic_position< T > p2) noexcept(is_nothrow_comparable< T >())
 Equality for positions.
 
template<class T >
bool operator!= (Basic_position< T > p1, Basic_position< T > p2) noexcept(is_nothrow_comparable< T >())
 Disequality for positions.
 
template<class T >
Basic_position< T > operator+ (Basic_position< T > p1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Translates a position by some displacement. More...
 
template<class T >
Basic_position< T > operator+ (Basic_dimensions< T > d1, Basic_position< T > p2) noexcept(has_nothrow_arithmetic< T >())
 Translates a position by some displacement.
 
template<class T >
Basic_position< T > operator- (Basic_position< T > p1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Translates a position by the opposite of some displacement. More...
 
template<class T >
Basic_dimensions< T > operator- (Basic_position< T > p1, Basic_position< T > p2) noexcept(has_nothrow_arithmetic< T >())
 Translates a position by the opposite of some displacement.
 
template<class T >
Basic_position< T > & operator+= (Basic_position< T > &p1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Succinct position translation.
 
template<class T >
Basic_position< T > & operator-= (Basic_position< T > &p1, Basic_dimensions< T > d2) noexcept(has_nothrow_arithmetic< T >())
 Succinct position translation.
 
template<class T >
bool operator== (const Basic_rectangle< T > &r1, const Basic_rectangle< T > &r2) noexcept(is_nothrow_comparable< T >())
 Equality for rectangles. More...
 
template<class T >
bool operator!= (const Basic_rectangle< T > &r1, const Basic_rectangle< T > &r2) noexcept(is_nothrow_comparable< T >())
 Disequality for rectangles.
 

Typedef Documentation

◆ Dimensions

typedef Basic_dimensions< int > Dimensions

Type alias for the most common use of Basic_dimensions, which is with a coordinate type of int.

Definition at line 77 of file ge211_forward.h.

◆ Position

typedef Basic_position< int > Position

Type alias for the most common use of Basic_position, which is with a coordinate type of int.

Definition at line 78 of file ge211_forward.h.

◆ Rectangle

typedef Basic_rectangle< int > Rectangle

Type alias for the most common use of Basic_rectangle, which is with a coordinate type of int.

Definition at line 79 of file ge211_forward.h.

Function Documentation

◆ operator*() [1/2]

Basic_dimensions<T> ge211::geometry::operator* ( Basic_dimensions< T >  d1,
double  s2 
)
noexcept

Multiplies a Basic_dimensions by a double.

This is vector-scalar multiplication. If the result components would be fractional, they are truncated.

This function is disabled if T is double, as there is another function for that.

Definition at line 104 of file ge211_geometry.h.

◆ operator*() [2/2]

Basic_dimensions<T> ge211::geometry::operator* ( double  s1,
Basic_dimensions< T >  d2 
)
noexcept

Multiplies a Basic_dimensions by a double.

This is vector-scalar multiplication. If the result components would be fractional, they are truncated.

This function is disabled if T is double, as there is another function for that.

Definition at line 119 of file ge211_geometry.h.

◆ operator+()

Basic_position<T> ge211::geometry::operator+ ( Basic_position< T >  p1,
Basic_dimensions< T >  d2 
)
noexcept

Translates a position by some displacement.

This is the same as Position::below_right_by(Basic_dimensions) const.

Definition at line 350 of file ge211_geometry.h.

◆ operator-()

Basic_position<T> ge211::geometry::operator- ( Basic_position< T >  p1,
Basic_dimensions< T >  d2 
)
noexcept

Translates a position by the opposite of some displacement.

This is the same as Position::above_left_by(Basic_dimensions) const.

Definition at line 367 of file ge211_geometry.h.

◆ operator/() [1/2]

Basic_dimensions<T> ge211::geometry::operator/ ( Basic_dimensions< T >  d1,
s2 
)
noexcept

Divides a Basic_dimensions by a T.

This is vector-scalar division. If the result components would be fractional, they are truncated.

Preconditions:
  • z cannot be 0 if T is an integral type.

Definition at line 133 of file ge211_geometry.h.

◆ operator/() [2/2]

Basic_dimensions<T> ge211::geometry::operator/ ( Basic_dimensions< T >  d1,
double  s2 
)
noexcept

Divides a Basic_dimensions by an double.

This is vector-scalar division. If the result components would be fractional, they are truncated.

This function is disabled if T is double, as there is another function for that.

Definition at line 147 of file ge211_geometry.h.

◆ operator/=()

Basic_dimensions<T>& ge211::geometry::operator/= ( Basic_dimensions< T > &  d1,
s2 
)
noexcept

Succinct Basic_dimensions-scalar division.

Preconditions:
  • s2 != 0

Definition at line 193 of file ge211_geometry.h.

◆ operator==()

bool ge211::geometry::operator== ( const Basic_rectangle< T > &  r1,
const Basic_rectangle< T > &  r2 
)
noexcept

Equality for rectangles.

Note that this is naïve, in that it considers empty rectangles with different positions to be different.

Definition at line 547 of file ge211_geometry.h.