use the line optimization for parallel segments

Use the line optimization when computing the bisector of two
parallel segments.

This also fixes a bug for inputs of the following form:

s 100 20 0 20
s 0 80 100 80
s 30 40 30 60

Signed-off-by: Panagiotis Cheilaris <philaris@cs.ntua.gr>
This commit is contained in:
Panagiotis Cheilaris 2014-03-18 12:07:41 +01:00
parent cc2c3e69d0
commit cc3c33d569
1 changed files with 8 additions and 0 deletions

View File

@ -384,6 +384,8 @@ private:
bool have_common_endp = is_mid_psrc or is_mid_ptrg; bool have_common_endp = is_mid_psrc or is_mid_ptrg;
bool optimize_for_line(false);
Are_parallel_2 are_parallel; Are_parallel_2 are_parallel;
// compute supporting lines of segments // compute supporting lines of segments
@ -450,6 +452,8 @@ private:
dinc = -d; dinc = -d;
dout = d; dout = d;
optimize_for_line = true;
} else { } else {
// here p and q are not parallel // here p and q are not parallel
@ -629,6 +633,10 @@ private:
Polychainline pcl (dinc, points, points + 1, dout); Polychainline pcl (dinc, points, points + 1, dout);
if (optimize_for_line) {
pcl.set_line_optimization();
}
return pcl; return pcl;
} }