private void makeSectionOutlineIndices(
      int subdivisions,
      int vertexPos,
      int indexPos,
      int[] indices,
      boolean beginEdgeFlag,
      boolean endEdgeFlag) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int count = gb.getSubdivisionPointsVertexCount(subdivisions);

    int index = indexPos;
    int pos, nextPos;

    if (beginEdgeFlag) {
      pos = vertexPos;
      indices[index++] = pos;
      indices[index++] = pos + 1;
    }

    for (int i = 0; i < count - 1; i++) {
      pos = vertexPos + 2 * i;
      nextPos = vertexPos + 2 * (i + 1);
      indices[index++] = pos;
      indices[index++] = nextPos;
      indices[index++] = pos + 1;
      indices[index++] = nextPos + 1;
    }

    if (endEdgeFlag) {
      pos = vertexPos + 2 * (count - 1);
      indices[index++] = pos;
      indices[index] = pos + 1;
    }
  }
  private int getSectionOutlineIndexCount(
      int subdivisions, boolean beginEdgeFlag, boolean endEdgeFlag) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int count = 4 * (gb.getSubdivisionPointsVertexCount(subdivisions) - 1);
    if (beginEdgeFlag) count += 2;
    if (endEdgeFlag) count += 2;

    return count;
  }
  private void makeSectionVertices(
      DrawContext dc,
      int locationPos,
      float[] locations,
      double[] altitude,
      boolean[] terrainConformant,
      int subdivisions,
      Matrix locationTransform,
      Vec4 referenceCenter,
      int vertexPos,
      float[] vertices) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int numPoints = gb.getSubdivisionPointsVertexCount(subdivisions);

    Globe globe = dc.getGlobe();
    int index1 = 3 * locationPos;
    int index2 = 3 * (locationPos + 1);

    float[] locationVerts = new float[3 * numPoints];
    gb.makeSubdivisionPoints(
        locations[index1],
        locations[index1 + 1],
        locations[index1 + 2],
        locations[index2],
        locations[index2 + 1],
        locations[index2 + 2],
        subdivisions,
        locationVerts);

    for (int i = 0; i < numPoints; i++) {
      int index = 3 * i;
      Vec4 vec = new Vec4(locationVerts[index], locationVerts[index + 1], locationVerts[index + 2]);
      vec = vec.transformBy4(locationTransform);
      Position pos = globe.computePositionFromPoint(vec);

      for (int j = 0; j < 2; j++) {
        vec =
            this.computePointFromPosition(
                dc, pos.getLatitude(), pos.getLongitude(), altitude[j], terrainConformant[j]);

        index = 2 * i + j;
        index = 3 * (vertexPos + index);
        vertices[index] = (float) (vec.x - referenceCenter.x);
        vertices[index + 1] = (float) (vec.y - referenceCenter.y);
        vertices[index + 2] = (float) (vec.z - referenceCenter.z);
      }
    }
  }
  private void makeSectionFillIndices(
      int subdivisions, int vertexPos, int indexPos, int[] indices) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int count = gb.getSubdivisionPointsVertexCount(subdivisions);

    int index = indexPos;
    int pos, nextPos;
    for (int i = 0; i < count - 1; i++) {
      pos = vertexPos + 2 * i;
      nextPos = vertexPos + 2 * (i + 1);
      indices[index++] = pos + 1;
      indices[index++] = pos;
      indices[index++] = nextPos + 1;
      indices[index++] = nextPos + 1;
      indices[index++] = pos;
      indices[index++] = nextPos;
    }
  }
 private int getSectionVertexCount(int subdivisions) {
   GeometryBuilder gb = this.getGeometryBuilder();
   return 2 * gb.getSubdivisionPointsVertexCount(subdivisions);
 }
 private int getSectionFillIndexCount(int subdivisions) {
   GeometryBuilder gb = this.getGeometryBuilder();
   return 6 * (gb.getSubdivisionPointsVertexCount(subdivisions) - 1);
 }