Skip to main content

SimplifyAlgorithm

Enum SimplifyAlgorithm 

Source
#[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

Source

pub const fn name(self) -> &'static str

The canonical CLI name (none|rdp|vw|ii), a spelling from_name() accepts.

Source

pub fn from_name(name: &str) -> Option<SimplifyAlgorithm>

The algorithm a name selects: the canonical names plus the long visvalingam and imai-iri aliases.

Source

pub const fn from_byte(byte: u8) -> Option<SimplifyAlgorithm>

The algorithm a header byte names, if any.

Trait Implementations§

Source§

impl Clone for SimplifyAlgorithm

Source§

fn clone(&self) -> SimplifyAlgorithm

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SimplifyAlgorithm

Source§

impl Debug for SimplifyAlgorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for SimplifyAlgorithm

Source§

fn default() -> SimplifyAlgorithm

Returns the “default value” for a type. Read more
Source§

impl Eq for SimplifyAlgorithm

Source§

impl PartialEq for SimplifyAlgorithm

Source§

fn eq(&self, other: &SimplifyAlgorithm) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SimplifyAlgorithm

Source§

impl<'a> TryFromCtx<'a, Endian> for SimplifyAlgorithm

Source§

type Error = Error

Source§

fn try_from_ctx( src: &'a [u8], ctx: Endian, ) -> Result<(SimplifyAlgorithm, usize), <SimplifyAlgorithm as TryFromCtx<'a, Endian>>::Error>

Source§

impl TryIntoCtx<Endian> for &SimplifyAlgorithm

Source§

type Error = Error

Source§

fn try_into_ctx( self, dst: &mut [u8], ctx: Endian, ) -> Result<usize, <&SimplifyAlgorithm as TryIntoCtx<Endian>>::Error>

Source§

impl TryIntoCtx<Endian> for SimplifyAlgorithm

Source§

type Error = Error

Source§

fn try_into_ctx( self, dst: &mut [u8], ctx: Endian, ) -> Result<usize, <SimplifyAlgorithm as TryIntoCtx<Endian>>::Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.