예제 #1
0
 public static Rectangle <T> FromPositionSize <T>(T left, T top, T width, T height)
 {
     return(FromIntervals(
                Interval.FromOffsetLength(left, width),
                Interval.FromOffsetLength(top, height)));
 }
예제 #2
0
 public static Rectangle <T> ToRectangle <T>(this Size <T> size) where T : INumeric <T>, new()
 {
     return(FromIntervals(
                Interval.FromOffsetLength(new T(), size.Width),
                Interval.FromOffsetLength(new T(), size.Height)));
 }
예제 #3
0
 public static Rectangle <double> FromSides(double left, double top, double right, double bottom)
 {
     return(FromIntervals(
                Interval.FromMinMax(left, right),
                Interval.FromMinMax(top, bottom)));
 }
예제 #4
0
        // Constructors

        public static Rectangle <T> FromIntervals <T>(Interval <T> horizontalInterval, Interval <T> verticalInterval)
        {
            return(new Rectangle <T>(horizontalInterval, verticalInterval));
        }
예제 #5
0
 public static Rectangle <T> WithAxis <T>(this Rectangle <T> rect, Axis2D axis, Interval <T> interval)
 {
     return(axis == Axis2D.Horizontal
                         ? new Rectangle <T>(interval, rect.VerticalInterval)
                         : new Rectangle <T>(rect.HorizontalInterval, interval));
 }
예제 #6
0
 public static Rectangle <IObservable <T> > MoveTo <T>(this Rectangle <IObservable <T> > rect, Point <IObservable <T> > position) where T : INumeric <T>
 {
     return(FromIntervals(
                Interval.FromOffsetLength(rect.HorizontalInterval.Offset.Add(position.X), rect.Width),
                Interval.FromOffsetLength(rect.VerticalInterval.Offset.Add(position.Y), rect.Height)));
 }