Trait Sphere

Source
pub trait Sphere {
    type Face: Face<Vertex = Self::Vertex, HalfEdge = Self::HalfEdge>;
    type Vertex: Vertex<Face = Self::Face, HalfEdge = Self::HalfEdge>;
    type HalfEdge: HalfEdge<Face = Self::Face, Vertex = Self::Vertex>;

    // Required methods
    fn num_faces(&self) -> usize;
    fn face(&self, index: usize) -> Self::Face;
    fn faces(&self) -> impl Iterator<Item = Self::Face>;
    fn face_at(&self, point: [f64; 3]) -> Self::Face;
    fn num_vertices(&self) -> usize;
    fn vertex(&self, index: usize) -> Self::Vertex;
    fn vertices(&self) -> impl Iterator<Item = Self::Vertex>;
}
Expand description

Partitions the surface of the unit sphere into a set of spherical polygons (Faces).

There are numerous requirements for a valid Sphere implementation. Custom implementations may use util::validate to check that these requirements are met.

Required Associated Types§

Source

type Face: Face<Vertex = Self::Vertex, HalfEdge = Self::HalfEdge>

The type of Face on this sphere.

Source

type Vertex: Vertex<Face = Self::Face, HalfEdge = Self::HalfEdge>

The type of Vertex on this sphere.

Source

type HalfEdge: HalfEdge<Face = Self::Face, Vertex = Self::Vertex>

The type of HalfEdge on this sphere.

Required Methods§

Source

fn num_faces(&self) -> usize

The number of faces on this sphere.

Source

fn face(&self, index: usize) -> Self::Face

Gets the Face with the given index.

Source

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

Iterates over the faces of this sphere.

Source

fn face_at(&self, point: [f64; 3]) -> Self::Face

Determines which face contains the given point on the unit sphere.

If the point is between faces (i.e. on a vertex or edge), one of the faces that contains it inclusively will be returned.

Source

fn num_vertices(&self) -> usize

The number of vertices on this sphere.

Source

fn vertex(&self, index: usize) -> Self::Vertex

Gets the Vertex with the given index.

Source

fn vertices(&self) -> impl Iterator<Item = Self::Vertex>

Iterates over the vertices of this sphere.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§