Esempio n. 1
0
 public static int Left(this LineSegment segment)
 {
     return(Math.Min(segment.Start.X, segment.End.X));
 }
Esempio n. 2
0
 public static IEnumerable <Point> Points(this LineSegment self)
 {
     return(Enumerate(self.Start.X, self.End.X)
            .SelectMany(x => Enumerate(self.Start.Y, self.End.Y).Select(y => new { x, y }))
            .Select(p => new Point(p.x, p.y)));
 }
Esempio n. 3
0
 public static int Right(this LineSegment segment)
 {
     return(Math.Max(segment.Start.X, segment.End.X));
 }
Esempio n. 4
0
 public static int Bottom(this LineSegment segment)
 {
     return(Math.Min(segment.Start.Y, segment.End.Y));
 }
Esempio n. 5
0
 public static int Top(this LineSegment segment)
 {
     return(Math.Max(segment.Start.Y, segment.End.Y));
 }
Esempio n. 6
0
 public static bool IsVertical(this LineSegment segment)
 {
     return(segment.Start.X == segment.End.X);
 }
Esempio n. 7
0
 public static LineSegment Extend(this LineSegment originalSegment, string instruction)
 {
     return(new LineSegment(originalSegment.End, originalSegment.End.Translate(instruction)));
 }