BinaryTriangleTree { public FastShape buildMeshFromCenter(float maxVariance) { return buildMeshFromCenter(maxVariance, new Rectangle(0, 0, width, height)); } BinaryTriangleTree(List<Position> positions, int width, int height); boolean isGenerateTextureCoordinates(); void setGenerateTextureCoordinates(boolean generateTextureCoordinates); boolean isForceGLTriangles(); void setForceGLTriangles(boolean forceGLTriangles); FastShape buildMesh(float maxVariance); FastShape buildMeshFromCenter(float maxVariance); FastShape buildMesh(float maxVariance, Rectangle rectangle); FastShape buildMeshFromCenter(float maxVariance, Rectangle rectangle); FastShape buildFullMesh(Rectangle rect);  }
@Test public void testSimplification() throws IOException { ByteBuffer byteBuffer = WWIO.readURLContentToBuffer(this.getClass().getResource("elevations.bil")); AVList bufferParams = new AVListImpl(); bufferParams.setValue(AVKey.DATA_TYPE, AVKey.INT16); bufferParams.setValue(AVKey.BYTE_ORDER, AVKey.LITTLE_ENDIAN); BufferWrapper wrapper = BufferWrapper.wrap(byteBuffer, bufferParams); int width = 150; int height = 150; List<Position> positions = new ArrayList<Position>(width * height); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { positions.add(Position.fromDegrees(y, x, wrapper.getDouble(y * width + x))); } } BinaryTriangleTree btt = new BinaryTriangleTree(positions, width, height); FastShape shape = btt.buildMeshFromCenter(1, new Rectangle(29, 29, 119, 119)); BufferedImage image = shapeToImage(shape, width, height); BufferedImage reference = ImageIO.read(this.getClass().getResourceAsStream("reference.png")); Assert.assertTrue(areImagesEqual(image, reference)); }