MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / strip_closing

Function strip_closing

nodedb-spatial/src/predicates/intersection.rs:190–196  ·  view source on GitHub ↗

Strip the closing vertex from a ring if present.

(ring: &[[f64; 2]])

Source from the content-addressed store, hash-verified

188
189/// Strip the closing vertex from a ring if present.
190fn strip_closing(ring: &[[f64; 2]]) -> Vec<[f64; 2]> {
191 if ring.len() >= 2 && ring.first() == ring.last() {
192 ring[..ring.len() - 1].to_vec()
193 } else {
194 ring.to_vec()
195 }
196}
197
198/// Clip a linestring to a polygon: keep only the parts inside.
199fn clip_linestring_to_polygon(line: &[[f64; 2]], rings: &[Vec<[f64; 2]>]) -> Geometry {

Callers 1

sutherland_hodgmanFunction · 0.85

Calls 4

firstMethod · 0.80
lenMethod · 0.45
lastMethod · 0.45
to_vecMethod · 0.45

Tested by

no test coverage detected