// Translate branch on 0.1 of vector [v1,v2] void RefinementState::stretchBranch (const Filter &branch, const RefinementState &state, int v1_idx, int v2_idx, int val) { int i; float r, sh = 0.1f * val; const Vec2f &v1 = state.layout[v1_idx]; const Vec2f &v2 = state.layout[v2_idx]; Vec2f d; d.diff(v2, v1); r = d.length(); if (r < EPSILON) throw Error("too small edge"); d.scale(sh / r); if (branch.valid(v1_idx)) d.negate(); layout.clear_resize(state.layout.size()); for (i = _graph.vertexBegin(); i < _graph.vertexEnd(); i = _graph.vertexNext(i)) { if (!branch.valid(i)) layout[i].sum(state.layout[i], d); else layout[i] = state.layout[i]; } }