Create a triangulation of a spherical surface with approximately-uniform coverage
Description:
A rather crude way to obtain a triangulation of the spherical surface would be:
[x,y,z] = sphere(64); fvc = surf2patch(x,y,z,'triangles');
The function sphere creates a uniform grid in spherical coordinates, so the resulting triangulation produces very small triangles/faces at the poles and considerably larger triangles/faces at the equator (see the sphere at the right in the examples above).
In general (with a few exceptions) it is not possible to construct a tessellation of the spherical surface made of triangles of exactly the same size. But we can try...
Your function should return a tessellation of the unit-sphere surface formed by triangles with side lengths as similar as possible (as close to identical equilateral triangles as possible). An example of a somewhat reasonable solution would be the sphere at the left in the examples above.
Details:
Given a number N your function should return an approximately uniform triangulation of the spherical surface with at least N vertices.
Uniformity is measured as the ratio between the longest and the shortest edge across your entire triangulation (lower numbers are better). This ratio should be lower or equal to 2 in order to pass this problem (in other words, the longest edge should be at most twice the size of the shortest edge). Your solution will receive a score 1000*(ratio-1). A score of 0 would correspond to identical equilateral triangles.
The function output should be a valid PATCH format: a structure with fields vertices (with size Nx3; each row of vertices defining the 3d coordinates of each vertex) and faces (with size Mx3; each row of faces defining the three vertices in each face/triangle as indices into the rows of the matrix vertices).
The tip here is averages. Catmull & Clark used them to smooth polyhedra for instance.
Find all elements less than 0 or greater than 10 and replace them with NaN
13154 Solvers
1612 Solvers
239 Solvers
Project Euler: Problem 1, Multiples of 3 and 5
1529 Solvers
Do the line-segments intersect?
57 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!