Skip to main content

PolyhedralSurface

Trait PolyhedralSurface 

Source
pub trait PolyhedralSurface: Geometry<Kind = PolyhedralSurfaceTag> {
    type Face: Polygon<Point = Self::Point>;

    // Required method
    fn faces(&self) -> impl ExactSizeIterator<Item = &Self::Face>;
}
Expand description

A polyhedral surface — a contiguous collection of polygons in 3-dimensional space that share common boundary segments.

Mirrors the PolyhedralSurface concept (doc/concept/polyhedral_surface.qbk); the canonical model is boost::geometry::model::polyhedral_surface in boost/geometry/geometries/polyhedral_surface.hpp.

The OGC spec requires the faces to be 3D Cartesian and to share boundary segments. As with the C++ model — whose constructors do not check the shared-boundary invariant and defer to is_valid() — neither invariant is enforced at the trait level. Both are checked by check_polyhedral_surface::<T>() in T15.

§Examples

use geometry_trait::PolyhedralSurface;
fn face_count<P: PolyhedralSurface>(p: &P) -> usize { p.faces().len() }

Required Associated Types§

Source

type Face: Polygon<Point = Self::Point>

The face polygon type.

Mirrors the Polygon template parameter on boost::geometry::model::polyhedral_surface<Polygon, …> (boost/geometry/geometries/polyhedral_surface.hpp).

Required Methods§

Source

fn faces(&self) -> impl ExactSizeIterator<Item = &Self::Face>

The faces of this polyhedral surface, in declared order.

Plays the role of boost::begin(ps) / boost::end(ps) from boost/geometry/geometries/polyhedral_surface.hpp when read together. The returned iterator is ExactSizeIterator so callers can ask for the face count without consuming it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§