Skip to content

Commit

Permalink
Changing "Add" behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
feiy committed Mar 17, 2021
1 parent 53dacb0 commit 1b5951a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
12 changes: 2 additions & 10 deletions ScratcherLib/CHSpline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,8 @@ int CHSpline::Add(float x, float y)
size_t i = m_samples.size();
if (iter != m_samples.end())
i = iter - m_samples.begin();
if (i > 0 && m_samples[i - 1].x == x)
{
Move(i - 1, y);
return i - 1;
}
else
{
m_samples.insert(m_samples.begin() + i, temp);
return i;
}
m_samples.insert(m_samples.begin() + i, temp);
return i;
}


Expand Down
12 changes: 2 additions & 10 deletions ScratcherLib/LinearInterpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@ int LinearInterpolate::Add(float x, float y)
size_t i = m_samples.size();
if (iter != m_samples.end())
i = iter - m_samples.begin();
if (i > 0 && m_samples[i - 1].x == x)
{
Move(i - 1, y);
return i - 1;
}
else
{
m_samples.insert(m_samples.begin() + i, temp);
return i;
}
m_samples.insert(m_samples.begin() + i, temp);
return i;
}

void LinearInterpolate::Move(size_t i, float y)
Expand Down

0 comments on commit 1b5951a

Please sign in to comment.