Skip to content

Commit 5766d53

Browse files
committed
Theoretical fixes that don't improve anything >:(
1 parent dbb48cf commit 5766d53

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Source/Entities/LimbPath.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,19 +485,23 @@ float LimbPath::GetMiddleX() const {
485485
// TODO - these implementations should be more accurate (segments are additive), but they don't seem to work as well
486486
// Investigate!
487487
/*float LimbPath::GetLowestY() const {
488-
float lowestY = m_Start.GetY();
488+
float currentY = m_Start.GetY();
489+
float lowestY = currentY;
489490
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);
491493
}
492494
return lowestY * GetTotalScaleMultiplier().GetY();
493495
}
494496
495497
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;
498501
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);
501505
}
502506
lowestX *= GetTotalScaleMultiplier().GetX();
503507
highestX *= GetTotalScaleMultiplier().GetX();

0 commit comments

Comments
 (0)