25 stable releases (12 major)

12.0.0 Mar 24, 2024
11.0.0 Mar 23, 2024
10.0.0 Jan 8, 2024
9.1.0 Jun 19, 2023
0.1.7 Aug 25, 2020

#30 in Math

Download history 13535/week @ 2024-01-02 16879/week @ 2024-01-09 18159/week @ 2024-01-16 16537/week @ 2024-01-23 14350/week @ 2024-01-30 16967/week @ 2024-02-06 20521/week @ 2024-02-13 22869/week @ 2024-02-20 22326/week @ 2024-02-27 22118/week @ 2024-03-05 17941/week @ 2024-03-12 21677/week @ 2024-03-19 20166/week @ 2024-03-26 22710/week @ 2024-04-02 18505/week @ 2024-04-09 18009/week @ 2024-04-16

82,740 downloads per month
Used in 692 crates (3 directly)

MIT/Apache

100KB
2K SLoC

hexasphere

Library for subdividing shapes, such as an icosahedron. This provides abstractions for almost anything to be possible, however there are many predetermined shapes.

In the case of the icosphere:

Geometry:

This starts off with an icoashedron, and then proceeds to subdivide it. The subdivided points form the dual to a goldberg polyhedron. In essence, each point on this sphere is either a hexagon or a pentagon.

Interpolation:

Points are interpolated using the geometric slerp function to preserve their accuracy.


Features

  • Base shapes
    • Icosahedron
    • Tetrahedron
    • Triangle
    • Square
    • Cube
  • Interpolation functions
    • Spherical interpolation
    • Linear interpolation
    • Normalized linear interpolation
  • Basic optimizations for p == 0.5 in interpolation.
  • An adjacency (neighbour) map which can be generated from the indices that this library creates.

A few more optimizations are coming, along with more options for generation:

  • Remove nested triangle layers by placing them into their own Vec.
  • Allow interpolation functions to have access to state. (This would permit certain things such as sampling noise as part of the generation).

License

Hexasphere is distributed under the terms of either the MIT license, or the Apache License (Version 2.0) at the user's choice.

See the files named LICENSE-MIT and LICENSE-APACHE2 relative to the root directory of this project for more details.

Dependencies

~3MB
~93K SLoC