template class EE::Math::tSize

Overview

A template class to manipulate sizes. More…

#include <size.hpp>

template <typename T>
class tSize: public EE::Math::Vector2 {
public:
    // construction

    tSize();
    tSize(const T& width, const T& height);
    tSize(const tSize<T>& Size);
    tSize(const Vector2<T>& Vec);

    // methods

    const T& getWidth() const;
    const T& getHeight() const;
    void setWidth(const T& width);
    void setHeight(const T& height);
    tSize<T>& operator=(const tSize<T>& right);
};

Inherited Members

public:
    // fields

    static const Vector2<T> Zero = Vector2<T>(0, 0);
    static const Vector2<T> One = Vector2<T>(1, 1);
    T x;
    T y;

    // methods

    Vector2<T> copy();
    T dot(const Vector2<T>& V2) const;
    T cross(const Vector2<T>& V2) const;
    Vector2<T> perp() const;
    Vector2<T> rPerp() const;
    Vector2<T> rotate(const Vector2<T>& V2) const;
    Vector2<T> unrotate(const Vector2<T>& V2) const;
    T length() const;
    T lengthSq() const;
    void normalize();
    void clamp(T len);
    Vector2<T> forAngle(const T& a) const;
    T toAngle();
    void rotate(const T& Angle);
    void rotate(const T& Angle, const Vector2<T>& RotationCenter);
    T distance(const Vector2<T>& Vec) const;
    T distanceSq(const Vector2<T>& Vec) const;
    bool nearDist(const Vector2<T>& Vec, T Dist) const;
    Vector2<T> sphericalLerp(const Vector2<T>& Vec, T Time) const;
    Vector2<T> sphericalLerpConst(const Vector2<T>& Vec, T Angle) const;
    Vector2<T> lerp(const Vector2<T>& Vec, T Time) const;
    Vector2<T> lerpConst(const Vector2<T>& Vec, T Dist) const;
    void scale(const Vector2<T>& scale, const Vector2<T>& Center);
    void scale(const T& scale, const Vector2<T>& Center);
    Vector2<T> ceil() const;
    Vector2<T> floor() const;
    Vector2<T> round() const;
    Vector2<T> roundUp() const;
    Vector2<T> roundDown() const;
    Vector2<T> abs() const;
    Vector2<Float> asFloat() const;
    Vector2<int> asInt() const;
    Vector2<T>& operator=(const Vector2<T>& right);

Detailed Documentation

A template class to manipulate sizes.

Construction

tSize()

Default constructor, creates a tSize(0,0)

tSize(const T& width, const T& height)

Creates a tSize of the width and height

tSize(const tSize<T>& Size)

Creates a copy of a size

tSize(const Vector2<T>& Vec)

Creates a size from a Vector2

Methods

const T& getWidth() const

Returns:

The size width

const T& getHeight() const

Returns:

The size height

void setWidth(const T& width)

Set a new width

void setHeight(const T& height)

Set a new height