Skip to main content

QuantizedMeshHeader

Struct QuantizedMeshHeader 

Source
pub struct QuantizedMeshHeader {
    pub center: [f64; 3],
    pub min_height: f32,
    pub max_height: f32,
    pub bounding_sphere_center: [f64; 3],
    pub bounding_sphere_radius: f64,
    pub horizon_occlusion_point: [f64; 3],
}
Expand description

Quantized mesh header (88 bytes).

All coordinates are in Earth-Centered Earth-Fixed (ECEF) frame.

Fields§

§center: [f64; 3]

Center of the tile in ECEF coordinates (meters)

§min_height: f32

Minimum height in the tile (meters)

§max_height: f32

Maximum height in the tile (meters)

§bounding_sphere_center: [f64; 3]

Bounding sphere center in ECEF coordinates (meters)

§bounding_sphere_radius: f64

Bounding sphere radius (meters)

§horizon_occlusion_point: [f64; 3]

Horizon occlusion point in ellipsoid-scaled ECEF coordinates

Implementations§

Source§

impl QuantizedMeshHeader

Source

pub fn from_bounds( bounds: &TileBounds, min_height: f32, max_height: f32, ) -> Self

Create a header from tile bounds and height range.

Computes ECEF coordinates, bounding sphere, and horizon occlusion point. Falls back to corner+edge sample points for the horizon occlusion — callers that have the actual mesh vertices should prefer from_bounds_with_vertices_iter for tighter occlusion.

Source

pub fn from_bounds_with_vertices_iter<I>( bounds: &TileBounds, min_height: f32, max_height: f32, vertices_geodetic: I, ) -> Self
where I: IntoIterator<Item = [f64; 3]>,

Like from_bounds, but uses the supplied mesh vertices (geodetic [lon, lat, height]) to compute a tighter horizon occlusion point via the Cesium EllipsoidalOccluder algorithm.

Accepts any IntoIterator<Item = [f64; 3]>, so callers can stream directly from a flat &[f32] buffer or any other source without allocating an intermediate Vec. To feed an f32 mesh, adapt with chunks_exact(3).map(|c| [c[0] as f64, c[1] as f64, c[2] as f64]).

Internal math runs in f64 regardless of input precision — ECEF coordinates at Earth scale need f64 to keep sub-metre accuracy.

Source

pub fn from_bounds_with_vertices( bounds: &TileBounds, min_height: f32, max_height: f32, vertices_geodetic: &[(f64, f64, f64)], ) -> Self

👎Deprecated since 0.2.1:

Use from_bounds_with_vertices_iter to avoid allocating an intermediate Vec<(f64, f64, f64)>

Slice-based wrapper around from_bounds_with_vertices_iter.

Retained for backward compatibility; prefer the iterator form when your vertex data is in a layout (Vec<f32>, GPU buffer, …) that would otherwise require allocating an intermediate Vec<(f64, f64, f64)>.

Source

pub fn to_bytes(&self) -> [u8; 88]

Serialize header to bytes (88 bytes, little-endian).

Source

pub fn from_bytes(bytes: &[u8]) -> Option<Self>

Deserialize header from bytes.

Trait Implementations§

Source§

impl Clone for QuantizedMeshHeader

Source§

fn clone(&self) -> QuantizedMeshHeader

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 Debug for QuantizedMeshHeader

Source§

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

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

impl Default for QuantizedMeshHeader

Source§

fn default() -> Self

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

impl Copy for QuantizedMeshHeader

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> 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.