rotatePoint method
CustomPoint<double>
rotatePoint(
- CustomPoint<
num> mapCenter, - CustomPoint<
num> point, { - bool counterRotation = true,
Implementation
CustomPoint<double> rotatePoint(CustomPoint mapCenter, CustomPoint point,
{bool counterRotation = true}) {
final counterRotationFactor = counterRotation ? -1 : 1;
final m = Matrix4.identity()
..translate(mapCenter.x.toDouble(), mapCenter.y.toDouble())
..rotateZ(rotationRad * counterRotationFactor)
..translate(-mapCenter.x.toDouble(), -mapCenter.y.toDouble());
final tp = MatrixUtils.transformPoint(
m, Offset(point.x.toDouble(), point.y.toDouble()));
return CustomPoint(tp.dx, tp.dy);
}