template class EE::Math::tRECT

Overview

#include <rect.hpp>

template <typename T>
class tRECT {
public:
    // fields

    T Left;
    T Right;
    T Top;
    T Bottom;

    // construction

    tRECT(T left, T top, T right, T bottom);
    tRECT(const Vector2<T>& pos, const tSize<T>& size);
    tRECT();

    // methods

    tRECT<T> copy() const;
    tRECT<T>& setPosition(const Vector2<T>& pos);
    bool intersect(const tRECT<T>& rect) const;
    bool contains(const tRECT<T>& rect) const;
    bool contains(const Vector2<T>& Vect) const;
    tRECT<T>& expand(const tRECT<T>& rect);
    tRECT<T>& shrink(const tRECT<T>& rect);
    tRECT<T>& expand(const Vector2<T>& Vect);
    T area() const;
    T mergedArea(const tRECT<T>& rect) const;
    bool overlap(const tRECT<T>& rect) const;
    bool intersectsSegment(const Vector2<T>& a, const Vector2<T>& b) const;
    bool intersectCircle(Vector2<T> pos, const T& radius) const;
    bool intersectCircles(const tRECT<T>& b) const;
    Vector2<T> clampVector(const Vector2<T>& Vect) const;
    Vector2<T> wrapVector(const Vector2<T>& Vect) const;
    Vector2<T> getPosition() const;
    Vector2<T> getCenter() const;
    tSize<T> getSize() const;
    T getWidth() const;
    T getHeight() const;
    tRECT<T> ceil() const;
    tRECT<T> floor() const;
    tRECT<T> round() const;
    tRECT<T> roundUp() const;
    tRECT<T> roundDown() const;
    tRECT<T>& scale(T scale, const Vector2<T>& center);
    tRECT<T>& scale(T scale);
    tRECT<T>& scale(Vector2<T> scale, const Vector2<T>& center);
    tRECT<T>& scale(Vector2<T> scale);
    tRECT<Float> asFloat() const;
    tRECT<int> asInt() const;
};

Detailed Documentation

Methods

bool intersectCircle(Vector2<T> pos, const T& radius) const

Determine if a RECT and a Circle are intersecting

Parameters:

pos

Circle position

radius

Circle Radius

Returns:

True if are intersecting

bool intersectCircles(const tRECT<T>& b) const

Determine if a RECT ( representing a circle ) is intersecting another RECT ( also representing a circle )