LineIdentified.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using o0.Geometry2D.Float;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace o0.Project
  8. {
  9. public class LineIdentified
  10. {
  11. // 属于的识别批次
  12. public int Batch;
  13. // 线段
  14. public Line Line;
  15. // 线梯度
  16. public float Gradient;
  17. // 线梯度方向, 0 - 180度
  18. public float GradientDegree;
  19. // 用于绘制的线, 为null就是不绘制
  20. public Line DrawLine;
  21. public LineIdentified(int batch, Line line, float gradient, float gradientDegree, bool drawAll = false)
  22. {
  23. Batch = batch;
  24. Line = line;
  25. Gradient = gradient;
  26. GradientDegree = gradientDegree;
  27. if (drawAll)
  28. DrawLine = line;
  29. }
  30. public LineIdentified(int batch, (Line line, float gradient, float gradientDegree) lineParams, bool drawAll = false)
  31. {
  32. Batch = batch;
  33. Line = lineParams.line;
  34. Gradient = lineParams.gradient;
  35. GradientDegree = lineParams.gradientDegree;
  36. if (drawAll)
  37. DrawLine = lineParams.line;
  38. }
  39. public void Offset(Vector offset)
  40. {
  41. Line += offset;
  42. }
  43. }
  44. }