template struct Core::TPoint

Overview

2D point template class. More…

#include <corepoint.h>

template <typename Type>
struct TPoint
{
    // fields

    Type x;
    Type y;

    // construction

    TPoint(Type x, Type y);
    TPoint();

    // methods

    TPoint& offset(Type dx, Type dy);
    TPoint& offset(const TPoint& p);
    TPoint& operator () (Type x, Type y);
    TPoint& operator *= (float factor);
    TPoint operator * (float factor) const;
    TPoint operator + (const TPoint& p) const;
    TPoint operator - (const TPoint& p) const;
    TPoint& operator += (const TPoint& p);
    TPoint& operator -= (const TPoint& p);
    bool operator == (const TPoint& p) const;
    bool operator != (const TPoint& p) const;
    bool isNull() const;
};

Detailed Documentation

2D point template class.

Fields

Type x

horizontal coordinate

Type y

vertical coordinate

Construction

TPoint(Type x, Type y)

Construct from x/y coordinate.

TPoint()

Construct with (0,0).

Methods

TPoint& offset(Type dx, Type dy)

Offset point.

TPoint& offset(const TPoint& p)

Offset point.

TPoint& operator () (Type x, Type y)

Set point with x/y.

TPoint& operator *= (float factor)

Scale point.

TPoint operator * (float factor) const

Scale point.

TPoint operator + (const TPoint& p) const

Add two points.

TPoint operator - (const TPoint& p) const

Subtract two points.

TPoint& operator += (const TPoint& p)

Add another point.

TPoint& operator -= (const TPoint& p)

Subtract another point.

bool operator == (const TPoint& p) const

Compare point.

bool operator != (const TPoint& p) const

Compare point.

bool isNull() const

Check if point is (0,0).