Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect output #27

Open
bobroberts177 opened this issue Oct 5, 2022 · 0 comments
Open

Incorrect output #27

bobroberts177 opened this issue Oct 5, 2022 · 0 comments

Comments

@bobroberts177
Copy link

This does not produce the correct visibility in the following situation:

    let point = geo::Point::new(1.53, -0.4);
    let lines = vec![
      Line {
        start: Coordinate { x: 0.0, y: 0.5 },
        end: Coordinate { x: 1.5, y: 0.5 },
      },
      Line {
        start: Coordinate { x: 0.0, y: 0.0 },
        end: Coordinate { x: 0.0, y: 1.0 },
      },
      Line {
        start: Coordinate { x: 1.5, y: 0.5 },
        end: Coordinate { x: 1.5, y: 1.5 },
      },
      Line {
        start: Coordinate { x: 0.5, y: -0.5 },
        end: Coordinate { x: 0.5, y: 0.5 },
      },
      Line {
        start: Coordinate { x: -25.0, y: -25.0 },
        end: Coordinate { x: 25.0, y: -25.0 },
      },
      Line {
        start: Coordinate { x: 25.0, y: -25.0 },
        end: Coordinate { x: 25.0, y: 25.0 },
      },
      Line {
        start: Coordinate { x: 25.0, y: 25.0 },
        end: Coordinate { x: -25.0, y: 25.0 },
      },
      Line {
        start: Coordinate { x: -25.0, y: 25.0 },
        end: Coordinate { x: -25.0, y: -25.0 },
      },
    ];
    let vis = point.visibility(lines.as_slice());

The output is:

Polygon { exterior: LineString([Coordinate { x: 25.0, y: 25.0 }, Coordinate { x: 25.0, y: -25.0 }, Coordinate { x: -25.0, y: -25.0 }, Coordinate { x: -25.0, y: -2.975728155339805 }, Coordinate { x: 0.5, y: -0.5 }, Coordinate { x: 0.5, y: 0.5 }, Coordinate { x: 0.0, y: 1.0 }, Coordinate { x: 0.5464285714285712, y: 0.5000000000000001 }, Coordinate { x: 25.0, y: 25.0 }]), interiors: [] }

This is incorrect. In particular, the Coordinate { x: 0.0, y: 1.0 } should not be visible (the first line blocks it).

It also prints out the following warnings:

[geo_visibility::visibility] ray intersects a line segment iff the line segment is in the state
[geo_visibility::visibility] ray intersects a line segment iff the line segment is in the state
[geo_visibility::visibility] ray intersects a line segment iff the line segment is in the state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant