static public void shorten_path(VertexSequence vs, double s, int closed) { if (s > 0.0 && vs.size() > 1) { double d; int n = (int)(vs.size() - 2); while (n != 0) { d = vs[n].dist; if (d > s) break; vs.RemoveLast(); s -= d; --n; } if (vs.size() < 2) { vs.remove_all(); } else { n = (int)vs.size() - 1; VertexDistance prev = vs[n - 1]; VertexDistance last = vs[n]; d = (prev.dist - s) / prev.dist; double x = prev.x + (last.x - prev.x) * d; double y = prev.y + (last.y - prev.y) * d; last.x = x; last.y = y; if (!prev.IsEqual(last)) vs.RemoveLast(); vs.close(closed != 0); } } }
// Vertex Generator Interface public void RemoveAll() { m_src_vertices.remove_all(); m_closed = 0; m_status = StrokeMath.status_e.initial; }