LineIdentified.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. // 筛线条时, 计算垂直直线的梯度值
  20. public float ZIMGradient;
  21. // 到屏幕中点的距离
  22. public float DistanceToMiddle;
  23. // 用于绘制的线, 为null就是不绘制
  24. public Line DrawLine;
  25. // 被认为是屏幕的哪条边,-1表示不是屏幕的边,0, 1, 2,3对应 下、右、上、左
  26. public int ScreenLineIndex;
  27. public LineIdentified(int batch, Line line, float gradient, float gradientDegree, bool drawAll = false)
  28. {
  29. Batch = batch;
  30. Line = line;
  31. Gradient = gradient;
  32. GradientDegree = gradientDegree;
  33. if (drawAll)
  34. DrawLine = line;
  35. }
  36. public LineIdentified(int batch, (Line line, float gradient, float gradientDegree) lineParams, bool drawAll = false)
  37. {
  38. Batch = batch;
  39. Line = lineParams.line;
  40. Gradient = lineParams.gradient;
  41. GradientDegree = lineParams.gradientDegree;
  42. if (drawAll)
  43. DrawLine = lineParams.line;
  44. }
  45. public void Offset(Vector offset)
  46. {
  47. Line += offset;
  48. }
  49. }
  50. }