MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayCreate 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*).

1 correct solutions
3 incorrect solutions

Last solution submitted on Oct 15, 2013