diff --git a/src/draw.rs b/src/draw.rs index b91cabe..f780820 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -83,15 +83,16 @@ impl<'a> Draw<'a> { &mut self, head: Head, around: DotIndex, - cw: bool, width: f64, ) -> Result { let mut tangents = self .guide(&Default::default()) .head_around_dot_segments(&head, around, width); + let mut dirs = [true, false]; if tangents.1.euclidean_length() < tangents.0.euclidean_length() { tangents = (tangents.1, tangents.0); + dirs = [false, true]; } for (i, tangent) in [tangents.0, tangents.1].iter().enumerate() { @@ -100,7 +101,7 @@ impl<'a> Draw<'a> { TaggedIndex::Dot(around), tangent.start_point(), tangent.end_point(), - cw, + dirs[i], width, ) { Ok(head) => { diff --git a/src/route.rs b/src/route.rs index e347ce9..aa6079b 100644 --- a/src/route.rs +++ b/src/route.rs @@ -78,9 +78,7 @@ impl<'a> Route<'a> { pub fn step(&mut self, trace: &mut Trace, to: VertexIndex, width: f64) -> Result<(), ()> { let to_dot = self.mesh.dot(to); - trace.head = self - .draw() - .segbend_around_dot(trace.head, to_dot, true, width)?; + trace.head = self.draw().segbend_around_dot(trace.head, to_dot, width)?; trace.path.push(to); Ok(()) }