noobprogrammer
noobprogrammer

Reputation: 125

How to map a sphere to a tetrahedron?

If I have an approximation of a sphere, how do I map the vertices of the sphere to form a (rectangular) tetrahedron?

My current approach maps all vertices of the sphere to just one of the four vertices of a tetrahedron. However I want them to be evenly spaced, if that is possible.

I would be thankful for any approach or solution.

Upvotes: 0

Views: 564

Answers (1)

Salix alba
Salix alba

Reputation: 7824

One way to think about it is to imagine a sphere inside a tetrahedron and imagine projecting a ray from the center of the sphere until it cuts the tetrahedron.

Getting the equations of the points in a tetrahedron is a bit tricky. Perhaps easiest imagining it embedded in a cube of side length 2, with vertices at (1,1,1), (-1,-1,1), (1,-1,-1), (-1,1,-1). The equations of the faces are x + y + z = 1, x - y - z = 1, - x + y - z = 1, - x - y + z = 1.

So for a given point on the unit sphere x = sin(theta) cos(phi), y = sin(theta) sin(phi), z = cos(theta). We just need to find the point (r x, r y, r z) which satisfies one of the four equations. Say for example we might have r x + r y + r z = 1. If we know x, y, z its easy enough to solve for r: r = 1/(x+y+z).

Its a bit tricky working out which face to project to, an easy way around this is just calculate r1 = 1/(x+y+z), r2=1/(x-y-z), r3=1/(-x+y-z), r4=1/(-x-y+z). Discard any negative values and take the smallest of the remainder.

Here is a projection of a sphere using this technique.

enter image description here

Upvotes: 1

Related Questions