| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using o0.Geometry2D.Float;
- namespace o0.Project
- {
- public class LineIdentified
- {
- // 属于的识别批次
- public int Batch;
- // 线段
- public Line Line;
- // 线梯度
- public float Gradient;
- // 线梯度方向, 0 - 180度
- public float GradientDegree;
- // 筛线条时, 计算垂直直线的梯度值
- public float ZIMGradient;
- // 到屏幕中点的距离
- public float DistanceToMiddle;
- // 用于绘制的线, 为null就是不绘制
- public Line DrawLine;
- // 被认为是屏幕的哪条边,-1表示不是屏幕的边,0, 1, 2,3对应 下、右、上、左
- public int ScreenLineIndex;
- public LineIdentified(int batch, Line line, float gradient, float gradientDegree, bool drawAll = false)
- {
- Batch = batch;
- Line = line;
- Gradient = gradient;
- GradientDegree = gradientDegree;
- if (drawAll)
- DrawLine = line;
- }
- public LineIdentified(int batch, (Line line, float gradient, float gradientDegree) lineParams, bool drawAll = false)
- {
- Batch = batch;
- Line = lineParams.line;
- Gradient = lineParams.gradient;
- GradientDegree = lineParams.gradientDegree;
- if (drawAll)
- DrawLine = lineParams.line;
- }
- bool? _isInterLine;
- // 评估是否是屏幕内部的线
- public bool GuessIsInterLine(InterLineGuess guess)
- {
- if (_isInterLine == null)
- _isInterLine = guess.GuessIsLine(this);
- return _isInterLine.Value;
- }
- public void Offset(Vector offset)
- {
- Line += offset;
- }
- }
- }
|