Skip to content

RustStudioIst/rust-geo-normalized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-geo-normalized2

crates.io

fork from https://gitlab.com/bronsonbdevost/rust-geo-normalized

geo-normalized = "0.1.1"

更新依赖

from:

geo = "0.12.2"
num-traits = "0.2.11"

to:

# https://crates.io/crates/geo
geo = "0.30.0"
# Numeric traits for generic mathematics
# https://crates.io/crates/num-traits
num-traits = "0.2.19"

rust-geo-normalized

Creates a new instance of the rust geo/geo-types Polygon/Multipolygon that follows the OGC winding rules.

The rust geo and geo-types crates are not as strict as the OGC guidelines, and allow for polygons with inner and outer rings in any winding order. This trait returns a Polygon/Multipolygon where all outer rings are clockwise, and all inner rings are anti-clockwise.

Examples

// Anti-clockwise winding order for outer ring
let bad = polygon![
        (x: 1.0, y: 1.0),
        (x: 4.0, y: 1.0),
        (x: 4.0, y: 4.0),
        (x: 1.0, y: 4.0),
        (x: 1.0, y: 1.0),
        ];

// Clockwise winding order for outer ring
let good = polygon![
        (x: 1.0, y: 1.0),
        (x: 1.0, y: 4.0),
        (x: 4.0, y: 4.0),
        (x: 4.0, y: 1.0),
        (x: 1.0, y: 1.0),
        ];

let norm = bad.normalized();
// norm should have the same points and shape as `bad` but in the valid winding order
assert_eq!(norm, good);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •