[librsvg] marker.rs: Factor out function to bisect the incoming/outgoing angles



commit 968e4e86c6958d7f7f7f0434a383c023dedba5d4
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Jan 27 09:10:37 2017 -0600

    marker.rs: Factor out function to bisect the incoming/outgoing angles
    
    We'll use a separate test for this, as it is still causing trouble.

 rust/src/marker.rs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 10f2170..35c70ad 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -316,6 +316,10 @@ fn angle_from_vector (vx: f64, vy: f64) -> f64 {
     }
 }
 
+fn bisect_angles (incoming: f64, outgoing: f64) -> f64 {
+    (incoming + outgoing) / 2.0
+}
+
 extern "C" {
     fn rsvg_marker_render (marker_name: *const libc::c_char,
                            xpos: f64,
@@ -454,7 +458,7 @@ pub extern fn rsvg_render_markers (ctx: *mut RsvgDrawingCtx,
                         let angle: f64;
 
                         if has_incoming && has_outgoing {
-                            angle = (incoming + outgoing) / 2.0;
+                            angle = bisect_angles (incoming, outgoing);
                         } else if has_incoming {
                             angle = incoming;
                         } else if has_outgoing {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]