ge211
Basic_rectangle< T > Struct Template Reference

Detailed Description

template<class T>
struct ge211::geometry::Basic_rectangle< T >

Represents a positioned rectangle.

Definition at line 75 of file ge211_forward.h.

Classes

class  iterator
 An iterator over the Basic_position<T>s of a Basic_rectangle<T>. More...
 

Public Types

using Coordinate = T
 The coordinate type for the rectangle. More...
 
using Dimensions = Basic_dimensions< Coordinate >
 A dimensions type having the same coordinate type as this rectangle type. More...
 
using Position = Basic_position< Coordinate >
 A position type having the same coordinate type as this rectangle type. More...
 

Public Member Functions

template<typename U >
Basic_rectangle< U > into () const noexcept(is_nothrow_convertible< Coordinate, U >)
 Converts a Basic_rectangle to another coordinate type.
 
Dimensions dimensions () const noexcept(is_nothrow_convertible< Coordinate >())
 The dimensions of the rectangle. More...
 
Position top_left () const noexcept(has_nothrow_arithmetic< Coordinate >())
 The position of the top left vertex.
 
Position top_right () const noexcept(has_nothrow_arithmetic< Coordinate >())
 The position of the top right vertex.
 
Position bottom_left () const noexcept(has_nothrow_arithmetic< Coordinate >())
 The position of the bottom left vertex.
 
Position bottom_right () const noexcept(has_nothrow_arithmetic< Coordinate >())
 The position of the bottom right vertex.
 
Position center () const noexcept(has_nothrow_arithmetic< Coordinate >() &&has_nothrow_division< Coordinate, int >())
 The position of the center of the rectangle.
 
iterator begin () const
 Returns an iterator to the top left corner of this rectangle.
 
iterator end () const
 Returns an iterator one past the end of this rectangle.
 

Static Public Member Functions

static Basic_rectangle from_top_left (Position tl, Dimensions dims) noexcept(has_nothrow_arithmetic< Coordinate >())
 Creates a Basic_rectangle given the position of its top left vertex and its dimensions. More...
 
static Basic_rectangle from_top_right (Position tr, Dimensions dims) noexcept(has_nothrow_arithmetic< Coordinate >())
 Creates a Basic_rectangle given the position of its top right vertex and its dimensions. More...
 
static Basic_rectangle from_bottom_left (Position bl, Dimensions dims) noexcept(has_nothrow_arithmetic< Coordinate >())
 Creates a Basic_rectangle given the position of its bottom left vertex and its dimensions. More...
 
static Basic_rectangle from_bottom_right (Position br, Dimensions dims) noexcept(has_nothrow_arithmetic< Coordinate >())
 Creates a Basic_rectangle given the position of its bottom right vertex and its dimensions. More...
 
static Basic_rectangle from_center (Position center, Dimensions dims) noexcept(has_nothrow_arithmetic< Coordinate >())
 Creates a Basic_rectangle given the position of its center and its dimensions. More...
 

Public Attributes

Coordinate x
 The x coordinate of the upper-left vertex.
 
Coordinate y
 The y coordinate of the upper-left vertex.
 
Coordinate width
 The width of the rectangle in pixels.
 
Coordinate height
 The height of the rectangle in pixels.
 

Member Typedef Documentation

◆ Coordinate

using Coordinate = T

The coordinate type for the rectangle.

This is an alias of type parameter T.

Definition at line 403 of file ge211_geometry.h.

◆ Dimensions

A dimensions type having the same coordinate type as this rectangle type.

Definition at line 406 of file ge211_geometry.h.

◆ Position

A position type having the same coordinate type as this rectangle type.

Definition at line 409 of file ge211_geometry.h.

Member Function Documentation

◆ dimensions()

Dimensions dimensions ( ) const
inlinenoexcept

The dimensions of the rectangle.

Equivalent to Basic_dimensions{rect.width, rect.height}.

Definition at line 466 of file ge211_geometry.h.

◆ from_bottom_left()

static Basic_rectangle from_bottom_left ( Position  bl,
Dimensions  dims 
)
inlinestaticnoexcept

Creates a Basic_rectangle given the position of its bottom left vertex and its dimensions.

Definition at line 442 of file ge211_geometry.h.

◆ from_bottom_right()

static Basic_rectangle from_bottom_right ( Position  br,
Dimensions  dims 
)
inlinestaticnoexcept

Creates a Basic_rectangle given the position of its bottom right vertex and its dimensions.

Definition at line 450 of file ge211_geometry.h.

◆ from_center()

static Basic_rectangle from_center ( Position  center,
Dimensions  dims 
)
inlinestaticnoexcept

Creates a Basic_rectangle given the position of its center and its dimensions.

Definition at line 458 of file ge211_geometry.h.

◆ from_top_left()

static Basic_rectangle from_top_left ( Position  tl,
Dimensions  dims 
)
inlinestaticnoexcept

Creates a Basic_rectangle given the position of its top left vertex and its dimensions.

Definition at line 426 of file ge211_geometry.h.

◆ from_top_right()

static Basic_rectangle from_top_right ( Position  tr,
Dimensions  dims 
)
inlinestaticnoexcept

Creates a Basic_rectangle given the position of its top right vertex and its dimensions.

Definition at line 434 of file ge211_geometry.h.


The documentation for this struct was generated from the following files: