### Question:
Ellipse extends Area { public List<Position> samplePerimeter(int n) { List<Point> unitPerimeter = new ArrayList<>(n); double pi2 = 2 * Math.PI; double dtheta = pi2 / n; double theta = 0.0; do { unitPerimeter.add(new Point(alpha * cos(theta), beta * sin(theta))); theta += dtheta; } while (theta < pi2); List<Point> rotatedPerimeter = new ArrayList<>(n); for (Point point : unitPerimeter) { Point pr = point.rotate(Point.ORIGIN, thetaDeg).translate(dx, dy); rotatedPerimeter.add(pr); } List<Position> perimeter = new ArrayList<>(n); for (Point point : rotatedPerimeter) { double lon = coordinateConverter.x2Lon(point.getX(), point.getY()); double lat = coordinateConverter.y2Lat(point.getX(), point.getY()); perimeter.add(Position.create(lat, lon)); } return perimeter; } Ellipse(Position geodeticReference, double alpha, double beta, double thetaDeg);  Ellipse(Position geodeticReference, double dx, double dy, double alpha, double beta, double thetaDeg); @Override boolean contains(Position position); double getAlpha(); double getBeta(); @Override Rectangle getBoundingBox(); Position getGeodeticReference(); double getMajorAxisGeodeticHeading(); @Override Position getRandomPosition(Random random); double getThetaDeg(); double getX(); double getY(); Ellipse immutable(); @Override boolean intersects(Area other); boolean intersects(Ellipse otherEllipse); List<Position> samplePerimeter(int n); @Override String toString(); static final MessageSerializer<Ellipse> SERIALIZER; }### Answer:
@Test public void testSamplePerimeter() { Ellipse ellipse = new Ellipse(Position.create(57.700633, 11.673650), -70.52481315529923, -54.37141463499117, 184.0, 40.0, 215.6999969482422); List<Position> positions = ellipse.samplePerimeter(4); assertEquals(4, positions.size()); assertEquals(Position.create(57.699175095853860, 11.669940032389967), positions.get(0)); assertEquals(Position.create(57.699850143182594, 11.672854124920430), positions.get(1)); assertEquals(Position.create(57.701110703232146, 11.674980889575464), positions.get(2)); assertEquals(Position.create(57.700435704758796, 11.672066655989266), positions.get(3)); }