@@ -485,19 +485,23 @@ float LimbPath::GetMiddleX() const {
485
485
// TODO - these implementations should be more accurate (segments are additive), but they don't seem to work as well
486
486
// Investigate!
487
487
/* float LimbPath::GetLowestY() const {
488
- float lowestY = m_Start.GetY();
488
+ float currentY = m_Start.GetY();
489
+ float lowestY = currentY;
489
490
for (auto itr = m_Segments.begin() + m_StartSegCount; itr != m_Segments.end(); ++itr) {
490
- lowestY += itr->GetY() > 0 ? itr->GetY() : 0;
491
+ currentY += itr->GetY();
492
+ lowestY = std::min(currentY, lowestY);
491
493
}
492
494
return lowestY * GetTotalScaleMultiplier().GetY();
493
495
}
494
496
495
497
float LimbPath::GetMiddleX() const {
496
- float lowestX = m_Start.GetX();
497
- float highestX = m_Start.GetX();
498
+ float currentX = m_Start.GetX();
499
+ float lowestX = currentX;
500
+ float highestX = currentX;
498
501
for (auto itr = m_Segments.begin() + m_StartSegCount; itr != m_Segments.end(); ++itr) {
499
- lowestX += itr->GetX() < 0 ? itr->GetX() : 0;
500
- highestX += itr->GetX() > 0 ? itr->GetX() : 0;
502
+ currentX += itr->GetX();
503
+ lowestX = std::min(currentX, lowestX);
504
+ highestX = std::max(currentX, highestX);
501
505
}
502
506
lowestX *= GetTotalScaleMultiplier().GetX();
503
507
highestX *= GetTotalScaleMultiplier().GetX();
0 commit comments