#polygon #raycasting #geo

geo-raycasting

Ray Casting algorithm for the geo crate

6 releases (3 breaking)

0.7.0 Aug 8, 2024
0.3.0 Jan 20, 2021
0.2.0 Oct 21, 2020
0.1.2 Oct 27, 2019

#702 in Algorithms

Apache-2.0/MIT

12KB
274 lines

geo-raycasting

A simple implementation of Ray Casting algorithm for geo crate, inspired by the code found on https://rosettacode.org/wiki/Ray-casting_algorithm

Example:

use geo_raycasting::RayCasting;

use geo_types::LineString;

fn main() {
    let poly_square: LineString<f64> = vec![(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0), (0.0, 0.0)].into();
    assert!(poly_square.within(&(5.0, 5.0).into()));
}

lib.rs:

geo-raycasting

Ray Casting algorithm for the geo crate

Dependencies

~750KB
~15K SLoC