#[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 moreimpl Copy for SimplifyAlgorithm
Source§impl Debug for SimplifyAlgorithm
impl Debug for SimplifyAlgorithm
Source§impl Default for SimplifyAlgorithm
impl Default for SimplifyAlgorithm
Source§fn default() -> SimplifyAlgorithm
fn default() -> SimplifyAlgorithm
impl Eq for SimplifyAlgorithm
Source§impl PartialEq for SimplifyAlgorithm
impl PartialEq for SimplifyAlgorithm
impl StructuralPartialEq for SimplifyAlgorithm
Source§impl<'a> TryFromCtx<'a, Endian> for SimplifyAlgorithm
impl<'a> TryFromCtx<'a, Endian> for SimplifyAlgorithm
type Error = Error
fn try_from_ctx( src: &'a [u8], ctx: Endian, ) -> Result<(SimplifyAlgorithm, usize), <SimplifyAlgorithm as TryFromCtx<'a, Endian>>::Error>
Source§impl TryIntoCtx<Endian> for &SimplifyAlgorithm
impl TryIntoCtx<Endian> for &SimplifyAlgorithm
type Error = Error
fn try_into_ctx( self, dst: &mut [u8], ctx: Endian, ) -> Result<usize, <&SimplifyAlgorithm as TryIntoCtx<Endian>>::Error>
Source§impl TryIntoCtx<Endian> for SimplifyAlgorithm
impl TryIntoCtx<Endian> for SimplifyAlgorithm
type Error = Error
fn try_into_ctx( self, dst: &mut [u8], ctx: Endian, ) -> Result<usize, <SimplifyAlgorithm as TryIntoCtx<Endian>>::Error>
Auto Trait Implementations§
impl Freeze for SimplifyAlgorithm
impl RefUnwindSafe for SimplifyAlgorithm
impl Send for SimplifyAlgorithm
impl Sync for SimplifyAlgorithm
impl Unpin for SimplifyAlgorithm
impl UnsafeUnpin for SimplifyAlgorithm
impl UnwindSafe for SimplifyAlgorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.