CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Public Attributes | List of all members
CartoTypeCore::RectFP Class Reference

#include <cartotype_base.h>

Public Member Functions

 RectFP ()
 
 RectFP (double aMinX, double aMinY, double aMaxX, double aMaxY)
 
 RectFP (const Rect &aRect)
 
 RectFP (InputStream &aInput)
 
void Write (OutputStream &aOutput) const
 
bool operator== (const RectFP &aRect) const
 
bool operator!= (const RectFP &aRect) const
 
bool operator< (const RectFP &aRect) const
 
double MinX () const noexcept
 
double MinY () const noexcept
 
double MaxX () const noexcept
 
double MaxY () const noexcept
 
bool IsEmpty () const noexcept
 
double Width () const noexcept
 
double Height () const noexcept
 
PointFP MaxMin () const noexcept
 
PointFP MinMax () const noexcept
 
PointFP Center () const noexcept
 
bool Contains (const PointFP &aPoint) const noexcept
 
bool Contains (const RectFP &aRect) const noexcept
 
void Combine (const PointFP &aPoint)
 
void Combine (const RectFP &aRect)
 
void Intersection (const RectFP &aRect)
 
bool Intersects (const RectFP &aRect) const noexcept
 
bool Intersects (const PointFP &aStart, const PointFP &aEnd, PointFP *aIntersectionStart=nullptr, PointFP *aIntersectionEnd=nullptr) const noexcept
 
Rect Rounded () const noexcept
 
RectFP Expanded (double aExpansion) const noexcept
 

Public Attributes

PointFP Min
 
PointFP Max
 

Detailed Description

A floating-point rectangle in two-dimensional space, aligned with the coordinate system and defined by opposite corners with minimum and maximum coordinates.

Constructor & Destructor Documentation

◆ RectFP() [1/4]

CartoTypeCore::RectFP::RectFP ( )
inline

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

◆ RectFP() [2/4]

CartoTypeCore::RectFP::RectFP ( double  aMinX,
double  aMinY,
double  aMaxX,
double  aMaxY 
)
inline

Creates a rectangle with the specified edges.

◆ RectFP() [3/4]

CartoTypeCore::RectFP::RectFP ( const Rect aRect)
inline

Creates a rectangle from an integer rectangle.

◆ RectFP() [4/4]

CartoTypeCore::RectFP::RectFP ( InputStream aInput)
explicit

Creates a RectFP by deserializing it from an input stream.

Member Function Documentation

◆ Center()

PointFP CartoTypeCore::RectFP::Center ( ) const
inlinenoexcept

Return the center.

◆ Combine() [1/2]

void CartoTypeCore::RectFP::Combine ( const PointFP aPoint)
inline

Updates a rectangle such that it contains the specified point.

◆ Combine() [2/2]

void CartoTypeCore::RectFP::Combine ( const RectFP aRect)
inline

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

◆ Contains() [1/2]

bool CartoTypeCore::RectFP::Contains ( const PointFP aPoint) const
inlinenoexcept

Returns true if the rectangle contains the point, where containment is defined using half-open intervals: the rectangle includes points on its minimum X and Y edges but not its maximum X and Y edges.

◆ Contains() [2/2]

bool CartoTypeCore::RectFP::Contains ( const RectFP aRect) const
inlinenoexcept

Returns true if the rectangle contains another rectangle.

◆ Expanded()

RectFP CartoTypeCore::RectFP::Expanded ( double  aExpansion) const
inlinenoexcept

Returns a new rectangle expanded in all directions by aExpansion.

◆ Height()

double CartoTypeCore::RectFP::Height ( ) const
inlinenoexcept

Return the height.

◆ Intersection()

void CartoTypeCore::RectFP::Intersection ( const RectFP aRect)
inline

Sets a rectangle to its intersection with aRect.

◆ Intersects() [1/2]

bool CartoTypeCore::RectFP::Intersects ( const PointFP aStart,
const PointFP aEnd,
PointFP aIntersectionStart = nullptr,
PointFP aIntersectionEnd = nullptr 
) const
noexcept

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 CartoTypeCore::RectFP::Intersects ( const RectFP aRect) const
inlinenoexcept

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

◆ IsEmpty()

bool CartoTypeCore::RectFP::IsEmpty ( ) const
inlinenoexcept

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

◆ MaxMin()

PointFP CartoTypeCore::RectFP::MaxMin ( ) const
inlinenoexcept

Returns the point (Max.X,Min.Y).

◆ MaxX()

double CartoTypeCore::RectFP::MaxX ( ) const
inlinenoexcept

Returns the minimum Y coordinate.

◆ MaxY()

double CartoTypeCore::RectFP::MaxY ( ) const
inlinenoexcept

Returns the maximum Y coordinate.

◆ MinMax()

PointFP CartoTypeCore::RectFP::MinMax ( ) const
inlinenoexcept

Returns the point (Min.X,Max.Y).

◆ MinX()

double CartoTypeCore::RectFP::MinX ( ) const
inlinenoexcept

Returns the minimum X coordinate.

◆ MinY()

double CartoTypeCore::RectFP::MinY ( ) const
inlinenoexcept

Returns the maximum X coordinate.

◆ operator!=()

bool CartoTypeCore::RectFP::operator!= ( const RectFP aRect) const
inline

The inequality operator.

◆ operator<()

bool CartoTypeCore::RectFP::operator< ( const RectFP aRect) const
inline

The less-than operator.

◆ operator==()

bool CartoTypeCore::RectFP::operator== ( const RectFP aRect) const
inline

The equality operator.

◆ Rounded()

Rect CartoTypeCore::RectFP::Rounded ( ) const
noexcept

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

◆ Width()

double CartoTypeCore::RectFP::Width ( ) const
inlinenoexcept

Return the width.

◆ Write()

void CartoTypeCore::RectFP::Write ( OutputStream aOutput) const

Serializes a RectFP to an output stream.

Member Data Documentation

◆ Max

PointFP CartoTypeCore::RectFP::Max

The corner with maximum X and Y coordinates.

◆ Min

PointFP CartoTypeCore::RectFP::Min

The corner with minimum X and Y coordinates.


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