Struct geom::Tessellation
source · [−]Expand description
A tessellated polygon, ready for rendering.
Fields
points: Vec<Pt2D>
These points aren’t in any meaningful order. It’s not generally possible to reconstruct a
Polygon
from this.
indices: Vec<u16>
Groups of three indices make up the triangles
Implementations
sourceimpl Tessellation
impl Tessellation
pub fn new(points: Vec<Pt2D>, indices: Vec<usize>) -> Self
sourcepub fn from_ring(points: Vec<Pt2D>) -> Self
pub fn from_ring(points: Vec<Pt2D>) -> Self
The points
are not necessarily a Ring
, which has strict requirements about no duplicate
points. We can render various types of invalid polygon.
pub fn triangles(&self) -> Vec<Triangle>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn get_bounds(&self) -> Bounds
pub fn center(&self) -> Pt2D
pub(crate) fn transform<F: Fn(&Pt2D) -> Pt2D>(&mut self, f: F)
pub fn translate(&mut self, dx: f64, dy: f64)
pub fn scale(&mut self, factor: f64)
pub fn scale_xy(&mut self, x_factor: f64, y_factor: f64)
pub fn rotate(&mut self, angle: Angle)
pub fn rotate_around(&mut self, angle: Angle, pivot: Pt2D)
sourcepub fn inplace_multi_transform(
&mut self,
scale: f64,
translate_x: f64,
translate_y: f64,
rotate: Angle,
pivot: Pt2D
)
pub fn inplace_multi_transform(
&mut self,
scale: f64,
translate_x: f64,
translate_y: f64,
rotate: Angle,
pivot: Pt2D
)
Equivalent to self.scale(scale).translate(translate_x, translate_y).rotate_around(rotate, pivot)
, but modifies the polygon in-place and is faster.
pub fn union(self, other: Self) -> Self
pub fn union_all(list: Vec<Self>) -> Self
sourcepub fn to_geojson(&self, gps: Option<&GPSBounds>) -> Geometry
pub fn to_geojson(&self, gps: Option<&GPSBounds>) -> Geometry
Produces a GeoJSON multipolygon consisting of individual triangles. Optionally map the world-space points back to GPS.
fn to_geo(&self) -> Polygon
pub fn difference(&self, other: &Tessellation) -> Result<Vec<Polygon>>
Trait Implementations
sourceimpl Clone for Tessellation
impl Clone for Tessellation
sourcefn clone(&self) -> Tessellation
fn clone(&self) -> Tessellation
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Tessellation
impl Debug for Tessellation
sourceimpl<'de> Deserialize<'de> for Tessellation
impl<'de> Deserialize<'de> for Tessellation
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Polygon<f64>> for Tessellation
impl From<Polygon<f64>> for Tessellation
sourceimpl From<Polygon> for Tessellation
impl From<Polygon> for Tessellation
sourceimpl PartialEq<Tessellation> for Tessellation
impl PartialEq<Tessellation> for Tessellation
sourcefn eq(&self, other: &Tessellation) -> bool
fn eq(&self, other: &Tessellation) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Tessellation) -> bool
fn ne(&self, other: &Tessellation) -> bool
This method tests for !=
.
sourceimpl Serialize for Tessellation
impl Serialize for Tessellation
impl StructuralPartialEq for Tessellation
Auto Trait Implementations
impl RefUnwindSafe for Tessellation
impl Send for Tessellation
impl Sync for Tessellation
impl Unpin for Tessellation
impl UnwindSafe for Tessellation
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more