Utils.cs 697 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Drawing.Drawing2D;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace InABox.Dxf;
  9. internal static class Utils
  10. {
  11. public static PointF Transform(this Matrix matrix, PointF point)
  12. {
  13. var arr = new[] { point };
  14. matrix.TransformPoints(arr);
  15. return arr[0];
  16. }
  17. public static PointF TransformVector(this Matrix matrix, PointF point)
  18. {
  19. var arr = new[] { point };
  20. matrix.TransformVectors(arr);
  21. return arr[0];
  22. }
  23. public static float Mod(float x, float y)
  24. {
  25. return (float)(x - y * Math.Floor(x / y));
  26. }
  27. }