getAxisVector function

Point getAxisVector(
  1. Offset scrollVector
)

由旋转矢量得到旋转轴方向的单位矢量 将旋转矢量(x,y)逆时针旋转90度即可 x2 = xcos(pi/2)-ysin(pi/2) y2 = xsin(pi/2)+ycos(pi/2)

Implementation

Point getAxisVector(Offset scrollVector) {
  double x = -scrollVector.dy;
  double y = scrollVector.dx;
  double module = sqrt(x * x + y * y);
  return Point(x / module, y / module, 0);
}