Constructs geodesic icosahedron given subdivision frequency.
Project description
Geodesic icosahedron
Creating geodesic icosahedron given subdivision frequency.
Installation
Install the module using pip install icosphere
or clone the repository.
Use
from icosphere import icosphere
nu = 5 # or any other integer
vertices, faces = icosphere(nu)
Examples
Check the examples in icosphere github, python script uses matplotlib for visualization, and jupyter notebook uses plotly.
Why use subdivision frequency?
For a certain subdivision frequency nu
, each edge of the icosahedron will be split into nu
segments, and each face will be split into nu**2
faces.
This is different than a more common approach which recursively applies a subdivision with nu = 2
, for example as used in pytorch3d ico_sphere, pymeshlab sphere, trimesh icosphere, and PyMesh generate_icosphere.
The advantage of using the subdivision frequency, compared to the recursive subdivision, is in controlling the mesh resolution. Mesh resolution grows quadratically with subdivision frequencies while it grows exponentially with iterations of the recursive subdivision. To be precise, using the recursive subdivision, the number of vertices and faces in the resulting icosphere grows with iterations iter
as nr_vertex = 12 + 10 * (4**iter -1)
and nr_face = 10 * 4**iter
which gives a sequence of mesh vertices
12, 42, 162, 642, 2562, 10242, 40962, 163842, 655362, 2621442, 10485762...
Notice for example there is no mesh having between 2562 and 10242 vertices. Using subdivision frequency, the number of vertices and faces grows with nu
as
Notice for example there is no mesh having between 2562 and 10242 vertices. Using subdivision frequency, the number of vertices and faces grows with nu
as nr_vertex = 12 + 10 * (nu**2 -1)
and nr_face = 20 * nu**2
which gives a sequence of mesh vertices
12, 42, 92, 162, 252, 362, 492, 642, 812, 1002, 1212, 1442, 1692, 1962,
2252, 2562, 2892, 3242, 3612, 4002, 4412, 4842, 5292, 5762, 6252, 6762,
7292, 7842, 8412, 9002, 9612, 10242...
Now there is 15 meshes having between 2562 and 10242 vertices. The advantage is even more pronounced when using higher resolutions.
The code was originally developed for this work.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file icosphere-0.1.3.tar.gz
.
File metadata
- Download URL: icosphere-0.1.3.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f0c8469a280cc5cdbca33cff0a251576da8cea5f88ecf2d3b7835beee671a7 |
|
MD5 | d17fb678571a92506d78f90d5857b9e8 |
|
BLAKE2b-256 | 927bad40ff61c4a31b0683a55737c7551ca534904c8fa7845ca300e7c1874622 |