QuickEllipsoid { public double[][] getSurfacePoints(final double[][] vectors) { final int nPoints = vectors.length; for (int p = 0; p < nPoints; p++) { final double[] v = vectors[p]; final double x = ra * v[0]; final double y = rb * v[1]; final double z = rc * v[2]; final double vx = x * ev[0][0] + y * ev[0][1] + z * ev[0][2] + cx; final double vy = x * ev[1][0] + y * ev[1][1] + z * ev[1][2] + cy; final double vz = x * ev[2][0] + y * ev[2][1] + z * ev[2][2] + cz; vectors[p] = new double[]{vx, vy, vz}; } return vectors; } QuickEllipsoid(final double[] radii, final double[] centroid, final double[][] eigenVectors); static double[][] transpose(final double[][] a); boolean contains(final double x, final double y, final double z); void contract(final double increment); QuickEllipsoid copy(); void dilate(final double da, final double db, final double dc); double[] getCentre(); double[] getRadii(); double[][] getRotation(); void setRotation(final double[][] rotation); double[] getSortedRadii(); double[][] getSurfacePoints(final double[][] vectors); double[][] getAxisAlignRandomlyDistributedSurfacePoints(int n); double getVolume(); void rotate(final double[][] rotation); void setCentroid(final double x, final double y, final double z);  }
@Test public void testSurfacePoints() { QuickEllipsoid e = new QuickEllipsoid(new double[]{1,2,3}, new double[]{1,1,1},new double[][]{{1,0,0},{0,1,0},{0,0,1}}); double [][] vectors = new double[2][3]; vectors[0][2] = 1; vectors[1][1] = 1; final double[][] surfacePoints = e.getSurfacePoints(vectors); double [] surfacePoint0 = surfacePoints[0]; assertEquals(1, surfacePoint0[0], 0.0); assertEquals(1, surfacePoint0[1], 0.0); assertEquals(4, surfacePoint0[2], 0.0); double [] surfacePoint1 = surfacePoints[1]; assertEquals(1, surfacePoint1[0], 0.0); assertEquals(3, surfacePoint1[1], 0.0); assertEquals(1, surfacePoint1[2], 0.0); }