for c in self.wall_grid.grid_coordinates_on_line(p1, p2) {
for w in &self.wall_grid.cells[c.x][c.y] {
if let Intersection::Point(p) = Intersection::lines(p1, p2, w.p1, w.p2) {
for c in self.wall_grid.grid_coordinates_on_line(p1, p2) {
for w in &self.wall_grid.cells[c.x][c.y] {
if let Intersection::Point(p) = Intersection::lines(p1, p2, w.p1, w.p2) {
- let wall = Wall {
- region: Rc::clone(&self.walls[w.region]),
- edge: Rc::clone(w),
- };
- return IntersectResult::Intersection(wall, p)
+ if w.point_is_in_front(p1) {
+ let wall = Wall {
+ region: Rc::clone(&self.walls[w.region]),
+ edge: Rc::clone(w),
+ };
+ return IntersectResult::Intersection(wall, p)
+ }