CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Public Attributes | List of all members
CartoType::TRect Class Reference

#include <cartotype_base.h>

Public Member Functions

 TRect ()
 TRect (int32_t aLeft, int32_t aTop, int32_t aRight, int32_t aBottom)
 TRect (const TRectFP &aRectFP) noexcept
bool operator== (const TRect &aRect) const
bool operator!= (const TRect &aRect) const
int32_t Left () const
int32_t Top () const
int32_t Right () const
int32_t Bottom () const
bool IsEmpty () const
bool IsMaximal () const
int32_t Width () const
int32_t Height () const
TPoint TopRight () const
TPoint BottomLeft () const
TPoint Center () const
bool Contains (const TPoint &aPoint) const
bool Contains (const TRect &aRect) const
bool IsOnEdge (const TPoint &aPoint) const noexcept
bool Intersects (const TRect &aRect) const noexcept
bool Intersects (const TPoint &aStart, const TPoint &aEnd, TPoint *aIntersectionStart=nullptr, TPoint *aIntersectionEnd=nullptr) const noexcept
void Intersection (const TRect &aRect) noexcept
void Combine (const TRect &aRect) noexcept
void Combine (const TPoint &aPoint) noexcept

Public Attributes

TPoint iTopLeft
TPoint iBottomRight

Detailed Description

A rectangle in two-dimensional space, aligned with the coordinate system and defined by its top-left and bottom-right corners.

Constructor & Destructor Documentation

◆ TRect() [1/3]

CartoType::TRect::TRect ( )

Create an empty rectangle with both corners at the point (0,0).

◆ TRect() [2/3]

CartoType::TRect::TRect ( int32_t  aLeft,
int32_t  aTop,
int32_t  aRight,
int32_t  aBottom 

Create a rectangle with the specified edges.

◆ TRect() [3/3]

CartoType::TRect::TRect ( const TRectFP aRectFP)

Construct an integer rectangle from a floating-point rectangle, clamping to the 32-bit range and rounding.

Member Function Documentation

◆ Bottom()

int32_t CartoType::TRect::Bottom ( ) const

Return the bottom edge.

◆ BottomLeft()

TPoint CartoType::TRect::BottomLeft ( ) const

Return the bottom left corner.

◆ Center()

TPoint CartoType::TRect::Center ( ) const

Return the center.

◆ Combine() [1/2]

void CartoType::TRect::Combine ( const TPoint aPoint)

Updates a rectangle so that it contains the specified point.

◆ Combine() [2/2]

void CartoType::TRect::Combine ( const TRect aRect)

Set a rectangle to the smallest new rectangle that contains itself and aRect.

◆ Contains() [1/2]

bool CartoType::TRect::Contains ( const TPoint aPoint) const

Return true if the rectangle contains the point, where containment is defined using half-open intervals: the rectangle includes points on its top and left edges but not its right and bottom edges.

◆ Contains() [2/2]

bool CartoType::TRect::Contains ( const TRect aRect) const

Return true if the rectangle contains another rectangle.

◆ Height()

int32_t CartoType::TRect::Height ( ) const

Return the height.

◆ Intersection()

void CartoType::TRect::Intersection ( const TRect aRect)

Set a rectangle to its intersection with aRect.

◆ Intersects() [1/2]

bool CartoType::TRect::Intersects ( const TPoint aStart,
const TPoint aEnd,
TPoint aIntersectionStart = nullptr,
TPoint aIntersectionEnd = nullptr 
) const

Returns true if the rectangle intersects the line from aStart to aEnd. If there is an intersection, and if aIntersectionStart and aIntersectionEnd are non-null, returns the intersecting line.

◆ Intersects() [2/2]

bool CartoType::TRect::Intersects ( const TRect aRect) const

Return true if the rectangle and aRect have an intersection. If both rectangles are non-empty, return true only if the intersection is non-empy.

◆ IsEmpty()

bool CartoType::TRect::IsEmpty ( ) const

Return true if the rectangle is empty, defined as having a width or height less than or equal to zero.

◆ IsMaximal()

bool CartoType::TRect::IsMaximal ( ) const

Return true if the rectangle is maximal, defined as having left and top of INT32_MIN and bottom and right of INT32_MAX.

◆ IsOnEdge()

bool CartoType::TRect::IsOnEdge ( const TPoint aPoint) const

Returns true if aPoint is exactly on an edge of a rectangle.

◆ Left()

int32_t CartoType::TRect::Left ( ) const

Return the left edge.

◆ operator!=()

bool CartoType::TRect::operator!= ( const TRect aRect) const

The inequality operator.

◆ operator==()

bool CartoType::TRect::operator== ( const TRect aRect) const

The equality operator.

◆ Right()

int32_t CartoType::TRect::Right ( ) const

Return the right edge.

◆ Top()

int32_t CartoType::TRect::Top ( ) const

Return the top edge.

◆ TopRight()

TPoint CartoType::TRect::TopRight ( ) const

Return the top right corner.

◆ Width()

int32_t CartoType::TRect::Width ( ) const

Return the width.

Member Data Documentation

◆ iBottomRight

TPoint CartoType::TRect::iBottomRight

The bottom right corner.

◆ iTopLeft

TPoint CartoType::TRect::iTopLeft

The top left corner.

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