mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Point: Fix a division by zero in getPointAlongLine
This commit is contained in:
parent
db3a0a1ae8
commit
0d82541728
1 changed files with 2 additions and 1 deletions
|
|
@ -203,7 +203,8 @@ public:
|
|||
*/
|
||||
Point<ValueType> getPointAlongLine (ValueType distanceFromStart) const noexcept
|
||||
{
|
||||
return start + (end - start) * (distanceFromStart / getLength());
|
||||
const auto length = getLength();
|
||||
return length == 0 ? start : start + (end - start) * (distanceFromStart / length);
|
||||
}
|
||||
|
||||
/** Returns a point which is a certain distance along and to the side of this line.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue