开发者

Find the projection of a vector on the icosahedron or on its unfolded surface

开发者 https://www.devze.com 2023-02-07 07:19 出处:网络
Consider a sphere with center in coordinates\' origin, and an inscribed icosahedron, oriented such that the two most distant vertices lay on Z coordinate axis, and one of the edges emerging from any o

Consider a sphere with center in coordinates' origin, and an inscribed icosahedron, oriented such that the two most distant vertices lay on Z coordinate axis, and one of the edges emerging from any of that vertices lays in XZ plane.

Consider a given vector x originating in the center of the sphere. Direction, given by this vector, pierce the surface of the icosahedron in a certain point.

Is there an elegant way to find the pierced facet (considering all the facets are enumerated), and then find the piercing point开发者_JS百科 on this facet? This task is needed to project the pierce point to the flat unfolded (unwrapped) icosahedron surface.


This solution is specific to your application where the vectors emanate from the origin and the icosahedron is centered at the origin.

Define 20 triangles using the 12 verticies of the icosahedron. Order the 3 so that they are in counterclockwise order when viewed from outside the icosahedron. So for each triangle you'll have a list of 3 verticies. For each triangle construct a 3x3 matrix where the columns are the verticies of the triangle:

    [ x1 x2 x3 ]
T = [ y1 y2 y3 ]
    [ z1 z2 z3 ]

You'll need the inverse of this matrix (search SO or google for a fast 3x3 inverse in the language of your choice). Now for each vector, you want to multiply it by all 20 matricies. So for each triangle compute:

B = V*T(inverse)

If all 3 elements of B are positive (negative?) this is the intersected triangle.

Next, normalize B - divide it by its length so it has unit length. This will make B the Barycentric coordinates of the intersection point on that triangle. You can also compute the actual intersection point I by multiplying the Barycentric coordinates by the original point matrix:

I = B*T

This also works for finding the 2D coordinates of the intersection point on the unfolded triangle. So use the 2x3 matrix of 2D coordinates instead of T.

One last optimization. If you sum the 3 verticies of each triangle this will give you a normal vector for that triangle. If you compute the dot product of your vector with each of the normals, the triangle with the largest dot product will be the one intersected. This fact is specific to regular polyhedrons centered at the origin with the rays in question emanating from the origin. This is faster than doing the whole matrix multiply to determine which one is hit. You'll still need to do 1 matrix multiply to find the Barycentric coordinates.

You can also search for ray-triangle intersection and read about Barycentric coordinates, but those solutions will be more generalized than this specific problem requires.


Okay, this isn't really my field, but nobody else has answered, so I'll take a stab at it. you can represent an icosahedron as 12 vertices - 10 equatorial vertices, plus top and bottom (nothing inherently equatorial about them, this is just a way of classifying it for our coordinate system).

Those vertices, in turn, can be represented as segments - one end is the origin, the other the vertex. Given that, you can derive the altitude above the equator. If you know the altitude of the vector (again, above the equator), you can determine which of the three sections of the icosahedron the vector is intersecting - the northern, southern, or equatorial set.

From your vector, you can also determine azimuth. If you have the respective derived azimuths and altitudes from the vertex vectors, it's a fairly simple calculation a set of two faces (and thus four vertices). Computing the angular separation between the given vector each vertex segment will tell you which of the two faces it is on - face with the smaller of the two sums of bearings will be that face.

That's where I'm stuck...I can't see a simple way to determine the point of intersection with the face. Hopefully this will be helpful for the first part, at least.

0

精彩评论

暂无评论...
验证码 换一张
取 消