# spherical triangles

4 replies to this topic

### #1kruseborn

Member

• Members
• 33 posts

Posted 19 March 2009 - 09:31 AM

I have a unit sphere partition in to spherical triangles. For every triangle have a three positions, (xyz), (xyz) and (xyz). Now i want to step throw all the points on the triangles and then convert them to texture coordinates on a cube map.

Converting worlds positions to cube maps position i got working but stepping throw all positions on a spherical triangle i have hard time doing for a given resolution.

Now I am using some random samples for every triangle.

point = weight1*(point1)+weight2*(point2)+weight3*(point3).

normalize(point).

color += image(uv(point));

color /= samples;



### #2geon

Senior Member

• Members
• 939 posts

Posted 20 March 2009 - 09:31 PM

Hello, fellow Swede!

Is your problem how to tesselate the sphere? The easiest is to use polar coordinates, but a geodesic one will look better.

http://www.gamedev.n...topic_id=283350

### #3kruseborn

Member

• Members
• 33 posts

Posted 23 March 2009 - 08:13 AM

geon said:

Hello, fellow Swede!

Is your problem how to tesselate the sphere? The easiest is to use polar coordinates, but a geodesic one will look better.

http://www.gamedev.n...topic_id=283350

I have some spherical triangles on a sphere and wants the coordinates of all points inside the spherical triangle. Not a normal triangle a spherical one.

I tested this and I think its works

for(int i = 0; i < samples; i++)

{

for(int j = 0; j< samples; j++)

{

for(int k = 0; k < samples; k++)

{

D3DXVECTOR3 p = offset*i*Vvec[0] + offset*j*Vvec[1] + offset*k*Vvec[2];

D3DXVec3Normalize(&p, &p);



### #4geon

Senior Member

• Members
• 939 posts

Posted 23 March 2009 - 01:01 PM

You might be interested in this:

Stratified Sampling of Spherical Triangles

### #5kruseborn

Member

• Members
• 33 posts

Posted 23 March 2009 - 05:07 PM

geon said:

You might be interested in this:

Stratified Sampling of Spherical Triangles

This was very nice,:) thanks

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users