rotatePoint function
Rotate a point around a center.
Implementation
List<double> rotatePoint(
double x, double y, double cx, double cy, double angle) {
final s = sin(angle);
final c = cos(angle);
final px = x - cx;
final py = y - cy;
final nx = px * c - py * s;
final ny = px * s + py * c;
return [nx + cx, ny + cy];
}