Cvb Rectangle structure. More...
Inherits IAreaOfInterest.
Public Member Functions | |
Rect (int left, int top, int right, int bottom) | |
Constructor for Cvb rectangles. More... | |
Rect (Point2D location, Size2D size) | |
Constructor for Cvb rectangles. More... | |
bool | Contains (Point2D pt) |
Check if a point is located inside this Rect. More... | |
bool | Contains (Point2Dd pt) |
Check if a point is located inside this Rect. More... | |
bool | Contains (Point2Dd pt, double epsilon) |
Check if a point is located inside this Rect. More... | |
bool | Contains (int x, int y) |
Determines if the specified point is contained with this Rect. More... | |
override bool | Equals (object obj) |
Tests whether obj is a Rect structure with the same/ location and size as this Rect structure. More... | |
override int | GetHashCode () |
Returns the hash code for this Rect. More... | |
override string | ToString () |
String conversion. More... | |
bool | IntersectsWith (Rect rect) |
Test if this rectangle intersects with rect . More... | |
void | Intersect (Rect rect) |
Replaces this rectangle with the intersection of itself and the specified rectangle. More... | |
Static Public Member Functions | |
static Rect | TruncateCeiling (RectD rect) |
Converts the given rect to a Rect structure by truncating Left and Top and rounding Right and Bottom to the next higher integer number. More... | |
static Rect | Ceiling (RectD rect) |
Converts the given rect to a Rect structure by rounding the values of the RectD structure to the next higher integer number. More... | |
static Rect | Round (RectD rect) |
Converts the given rect to a Rect structure by rounding the values of the RectD structure mathematically. More... | |
static Rect | Truncate (RectD rect) |
Converts the given rect to a Rect structure by rounding the values of the RectD structure to the next lower integer number. More... | |
static Rect | Intersect (Rect a, Rect b) |
Returns a Rect structure that represents the intersection of the two input rectangles. If there is no intersection, an empty Rect is returned. More... | |
static Rect | Union (Rect a, Rect b) |
Gets a Rect structure that contains the union of two Rect structures. More... | |
static Rect | FromLTRB (int left, int top, int right, int bottom) |
Creates a Rect structure with the specified edge locations. More... | |
static Rect | CropExtent (Rect ext, Point2D pos, Size2D imageSize) |
Assuming that a Rect structure contains the extent of something relative to a position inside an image, this function crops the Rect so that the whole content is inside the image. More... | |
static bool | operator!= (Rect lhs, Rect rhs) |
Comparison operator for Rect structures. More... | |
static bool | operator== (Rect lhs, Rect rhs) |
Comparison operator for Rect structures. More... | |
static | operator Rect (RectD rect) |
Explicit conversion operator (truncates the values). More... | |
Static Public Attributes | |
static readonly Rect | Empty = new Rect(0, 0, -1, -1) |
Null-element. | |
Properties | |
int | Left [get, set] |
First column of the rectangle. | |
int | Top [get, set] |
First row of the rectangle. | |
int | Right [get, set] |
Rightmost column of the rectangle (still inside the rectangle). | |
int | Bottom [get, set] |
Bottom row of the rectangle (still inside the rectangle). | |
int | Width [get, set] |
Width of the rectangle. | |
int | Height [get, set] |
Height of the rectangle. | |
Point2D | Location [get, set] |
Location of the top left corner of the rectangle. | |
bool | IsEmpty [get] |
True if width and height are both zero, false otherwise. | |
Size2D | Size [get, set] |
Size of the rectangle. | |
CoordinateSystemType | CoordinateSystem [get] |
Indicates the coordinate system in which this object is being measured (when used as an area of interest). | |
double | Area [get] |
Area of the rectangle. | |
![]() | |
CoordinateSystemType | CoordinateSystem [get] |
Implementers of this interface should specify here inside which coordinate system their Area of interest is to operate. | |
double | Area [get] |
Size (in pixels) of the Area of interest | |
Cvb Rectangle structure.
Unlike System.Drawing.Rectangle
, which upholds the convention that Right and Bottom are not part of the rectangle (in other words: Width = Left - Right and Height = Bottom - Top), Common Vision Blox always uses rectangles (or rectangular shaped areas of interest represented by integer parameters left, top, right and bottom) in such a way that right and bottom are still part of the area to be investigated (i.e. Width = Right - Left + 1 and Height = Bottom - Top
To model this difference correctly we decided to give CVB.Net a rectangle of its own which behaves according to the conventions used in Common Vision Blox.
Rect | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Constructor for Cvb rectangles.
left | Leftmost column of the rectangle |
top | Topmost column of the rectangle |
right | Rightmost column of the rectangle |
bottom | Bottom columns of the rectangle |
Constructor for Cvb rectangles.
location | Location of the rectangle |
size | Size of the rectangle |
bool Contains | ( | int | x, |
int | y | ||
) |
bool Contains | ( | Point2D | pt | ) |
bool Contains | ( | Point2Dd | pt | ) |
bool Contains | ( | Point2Dd | pt, |
double | epsilon | ||
) |
Assuming that a Rect structure contains the extent of something relative to a position inside an image, this function crops the Rect so that the whole content is inside the image.
ext | Rect to be cropped. |
pos | Position in the image relative to which the extent is to be applied. |
imageSize | Available size (i.e. upper limit for cropping). |
override bool Equals | ( | object | obj | ) |
|
static |
Creates a Rect structure with the specified edge locations.
left | The x-coordinate of the upper left corner of this Rect structure |
top | The y-coordinate of the upper left corner of this Rect structure |
right | The x-coordinate of the lower right corner of this Rect structure |
bottom | The y-coordinate of the lower right corner of this Rect structure |
void Intersect | ( | Rect | rect | ) |
Replaces this rectangle with the intersection of itself and the specified rectangle.
rect | The rectangle with which to intersect |
bool IntersectsWith | ( | Rect | rect | ) |
Test if this rectangle intersects with rect .
rect | The rectangle to test |
true
if there is any intersection, false
otherwiseComparison operator for Rect structures.
lhs | Left hand side operand. |
rhs | Right hand side operand. |
true
if lhs != rhs , false
otherwise.Comparison operator for Rect structures.
lhs | Left hand side operand |
rhs | Right hand side operand |
true
if lhs != rhs , false
otherwise.override string ToString | ( | ) |
String conversion.