public static Point RotateDirection(Vector screenDirection, double angle) { if (screenDirection.Length == 0) { throw new ArgumentException("ScreenDirection cannot be of length 0."); } Vector rotatedDir = screenDirection.Rotate(angle); Point screenPoint = GetPointForDirection(rotatedDir); return(screenPoint); }
public static Point GetPointForDirection(Vector worldDirection) { if (worldDirection.Length == 0) { throw new InvalidOperationException("Invalid direction."); } else if (instance == null) { throw new InvalidOperationException("Instance is not initialized, cannot set click point."); } double angle = Maths.Angle(instance.upDirection, worldDirection); Vector rotatedScreenPoint = toRotate.Rotate(angle); Vector newScreenVect = Center + rotatedScreenPoint; return(newScreenVect.ToPoint()); }