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::TRectFP Class Reference

#include <cartotype_base.h>

Public Member Functions

 TRectFP ()
 TRectFP (double aMinX, double aMinY, double aMaxX, double aMaxY)
 TRectFP (const TRect &aRect)
bool operator== (const TRectFP &aRect) const
bool operator!= (const TRectFP &aRect) const
bool operator< (const TRectFP &aRect) const
double Left () const noexcept
double Top () const noexcept
double Right () const noexcept
double Bottom () const noexcept
bool IsEmpty () const noexcept
double Width () const noexcept
double Height () const noexcept
TPointFP TopRight () const noexcept
TPointFP BottomLeft () const noexcept
TPointFP Center () const noexcept
bool Contains (const TPointFP &aPoint) const noexcept
bool Contains (const TRectFP &aRect) const noexcept
void Combine (const TPointFP &aPoint)
void Combine (const TRectFP &aRect)
void Intersection (const TRectFP &aRect)
bool Intersects (const TRectFP &aRect) const noexcept
bool Intersects (const TPointFP &aStart, const TPointFP &aEnd, TPointFP *aIntersectionStart=nullptr, TPointFP *aIntersectionEnd=nullptr) const noexcept
TRect Rounded () const noexcept

Public Attributes

TPointFP iTopLeft
TPointFP iBottomRight

Detailed Description

A floating-point rectangle in two-dimensional space, aligned with the coordinate system and defined by its top-left (minimum coords) and bottom-right (maximum coords) corners.

The terms top-left and bottom-right are misleading but are retained for compatibility with TRect and with existing CartoType practice.

Constructor & Destructor Documentation

◆ TRectFP() [1/3]

CartoType::TRectFP::TRectFP ( )

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

◆ TRectFP() [2/3]

CartoType::TRectFP::TRectFP ( double  aMinX,
double  aMinY,
double  aMaxX,
double  aMaxY 

Create a rectangle with the specified edges.

◆ TRectFP() [3/3]

CartoType::TRectFP::TRectFP ( const TRect aRect)

Create a rectangle from an integer rectangle.

Member Function Documentation

◆ Bottom()

double CartoType::TRectFP::Bottom ( ) const

Return the bottom edge.

◆ BottomLeft()

TPointFP CartoType::TRectFP::BottomLeft ( ) const

Return the bottom left corner.

◆ Center()

TPointFP CartoType::TRectFP::Center ( ) const

Return the center.

◆ Combine() [1/2]

void CartoType::TRectFP::Combine ( const TPointFP aPoint)

Update a rectangle such that it contains the specified point.

◆ Combine() [2/2]

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

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

◆ Contains() [1/2]

bool CartoType::TRectFP::Contains ( const TPointFP 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::TRectFP::Contains ( const TRectFP aRect) const

Return true if the rectangle contains another rectangle.

◆ Height()

double CartoType::TRectFP::Height ( ) const

Return the height.

◆ Intersection()

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

Set a rectangle to its intersection with aRect.

◆ Intersects() [1/2]

bool CartoType::TRectFP::Intersects ( const TPointFP aStart,
const TPointFP aEnd,
TPointFP aIntersectionStart = nullptr,
TPointFP 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::TRectFP::Intersects ( const TRectFP 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::TRectFP::IsEmpty ( ) const

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

◆ Left()

double CartoType::TRectFP::Left ( ) const

Return the left edge.

◆ operator!=()

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

The inequality operator.

◆ operator<()

bool CartoType::TRectFP::operator< ( const TRectFP aRect) const

The less-than operator.

◆ operator==()

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

The equality operator.

◆ Right()

double CartoType::TRectFP::Right ( ) const

Return the right edge.

◆ Rounded()

TRect CartoType::TRectFP::Rounded ( ) const

Returns a rectangle with integer coordinates, created by rounding the coordinates of this rectangle.

◆ Top()

double CartoType::TRectFP::Top ( ) const

Return the top edge.

◆ TopRight()

TPointFP CartoType::TRectFP::TopRight ( ) const

Return the top right corner.

◆ Width()

double CartoType::TRectFP::Width ( ) const

Return the width.

Member Data Documentation

◆ iBottomRight

TPointFP CartoType::TRectFP::iBottomRight

The bottom right corner.

◆ iTopLeft

TPointFP CartoType::TRectFP::iTopLeft

The top left corner.

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