[][src]Struct hexasphere::Hexasphere

pub struct Hexasphere<T> { /* fields omitted */ }

Hexagonally tiled sphere. Created with the new method.

Points are represented as the triangular subdivisions of the faces of an icosahedron, the dual of which creates a hexagonally tiled sphere with 12 pentagons. The number of subdivisions is exactly equal to the number of hexagons between adjacent pentagons.

Points are stored in normalized space, on the surface of a unit sphere. The initial points are spherically interpolated to preserve accuracy, and not distort due to projections such as linear interpolation and then normalization.

Implementations

impl<T> Hexasphere<T>[src]

pub fn new(subdivisions: usize, generator: impl FnMut(Vec3A) -> T) -> Self[src]

Creates a hexagonally tiled sphere.

The number of hexagons between pentagons is subdivisions, and generator permits you to create a unique value for every point on the sphere.

pub fn raw_points(&self) -> &[Vec3A][src]

pub fn get_indices(&self, triangle: usize, buffer: &mut Vec<u32>)[src]

Appends the indices for the triangle into buffer.

pub fn subdivisions(&self) -> usize[src]

pub fn raw_data(&self) -> &[T][src]

pub fn indices_per_main_triangle(&self) -> usize[src]

Calculate the number of indices which each main triangle will add to the vertex buffer.

Equation

(subdivisions + 1)²

pub fn vertices_per_main_triangle_shared(&self) -> usize[src]

Calculate the number of vertices contained within each main triangle including the vertices which are shared with another main triangle.

Equation

(subdivisions + 1) * (subdivisions + 2) / 2

pub fn vertices_per_main_triangle_unique(&self) -> usize[src]

Calculate the number of vertices contained within each main triangle excluding the ones that are shared with other main triangles.

Equation

{
{ subdivisions < 2  : 0
{
{ subdivisions >= 2 : (subdivisions - 1) * subdivisions / 2
{

pub fn shared_vertices(&self) -> usize[src]

Calculate the number of vertices along the edges of the main triangles and the vertices of the main triangles.

Equation

subdivisions * 30 + 12

Auto Trait Implementations

impl<T> RefUnwindSafe for Hexasphere<T> where
    T: RefUnwindSafe

impl<T> Send for Hexasphere<T> where
    T: Send

impl<T> Sync for Hexasphere<T> where
    T: Sync

impl<T> Unpin for Hexasphere<T> where
    T: Unpin

impl<T> UnwindSafe for Hexasphere<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.