class EllipsoidVertexGenerator {

    public List<List<Position>> generateVertices(int detailLevel, double axisAInMeters, double axisBInMeters,
            double axisCInMeters)
    {
        List<List<Position>> vertices = New.list();
        double pi = Math.PI;
        double tStep = pi / detailLevel;
        double sStep = tStep;

        double axisBRadius = axisBInMeters / 2;
        double axisARadius = axisAInMeters / 2;
        double axisCRadius = axisCInMeters / 2;
        boolean hasDrawnPole = false;
        for (double t = -pi / 2; t <= pi / 2 && !hasDrawnPole; t += tStep)
        {
            List<Position> triangleStrip = New.list();
            for (double s = -pi; s <= pi + ourTolerance; s += sStep)
            {
                double x = axisBRadius * Math.cos(t) * Math.cos(s);
                double y = axisARadius * Math.cos(t) * Math.sin(s);
                double z = axisCRadius * Math.sin(t);

                if (z >= axisCRadius)
                {
                    hasDrawnPole = true;
                }

                triangleStrip.add(new ModelPosition(x, y, z));

                x = axisBRadius * Math.cos(t + tStep) * Math.cos(s);
                y = axisARadius * Math.cos(t + tStep) * Math.sin(s);
                z = axisCRadius * Math.sin(t + tStep);

                triangleStrip.add(new ModelPosition(x, y, z));

                if (z >= axisCRadius)
                {
                    hasDrawnPole = true;
                }
            }

            vertices.add(triangleStrip);
        }

        return vertices;
    }

}