@Override protected List<Vec4> computeMinimalGeometry(Globe globe, double verticalExaggeration) { double[] angles = this.computeAngles(); // Angles are equal, fall back to building a closed cylinder. if (angles == null) return super.computeMinimalGeometry(globe, verticalExaggeration); double[] radii = this.getRadii(); Matrix transform = this.computeTransform(globe, verticalExaggeration); GeometryBuilder gb = this.getGeometryBuilder(); int count = gb.getPartialDiskVertexCount(MINIMAL_GEOMETRY_SLICES, MINIMAL_GEOMETRY_LOOPS); int numCoords = 3 * count; float[] verts = new float[numCoords]; gb.makePartialDiskVertices( (float) radii[0], (float) radii[1], // Inner radius, outer radius. MINIMAL_GEOMETRY_SLICES, MINIMAL_GEOMETRY_LOOPS, // Slices, loops, (float) angles[0], (float) angles[2], // Start angle, sweep angle. verts); List<LatLon> locations = new ArrayList<LatLon>(); for (int i = 0; i < numCoords; i += 3) { Vec4 v = new Vec4(verts[i], verts[i + 1], verts[i + 2]); v = v.transformBy4(transform); locations.add(globe.computePositionFromPoint(v)); } ArrayList<Vec4> points = new ArrayList<Vec4>(); this.makeExtremePoints(globe, verticalExaggeration, locations, points); return points; }
private void makePartialDisk( DrawContext dc, double[] radii, double altitude, boolean terrainConformant, int slices, int loops, int orientation, double start, double sweep, Vec4 referenceCenter, Geometry dest) { GeometryBuilder gb = this.getGeometryBuilder(); gb.setOrientation(orientation); int count = gb.getPartialDiskIndexCount(slices, loops); int numCoords = 3 * count; float[] verts = new float[numCoords]; float[] norms = new float[numCoords]; gb.makePartialDiskVertices( (float) radii[0], (float) radii[1], slices, loops, (float) start, (float) sweep, verts); this.makePartialDiskTerrainConformant( dc, numCoords, verts, altitude, terrainConformant, referenceCenter); gb.makePartialDiskVertexNormals( (float) radii[0], (float) radii[1], slices, loops, (float) start, (float) sweep, verts, norms); dest.setVertexData(count, verts); dest.setNormalData(count, norms); }