KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
Point Class Reference

A 2D floating-point point extending QPointF with movement and spatial query methods. More...

#include <point.h>

+ Inheritance diagram for Point:
+ Collaboration diagram for Point:

Classes

class  List
 A list of Point objects with corner-finding helpers. More...
 

Public Member Functions

 Point ()
 Default constructor — creates a point at the origin.
 
 Point (const QPointF &other)
 Construct from a QPointF.
 
 Point (const QPoint &other)
 Construct from a QPoint (integer coordinates).
 
 Point (double x, double y)
 Construct from explicit X and Y coordinates.
 
bool isLeftOf (const QPointF &other) const
 Test whether this point is to the left of other (smaller X).
 
bool isRightOf (const QPointF &other) const
 Test whether this point is to the right of other (larger X).
 
bool isAbove (const QPointF &other) const
 Test whether this point is above other (smaller Y).
 
bool isBelow (const QPointF &other) const
 Test whether this point is below other (larger Y).
 
Pointmove (Geo::Direction direction, double amount)
 Move this point in a cardinal direction by the given amount.
 
Pointmove (double bearing, double distance)
 Move this point by a bearing and distance.
 
PointmoveDelta (double dx, double dy)
 Translate this point by a (dx, dy) delta.
 
Pointround ()
 Round both coordinates to the nearest integer in place.
 
Pointoffset (double x, double y)
 Offset this point by the given (x, y) amounts.
 
Point delta (const Point &other) const
 Compute the (dx, dy) vector from this point to another.
 
QString toString () const
 Format this point as "x, y".
 

Static Public Member Functions

static Point fromString (const QString &value)
 Parse a Point from a string produced by toString().
 

Detailed Description

A 2D floating-point point extending QPointF with movement and spatial query methods.

Extends QPointF with movement transforms, string conversion, and a list subclass.

Definition at line 15 of file point.h.

Constructor & Destructor Documentation

◆ Point() [1/4]

Point::Point ( )
inline

Default constructor — creates a point at the origin.

Definition at line 19 of file point.h.

◆ Point() [2/4]

Point::Point ( const QPointF &  other)
inline

Construct from a QPointF.

Parameters
otherSource QPointF

Definition at line 22 of file point.h.

◆ Point() [3/4]

Point::Point ( const QPoint &  other)
inline

Construct from a QPoint (integer coordinates).

Parameters
otherSource QPoint

Definition at line 25 of file point.h.

◆ Point() [4/4]

Point::Point ( double  x,
double  y 
)
inline

Construct from explicit X and Y coordinates.

Parameters
xX coordinate
yY coordinate

Definition at line 31 of file point.h.

Member Function Documentation

◆ delta()

Point Point::delta ( const Point other) const

Compute the (dx, dy) vector from this point to another.

Parameters
otherTarget point
Returns
Delta point representing the displacement

◆ fromString()

static Point Point::fromString ( const QString &  value)
static

Parse a Point from a string produced by toString().

Parameters
valueString of the form "x, y"
Returns
Parsed Point

◆ isAbove()

bool Point::isAbove ( const QPointF &  other) const
inline

Test whether this point is above other (smaller Y).

Parameters
otherReference point
Returns
true if this point's Y is less than other's Y

Definition at line 44 of file point.h.

◆ isBelow()

bool Point::isBelow ( const QPointF &  other) const
inline

Test whether this point is below other (larger Y).

Parameters
otherReference point
Returns
true if this point's Y is greater than other's Y

Definition at line 48 of file point.h.

◆ isLeftOf()

bool Point::isLeftOf ( const QPointF &  other) const
inline

Test whether this point is to the left of other (smaller X).

Parameters
otherReference point
Returns
true if this point's X is less than other's X

Definition at line 36 of file point.h.

◆ isRightOf()

bool Point::isRightOf ( const QPointF &  other) const
inline

Test whether this point is to the right of other (larger X).

Parameters
otherReference point
Returns
true if this point's X is greater than other's X

Definition at line 40 of file point.h.

◆ move() [1/2]

Point & Point::move ( double  bearing,
double  distance 
)

Move this point by a bearing and distance.

Parameters
bearingCompass bearing in degrees
distanceDistance to move
Returns
Reference to this point

◆ move() [2/2]

Point & Point::move ( Geo::Direction  direction,
double  amount 
)

Move this point in a cardinal direction by the given amount.

Parameters
directionCardinal direction to move
amountDistance to move
Returns
Reference to this point

◆ moveDelta()

Point & Point::moveDelta ( double  dx,
double  dy 
)

Translate this point by a (dx, dy) delta.

Parameters
dxHorizontal displacement
dyVertical displacement
Returns
Reference to this point

◆ offset()

Point & Point::offset ( double  x,
double  y 
)

Offset this point by the given (x, y) amounts.

Parameters
xHorizontal offset
yVertical offset
Returns
Reference to this point

◆ round()

Point & Point::round ( )

Round both coordinates to the nearest integer in place.

Returns
Reference to this point

◆ toString()

QString Point::toString ( ) const
inline

Format this point as "x, y".

Returns
String representation

Definition at line 97 of file point.h.


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