Trait Face

Source
pub trait Face: Clone + Eq {
    type Vertex: Vertex<Face = Self, HalfEdge = Self::HalfEdge>;
    type HalfEdge: HalfEdge<Face = Self, Vertex = Self::Vertex>;

    // Required methods
    fn index(&self) -> usize;
    fn area(&self) -> f64;
    fn num_sides(&self) -> usize;
    fn side(&self, index: usize) -> Self::HalfEdge;

    // Provided methods
    fn vertex(&self, index: usize) -> Self::Vertex { ... }
    fn vertices(&self) -> impl Iterator<Item = Self::Vertex> { ... }
    fn sides(&self) -> impl Iterator<Item = Self::HalfEdge> { ... }
}
Expand description

Represents a “face” on a Sphere of a certain type.

These are spherical polygons bounded by HalfEdges.

Required Associated Types§

Source

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

The type of Vertex on the sphere.

Source

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

The type of HalfEdge on the sphere.

Required Methods§

Source

fn index(&self) -> usize

The index of this vertex within the Sphere::faces list.

Source

fn area(&self) -> f64

The area of this face.

This is also known as the solid angle subtended by the face. The sum of the areas of all faces on a sphere is 4 π.

For faces whose edges are all geodesics, this is equivalent to the util::poly_area of the vertices of the face.

Source

fn num_sides(&self) -> usize

The number of sides (vertices or edges) that this face has.

Source

fn side(&self, index: usize) -> Self::HalfEdge

Gets the HalfEdge which has the given index and this face as its inside.

Provided Methods§

Source

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

Gets a Vertex of this face given its index within Face::vertices.

This should be equivalent to side(index).start().

Source

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

Iterates over the Vertexs of this face in counter-clockwise order.

Vertices will be returned in an order consistent with sides and start. This will iterate over num_sides vertices.

Source

fn sides(&self) -> impl Iterator<Item = Self::HalfEdge>

Iterates over the HalfEdges which have this face as their inside.

Edges will be returned in counter-clockwise order around the face, consistent with HalfEdge::side_index. The iterator will return num_sides edges.

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§

Source§

impl Face for subsphere::basetri::Face

Source§

impl<Proj: Eq + Clone + BaseTriProjector> Face for subsphere::hex::Face<Proj>

Source§

impl<Proj: Eq + Clone + BaseTriProjector> Face for subsphere::tri::Face<Proj>