Crate hexasphere[−][src]
Library for subdividing shapes made of triangles.
This library defines Subdivided<T, S>. This struct
allows one to define a base shape using S and the
BaseShape trait, and to subdivide it using the
interpolation functions defined as part of S.
This includes a few base shapes:
- Icosahedron
- Tetrahedron
- Square
- Triangle
- Cube
Example usage
use hexasphere::shapes::IcoSphere; fn main() { // Create a new sphere with 20 subdivisions // an no data associated with the vertices. let sphere = IcoSphere::new(20, |_| ()); let points = sphere.raw_points(); for p in points { println!("{:?} is a point on the sphere!", p); } let indices = sphere.get_all_indices(); for triangle in indices.chunks(3) { println!( "[{}, {}, {}] is a triangle on the resulting shape", triangle[0], triangle[1], triangle[2], ); } }
Features
adjacencyallows the user to create neighbour maps from the indices provided by theSubdividedstruct.
Modules
| interpolation | |
| shapes |
Structs
| Subdivided | A progressively subdivided shape which can record the indices of the points and list out the individual triangles of the resulting shape. |
| Triangle | A main triangle on the base shape of a subdivided shape. |
Traits
| BaseShape | Defines the setup for a base shape, and the functions used in interpolation. |
| EquilateralBaseShape | Implemented in the case where the triangles on the shape are both equilateral and identifiable from their normal. |