using static System.Collections.Specialized.BitVector32; namespace AdventOfCode.Core.Shared.Grid { /// /// A horizontal line based on the Start Y value. /// /// /// public class Line(Point start, Point end) { public Point Start { get; set; } = start; public Point End { get; set; } = end; public long Length => End.X - Start.X + 1; public string Value { get; set; } = string.Empty; public Line(long X, long Y, long length, string value = "") : this (new Point(X, Y), length, value) { } public Line(Point start, long length, string value = "") : this(start, length) => Value = value; public Line(Point start, long length) : this(start, new Point (start.X + length - 1, start.Y)) { } public bool Intersect(Point point) => IntersectHelpers.Intersect(this, point); public bool Intersect(Line line) => IntersectHelpers.Intersect(this, line); public override string ToString() { return $"[{Start.X},{End.X}] {Length}"; //return $"[{Start.Y},{Start.X}] {Value}"; } } }