Struct hexasphere::Subdivided[][src]

pub struct Subdivided<T, S: BaseShape> { /* fields omitted */ }
Expand description

A progressively subdivided shape which can record the indices of the points and list out the individual triangles of the resulting shape.

All base triangles specified by S in BaseShape are expected to be in counter clockwise winding.

Points are preferably stored with coordinates less than or equal to 1.0. This is why all default shapes lie on the unit sphere.

Implementations

Calculate distance from the center of a shape (pentagon or hexagon) to one of the vertices of the shape.

In other words, the radius of the circumscribed circle.

Creates the base shape from S and subdivides it.

  • subdivisions specifies the number of times a subdivision will be created. In other terms, this is the number of auxiliary points between the vertices on the original shape.

  • generator is a function run once all the subdivisions are applied and its values are stored in an internal Vec.

The raw points created by the subdivision process.

Appends the indices for the triangle into buffer.

The specified triangle is a main triangle on the base shape. The range of this should be limited to the number of triangles in the base shape.

Alternatively, use get_all_indices to get all the indices.

Gets the indices for all main triangles in the shape.

Returns the number of subdivisions applied when this shape was created.

Returns the custom data created by the generator function.

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

Equation
(subdivisions + 1)²

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

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
{

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

Equation
subdivisions * EDGES + INITIAL_POINTS

Linear distance between two points on this shape.

Closest “main” triangle.

Undefined results if the point is one of the vertices on the original base shape.

Distance between two points on this sphere (assuming this is a sphere).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.