attempts to merge mirrored curves

This commit is contained in:
yugecin
2016-12-25 17:30:09 +01:00
parent 0e30a1e0e4
commit 9ec2d1a5a8
4 changed files with 67 additions and 29 deletions

View File

@@ -661,4 +661,15 @@ public class Utils {
};
}
public static float[] mirrorPoint(float x, float y, float degrees) {
double dx = x - Options.width / 2d;
double dy = y - Options.height / 2d;
double ang = Math.atan2(dy, dx) + (degrees * Math.PI / 180d);
double d = Math.sqrt(dx * dx + dy * dy);
return new float[]{
(float) (Options.width / 2d + Math.cos(ang) * d),
(float) (Options.height / 2d + Math.sin(ang) * d)
};
}
}