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.