rotatePoint method
Sometimes we need to make allowances that a rotation already exists, so it needs to be reversed (pointToLatLng), and sometimes we want to use the same rotation to create a new position (latLngToScreenpoint). counterRotation just makes allowances this for this.
Implementation
Point<double> rotatePoint(
Point<double> mapCenter,
Point<double> point, {
bool counterRotation = true,
}) {
final counterRotationFactor = counterRotation ? -1 : 1;
final m = Matrix4.identity()
..translate(mapCenter.x, mapCenter.y)
..rotateZ(rotationRad * counterRotationFactor)
..translate(-mapCenter.x, -mapCenter.y);
final tp = MatrixUtils.transformPoint(m, point.toOffset());
return Point(tp.dx, tp.dy);
}