Skip to content

Incorrect output #27

@bobroberts177

Description

@bobroberts177

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions