TRect


This object has been removed in release 10.0.0. Use NTL objects instead.

Describes rectangle which is a storage for four same type values.

You can find more information in comments below.

template<class Type> union TRect
    {
        struct
        {
            Type Left;
            Type Top;
            Type Right;
            Type Bottom;
        };
        Type Data[4];
    
        bool operator==(const TRect &other) const; // Compare if equal 
        bool operator!=(const TRect &other) const; // Compare if unequal 
        const Type &operator[](const int index) const; // Return element 
        Type &operator[](const int index); // Return element 
        TRect operator+(const Type value) const; // Move 
        TRect operator+(const TPoint<Type> &value) const; // Move. Since 5.0.0 
        TRect operator+(const TRect &other) const; // Find bounding rect for both rects 
        TRect &operator+=(const Type value); // Move 
        TRect &operator+=(const TPoint<Type> &value); // Move. Since 5.0.0 
        TRect &operator+=(const TRect &other); // Find bounding rect for both rects 
        TRect operator-(const Type value) const; // Move 
        TRect operator-(const TPoint<Type> &value) const; // Move. Since 5.0.0 
        TRect &operator-=(const Type value); // Move 
        TRect &operator-=(const TPoint<Type> &value); // Move. Since 5.0.0 
        TRect operator/(const Type value) const; // Scale 
        TRect &operator/=(const Type value); // Scale 
        TRect operator*(const Type value) const; // Scale 
        TRect operator*(const TRect &other) const; // Intersection 
        TRect &operator*=(const Type value); // Scale 
        TRect &operator*=(const TRect &other); // Intersection 
    
        bool is_valid() const; // Return whether right border isn't less than left and bottom isn't less than top 
        bool is_empty() const; // Return whether right border is same as left and bottom is same as top 
        bool is_zero() const; // Return whether either right border is same to left or bottom is same to top 
        bool has_negative() const; // Whether there is a negative element 
        bool has_positive() const; // Whether there is a positive element 
    
        Type Width() const; // Rectangle width 
        Type Height() const; // Rectangle height 
        void Validate(); // Make width and height not negative 
        TPoint<Type> LeftTop() const; // Return left-top point 
    
        // Since 6.0.0 
        template<class DEST_TYPE> TRect<DEST_TYPE> convert() const; // Return rectangle with the same components but different data type 
        template<class DEST_TYPE> void convert(TRect<DEST_TYPE> &dest) const; // Copy elements into the destination rectangle converting them to new data type 
        bool is_equal(const TRect &other, const Type tolerance) const; // Compare whether the rectangle is equal to the other one with specified threshold 
        bool is_not_equal(const TRect &other, const Type tolerance) const; // Compare whether the rectangle is not equal to the other one with specified threshold 
    };
Namespace: nitisa::math
Include: Nitisa/Modules/Math/Rect.h