<p>If you sample the two parameters $\eta$ and $\omega$ with steps $d\eta$ and $d\omega$, then you'll get a grid of points $v_{ij} = f(i\;d\eta,j\;d\omega)$.  Any four adjacent points will define a quadrilateral.  To get triangles, you just have to split each quad in two by a diagonal.</p>

<p><a href="https://i.sstatic.net/Fm0tG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Fm0tG.png" alt="enter image description here"></a></p>

<p>So in the example, you'd split the quadrilateral $\{v_{00},v_{01},v_{11},v_{10}\}$ into two triangles $\{v_{00},v_{01},v_{10}\}$ and $\{v_{01},v_{11},v_{10}\}$.  You'll want to make sure the points come in the right order so the triangle orientations match (or you'll end up backface-culling half of your triangles.)</p>

<p>Your second equation, for $n_{xyz}$, is finding the <em>normal</em> of each vertex, which you can use for shading.</p>

CC BY-SA 3.0
2018-03-20T16:21:36.823Z
I implemented it but I'm not sure that is correct. However thanks!
Nick
CC BY-SA 3.0
2018-03-20T20:52:01.010Z
Ok, the code now seems work. Practically I implemented a sort of skinning algorithm following the suggest.
Nick
CC BY-SA 3.0
2018-03-20T12:08:21.617Z
2018-03-21T09:00:21.007Z
2018-03-21T09:00:21.007Z
gilgamec
<p>I have the parametric model of an ellipsoid like this:</p>

<p>\begin{cases}
x=a_1\,cos \,\eta \:cos\,\omega  &amp; -\pi\leq\omega\leq\pi \\ = _2\,cos\,\eta\:sin\,\omega \\ z=a_3\,sin \,\eta &amp; -\frac{\pi}{2}\leq\eta\leq\frac{\pi}{2}
\end{cases}</p>

<p>and</p>

<p>\begin{cases}
n_x=\frac{1}{a_1}\,cos \,\eta \:cos\,\omega  &amp; -\pi\leq\omega\leq\pi \\n_ = \frac{1}{a_2}\,cos\,\eta\:sin\,\omega \\ n_z=\frac{1}{a_3}\,sin \,\eta &amp; -\frac{\pi}{2}\leq\eta\leq\frac{\pi}{2}
\end{cases}</p>

<p>First of all I do not understand the last system of equation what it represents.
 Shouldn't  parameterisation of an ellipsoid be the first system alone?</p>

<p>I have to create a polygon mesh (in webgl) from parametric model of ellipsoid. I can choose dimensions of semiaxes (namely values of $a_1$ $a_2$ and  $a_3$) and the sampling step of 2 angles (the parameters).  In this way I'm able to create in javascript with a little of code several vertices of ellipsoid. But I can't imagine how to realise the triangulation. Namely given the vertex buffer, I have to create the index buffer but in what way do I choose the indexes of the vertices to tessellate in a correct way ellipsoid surface? Is there a clever/smart way to proceed? </p>

<p>EDIT:</p>

<p>I implemented  that myself, in javascript (the code works):</p>

<pre><code> function degToRad(degrees)
     {
        return degrees * Math.PI / 180.0;
     }

     function calculateVNI()
     {
     var indices = [];
     var vertices = [];
     var normals=[]
     var a1 =10;
     var a2 =5;
     var a3 =7;
     //var pi = Math.PI;

     var step_eta   = 4; //step in degree (choose a divisor of 360)
         var step_omega = 2; //step in degree (choose a divisor of 180)


     var eta,omega;
     var eta_rad,omega_rad;
     var index=0;
     var x=0;
     var y=1;
     var z=2;

     for(eta = -90 ; eta &lt;= 90 ; eta+=step_eta) //I could do the cycle in rad but I can have problems in condition of termination of the cycle (float value)
         {
            eta_rad = degToRad(eta);

            for(omega = -180 ; omega &lt;= 180 ; omega +=step_omega , index+=3)
            {
               omega_rad = degToRad(omega) 
               vertices[index+x]= a1 * Math.cos(eta_rad) * Math.cos(omega_rad);
               vertices[index+y]= a2 * Math.cos(eta_rad) * Math.sin(omega_rad);
               vertices[index+z]= a3 * Math.sin(eta_rad);

                   normals[index+x]= vertices[index+x] /(Math.pow(a1,2.0)) ;
               normals[index+y]= vertices[index+y] /(Math.pow(a2,2.0));
               normals[index+z]= vertices[index+z] /(Math.pow(a3,2.0));
            }
         }

             //Now triangolation. I believe that it needs a counterclockwise specification of vertices (else I have back-face)
     //each triangle is specified with 3 indices (gl.TRIANGLES).

             var num_samples_omega = 360/step_omega ;   //Actually there is another sample that coincides with the first sample.
     var num_samples_eta   = 180/step_eta ;

             var i,j;
     for(i=0,index=0 ; i&lt;num_samples_eta ; i++) //il primo e l'ultimo campionamento coincidono con un solo punto ma va bene uguale
     {
         for(j=0 ; j&lt;num_samples_omega ; j++,index+=6)
         {
            //Si definiscono ad ogni ciclo gli indici dei 2 triangoli del poligono formato da 4 campioni (due per ciascuna sezione di ellisse adiacente)
             indices[index]=i*num_samples_omega +i+j; //I could use index++ but like this is more clear.
                             indices[index+1]=(i+1)*num_samples_omega +2+i+j;
             indices[index+2]=(i+1)*num_samples_omega +1+i+j;

             indices[index+3]=i*num_samples_omega +i+j;
             indices[index+4]=i*num_samples_omega +1 +i+j;
             indices[index+5]=(i+1)*num_samples_omega +2 +i+ j;
         }
     }

  //alert("num vertici"+vertices.length+"\n"+"indice massimo:"+ indices[index-1])


 }
</code></pre>

<computational-geometry><geometry><mesh><webgl><triangulation>
Triangulation of vertices of an ellipsoid
Nick
# Triangulation of vertices of an ellipsoid

(Asked by: username_0 on 2018-03-20)

I have the parametric model of an ellipsoid like this:

\begin{cases}
x=a\_1\,cos \,\eta \:cos\,\omega & -\pi\leq\omega\leq\pi \\ = \_2\,cos\,\eta\:sin\,\omega \\ z=a\_3\,sin \,\eta & -\frac{\pi}{2}\leq\eta\leq\frac{\pi}{2}
\end{cases}

and

\begin{cases}
n\_x=\frac{1}{a\_1}\,cos \,\eta \:cos\,\omega & -\pi\leq\omega\leq\pi \\n\_ = \frac{1}{a\_2}\,cos\,\eta\:sin\,\omega \\ n\_z=\frac{1}{a\_3}\,sin \,\eta & -\frac{\pi}{2}\leq\eta\leq\frac{\pi}{2}
\end{cases}

First of all I do not understand the last system of equation what it represents.
Shouldn't parameterisation of an ellipsoid be the first system alone?

I have to create a polygon mesh (in webgl) from parametric model of ellipsoid. I can choose dimensions of semiaxes (namely values of $a\_1$ $a\_2$ and $a\_3$) and the sampling step of 2 angles (the parameters). In this way I'm able to create in javascript with a little of code several vertices of ellipsoid. But I can't imagine how to realise the triangulation. Namely given the vertex buffer, I have to create the index buffer but in what way do I choose the indexes of the vertices to tessellate in a correct way ellipsoid surface? Is there a clever/smart way to proceed?

EDIT:

I implemented that myself, in javascript (the code works):

```
 function degToRad(degrees)
     {
        return degrees * Math.PI / 180.0;
     }

     function calculateVNI()
     {
     var indices = [];
     var vertices = [];
     var normals=[]
     var a1 =10;
     var a2 =5;
     var a3 =7;
     //var pi = Math.PI;

     var step_eta   = 4; //step in degree (choose a divisor of 360)
         var step_omega = 2; //step in degree (choose a divisor of 180)

     var eta,omega;
     var eta_rad,omega_rad;
     var index=0;
     var x=0;
     var y=1;
     var z=2;

     for(eta = -90 ; eta <= 90 ; eta+=step_eta) //I could do the cycle in rad but I can have problems in condition of termination of the cycle (float value)
         {
            eta_rad = degToRad(eta);

            for(omega = -180 ; omega <= 180 ; omega +=step_omega , index+=3)
            {
               omega_rad = degToRad(omega) 
               vertices[index+x]= a1 * Math.cos(eta_rad) * Math.cos(omega_rad);
               vertices[index+y]= a2 * Math.cos(eta_rad) * Math.sin(omega_rad);
               vertices[index+z]= a3 * Math.sin(eta_rad);

                   normals[index+x]= vertices[index+x] /(Math.pow(a1,2.0)) ;
               normals[index+y]= vertices[index+y] /(Math.pow(a2,2.0));
               normals[index+z]= vertices[index+z] /(Math.pow(a3,2.0));
            }
         }

             //Now triangolation. I believe that it needs a counterclockwise specification of vertices (else I have back-face)
     //each triangle is specified with 3 indices (gl.TRIANGLES).

             var num_samples_omega = 360/step_omega ;   //Actually there is another sample that coincides with the first sample.
     var num_samples_eta   = 180/step_eta ;

             var i,j;
     for(i=0,index=0 ; i<num_samples_eta ; i++) //il primo e l'ultimo campionamento coincidono con un solo punto ma va bene uguale
     {
         for(j=0 ; j<num_samples_omega ; j++,index+=6)
         {
            //Si definiscono ad ogni ciclo gli indici dei 2 triangoli del poligono formato da 4 campioni (due per ciascuna sezione di ellisse adiacente)
             indices[index]=i*num_samples_omega +i+j; //I could use index++ but like this is more clear.
                             indices[index+1]=(i+1)*num_samples_omega +2+i+j;
             indices[index+2]=(i+1)*num_samples_omega +1+i+j;

             indices[index+3]=i*num_samples_omega +i+j;
             indices[index+4]=i*num_samples_omega +1 +i+j;
             indices[index+5]=(i+1)*num_samples_omega +2 +i+ j;
         }
     }

  //alert("num vertici"+vertices.length+"\n"+"indice massimo:"+ indices[index-1])

 }

```

**Tags:** computational-geometry, geometry, mesh, webgl, triangulation


---

## 1 answers

### Answer by username_1 on 2018-03-20. Score: 4 | Accepted answer

If you sample the two parameters $\eta$ and $\omega$ with steps $d\eta$ and $d\omega$, then you'll get a grid of points $v\_{ij} = f(i\;d\eta,j\;d\omega)$. Any four adjacent points will define a quadrilateral. To get triangles, you just have to split each quad in two by a diagonal.

[![enter image description here](https://i.sstatic.net/Fm0tG.png)](https://i.sstatic.net/Fm0tG.png)

So in the example, you'd split the quadrilateral $\{v\_{00},v\_{01},v\_{11},v\_{10}\}$ into two triangles $\{v\_{00},v\_{01},v\_{10}\}$ and $\{v\_{01},v\_{11},v\_{10}\}$. You'll want to make sure the points come in the right order so the triangle orientations match (or you'll end up backface-culling half of your triangles.)

Your second equation, for $n\_{xyz}$, is finding the *normal* of each vertex, which you can use for shading.

> **Comments:**
> **username_0**: I implemented it but I'm not sure that is correct. However thanks!  
> **username_0**: Ok, the code now seems work. Practically I implemented a sort of skinning algorithm following the suggest.  

---

