Request: Rectangle::translate/translated with Point support


#1

Something along the same lines as AffineTransform's version:

    /** Moves the rectangle's position by adding a point to its x and y coordinates. */
    void translate (Point<ValueType> delta) noexcept
    {
        pos += delta;
    }
 
    /** Returns a rectangle which is the same as this one, moved by a point. */
    Rectangle translated (Point<ValueType> delta) const noexcept
    {
        return translated (delta.x, delta.y);
    }

Quick note: editing code in this new forum is a challenge; copy/pasting code text over other code, or between existant code, causes such to be put on new lines (frustrating!). Using Chrome.

 

Edit: I do realise that the Point params don't take into account rounding - not sure of the best way to deal with that.


#2

Also, there's no "select all" for code in the new forum...


#3

Yeah, we might add a better code snippet handler in future, but wanted to just get the forum working for now.


#4

You can use += and + to do those things, right?


#5

Woops - Indeed I could! Ignore my request then!