Skip to content

Instantly share code, notes, and snippets.

@grkvlt
Created October 12, 2017 15:16
Show Gist options
  • Save grkvlt/b3b893ff1dedaa787dd902626b6a9cad to your computer and use it in GitHub Desktop.
Save grkvlt/b3b893ff1dedaa787dd902626b6a9cad to your computer and use it in GitHub Desktop.
Exploring Iterated Function Systems
@Override
public Point2D apply(Point2D src) {
double ox = sw / 2d;
double oy = sh / 2d;
double u = Point2D.distance(0d, 0d, ox / 2d, oy / 2d);
double r = Point2D.distance(ox, oy, src.getX(), src.getY()) / u;
double scale = 1d / (r * r);
double x = (src.getX() - ox) / u;
double y = (src.getY() - oy) / u;
double fx = ox + (u * scale * x);
double fy = oy + (u * scale * y);
return new Point2D.Double(fx, fy);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment