diff --git a/modules/juce_graphics/geometry/juce_Line.h b/modules/juce_graphics/geometry/juce_Line.h index b938d07728..104f3246ed 100644 --- a/modules/juce_graphics/geometry/juce_Line.h +++ b/modules/juce_graphics/geometry/juce_Line.h @@ -329,6 +329,16 @@ public: && point.y < ((end.y - start.y) * (point.x - start.x)) / (end.x - start.x) + start.y; } + /** Returns a lengthened copy of this line. + + This will extend the line by a certain amount by moving the start away from the end + (leaving the end-point the same), and return the new line. + */ + Line withLengthenedStart (ValueType distanceToLengthenBy) const noexcept + { + return withShortenedStart (-distanceToLengthenBy); + } + //============================================================================== /** Returns a shortened copy of this line. @@ -340,6 +350,16 @@ public: return { getPointAlongLine (jmin (distanceToShortenBy, getLength())), end }; } + /** Returns a lengthened copy of this line. + + This will extend the line by a certain amount by moving the end away from the start + (leaving the start-point the same), and return the new line. + */ + Line withLengthenedEnd (ValueType distanceToLengthenBy) const noexcept + { + return withShortenedEnd (-distanceToLengthenBy); + } + /** Returns a shortened copy of this line. This will chop off part of the end of this line by a certain amount, (leaving the