From ebde55caabf73acdca7a584df4dbd512e866b8ac Mon Sep 17 00:00:00 2001 From: Aaron Windsor Date: Thu, 16 Oct 2008 12:02:37 +0000 Subject: [PATCH] Patch from David Gleich to fix underflow and overflow that can happen when computing vertex positions in chroback_payne_straight_line_drawing [SVN r49358] --- include/boost/graph/chrobak_payne_drawing.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/graph/chrobak_payne_drawing.hpp b/include/boost/graph/chrobak_payne_drawing.hpp index 6fb7b56d..e8a9104b 100644 --- a/include/boost/graph/chrobak_payne_drawing.hpp +++ b/include/boost/graph/chrobak_payne_drawing.hpp @@ -193,8 +193,8 @@ namespace boost delta_p_q += delta_x[temp]; } - delta_x[v] = (y[rightmost] - y[leftmost] + delta_p_q)/2; - y[v] = (y[rightmost] + y[leftmost] + delta_p_q)/2; + delta_x[v] = ((y[rightmost] + delta_p_q) - y[leftmost])/2; + y[v] = y[leftmost] + delta_x[v]; delta_x[rightmost] = delta_p_q - delta_x[v]; bool leftmost_and_rightmost_adjacent = right[leftmost] == rightmost;