#[repr(u8)]pub enum SimplifyAlgorithm {
None = 0,
Rdp = 1,
Visvalingam = 2,
ImaiIri = 3,
}Expand description
The simplification algorithm records which simplifier the encoder ran
when the asset was generated. Each variant sketches its algorithm;
guarantees, citations, and the density-weighted variants are
documented in the utz_simplify crate.
RDP is the default because I had the best results with it when combined with the population density weighting. But your mileage may vary, so I kept the algorithms in for people to play with.
Variants§
None = 0
No simplification runs; the geometry is stored as sourced.
Rdp = 1
Ramer–Douglas–Peucker keeps every point within a maximum deviation of ε. This is the default.
Visvalingam = 2
Visvalingam–Whyatt repeatedly drops the vertex spanning the smallest triangle, trading RDP’s deviation bound for a cartographically smoother caricature; the ε-driven pipeline derives its area threshold as ε², matching the viewer.
ImaiIri = 3
Imai–Iri produces provably minimum vertices for the same ε bound as RDP, at a slower encode. Measured against RDP on full-planet arcs it keeps 3.8% fewer vertices at ε = 100 m, rising to 18–19% fewer at ε = 500–2000 m; a full-pipeline check at ε = 2000 m produced a 12.6% smaller compressed asset for about four seconds of extra encode time.
Implementations§
Source§impl SimplifyAlgorithm
impl SimplifyAlgorithm
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The canonical CLI name (none|rdp|vw|ii), a spelling
from_name() accepts.
Sourcepub fn from_name(name: &str) -> Option<SimplifyAlgorithm>
pub fn from_name(name: &str) -> Option<SimplifyAlgorithm>
The algorithm a name selects: the canonical names plus the long
visvalingam and imai-iri aliases.
Sourcepub const fn from_byte(byte: u8) -> Option<SimplifyAlgorithm>
pub const fn from_byte(byte: u8) -> Option<SimplifyAlgorithm>
The algorithm a header byte names, if any.
Trait Implementations§
Source§impl Clone for SimplifyAlgorithm
impl Clone for SimplifyAlgorithm
Source§fn clone(&self) -> SimplifyAlgorithm
fn clone(&self) -> SimplifyAlgorithm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more