/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a rectangular clipping boundary from two opposite corners. /// </summary> /// <param name="firstCorner">Rectangle first corner.</param> /// <param name="secondCorner">Rectangle second corner.</param> public ClippingBoundary(Vector2 firstCorner, Vector2 secondCorner) { this.type = ClippingBoundaryType.Rectangular; this.vertexes = new List <Vector2> { firstCorner, secondCorner }; }
/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a rectangular clipping boundary. /// </summary> /// <param name="x">Rectangle x-coordinate of the first corner.</param> /// <param name="y">Rectangle y-coordinate of the first corner.</param> /// <param name="width">Rectangle width.</param> /// <param name="height">Rectangle height.</param> public ClippingBoundary(double x, double y, double width, double height) { this.type = ClippingBoundaryType.Rectangular; this.vertexes = new List <Vector2> { new Vector2(x, y), new Vector2(x + width, y + height) }; }
/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a polygonal clipping boundary. /// </summary> /// <param name="vertexes">The list of vertexes of the polygonal boundary.</param> public ClippingBoundary(IList<Vector2> vertexes) { if (vertexes.Count < 3) throw new ArgumentException("The number of vertexes for the polygonal clipping boundary must be equal or greater than three.", nameof(vertexes)); this.type = ClippingBoundaryType.Polygonal; this.vertexes = new List<Vector2>(vertexes); }
/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a polygonal clipping boundary. /// </summary> /// <param name="vertexes">The list of vertexes of the polygonal boundary.</param> public ClippingBoundary(IEnumerable <Vector2> vertexes) { this.type = ClippingBoundaryType.Polygonal; this.vertexes = new List <Vector2>(vertexes); if (this.vertexes.Count < 3) { throw new ArgumentOutOfRangeException(nameof(vertexes), this.vertexes.Count, "The number of vertexes for the polygonal clipping boundary must be equal or greater than three."); } }
/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a polygonal clipping boundary. /// </summary> /// <param name="vertexes">The list of vertexes of the polygonal boundary.</param> public ClippingBoundary(IList <Vector2> vertexes) { if (vertexes.Count < 3) { throw new ArgumentException("The number of vertexes for the polygonal clipping boundary must be equal or greater than three.", nameof(vertexes)); } this.type = ClippingBoundaryType.Polygonal; this.vertexes = new List <Vector2>(vertexes); }
/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a rectangular clipping boundary from two opposite corners. /// </summary> /// <param name="firstCorner">Rectangle top-left corner in image local coordinates.</param> /// <param name="secondCorner">Rectangle secondCorner in local coordinates.</param> public ClippingBoundary(Vector2 firstCorner, Vector2 secondCorner) { this.type = ClippingBoundaryType.Rectangular; this.vertexes = new List<Vector2> { firstCorner, secondCorner }; }
/// <summary> /// Initializes a new instance of the <c>ClippingBoundary</c> class as a rectangular clipping boundary. /// </summary> /// <param name="x">Rectangle x-coordinate of the bottom-left corner in image local coordinates.</param> /// <param name="y">Rectangle y-coordinate of the bottom-left corner in image local coordinates.</param> /// <param name="width">Rectangle width in image local coordinates.</param> /// <param name="height">Rectangle height in image local coordinates.</param> public ClippingBoundary(double x, double y, double width, double height) { this.type = ClippingBoundaryType.Rectangular; this.vertexes = new List<Vector2> { new Vector2(x, y), new Vector2(x + width, y + height) }; }