int LerpAndAddStrokeVertex(float fValue1, float fValue2, int x1, int y1, int x2, int y2, bool bVerticalEdge) { // swap if need be if (fValue1 > fValue2) { int nSwap = x1; x1 = x2; x2 = nSwap; nSwap = y1; y1 = y2; y2 = nSwap; float fSwap = fValue1; fValue1 = fValue2; fValue2 = fSwap; } float fRefValue1 = fValue1; float fRefValue2 = fValue2; float fX1 = (float)x1 * m_fCellSize + m_fXShift; float fY1 = (float)y1 * m_fCellSize + m_fYShift; float fX2 = (float)x2 * m_fCellSize + m_fXShift; float fY2 = (float)y2 * m_fCellSize + m_fYShift; for (int i = 0; i < 5; ++i) { SubdivideStep(ref fRefValue1, ref fRefValue2, ref fX1, ref fY1, ref fX2, ref fY2, bVerticalEdge); } if (Math.Abs(fRefValue1) < Math.Abs(fRefValue2)) { return(m_stroke.AddVertex(fX1, fY1)); } else { return(m_stroke.AddVertex(fX2, fY2)); } }