From ec1d7820643688e838c092fd6282ba541de47203 Mon Sep 17 00:00:00 2001 From: Andrew Hunter Date: Mon, 7 Feb 2022 10:02:05 +0000 Subject: [PATCH] Update some comments --- src/bezier/path/arithmetic/ray_cast.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bezier/path/arithmetic/ray_cast.rs b/src/bezier/path/arithmetic/ray_cast.rs index 7c8df3b1..a56105c6 100644 --- a/src/bezier/path/arithmetic/ray_cast.rs +++ b/src/bezier/path/arithmetic/ray_cast.rs @@ -107,7 +107,7 @@ impl GraphPath { let ray_direction = ray.1 - ray.0; let collisions = self.ordered_ray_collisions(&ray); - // Work out which edges are interior or exterior + // Work out which edges are interior or exterior for every edge the ray has crossed for (collision, curve_t, _line_t, _pos) in collisions { let is_intersection = collision.is_intersection(); let edge = collision.edge(); @@ -123,7 +123,7 @@ impl GraphPath { PathDirection::Anticlockwise => { -side } }; - // Extend the path_crossings vector + // Extend the path_crossings vector to accomodate all of the paths included by this ray while path_crossings.len() <= path_number as usize { path_crossings.push(0); } let was_inside = is_inside(&path_crossings); @@ -134,6 +134,9 @@ impl GraphPath { } let is_inside = is_inside(&path_crossings); + // At an intersection, we'll hit both edges but we haven't got enough information to see whether or not they're moving into or + // out of the shape, so we can't set their kind here as we may encounter them in any order + // If this isn't an intersection, set whether or not the edge is exterior let edge_kind = self.edge_kind(edge); if !is_intersection && (edge_kind == GraphPathEdgeKind::Uncategorised || edge_kind == GraphPathEdgeKind::Visited) {