CVB.Net 14.0
RectD Struct Reference

Corresponds in intention and use with the type RectD, although RectD is far more widely used. More...

Inherits IAreaOfInterest.

Public Member Functions

 RectD (double left, double top, double right, double bottom)
 Construct a RectD structure. More...
 
 RectD (Point2Dd location, Size2Dd size)
 Constructs a RectD structure. More...
 
bool Contains (Point2Dd pt)
 Check if a point is located inside this RectD. More...
 
bool Contains (double x, double y)
 Determines if the specified point is contained with this RectD. More...
 
bool IntersectsWith (RectD rect)
 Test if this rectangle intersects with rect . More...
 
void Intersect (RectD rect)
 Replaces this rectangle with the intersection of itself and the specified rectangle. More...
 
override bool Equals (object obj)
 Tests whether obj is a RectD structure with the same location and size of this RectD structure. More...
 
override int GetHashCode ()
 Returns the hash code for this Rectangle More...
 
override string ToString ()
 String conversion. More...
 

Static Public Member Functions

static RectD Intersect (RectD a, RectD b)
 Returns a RectD structure that represents the intersection of the two input rectangles. If there is no intersection, an empty RectD is returned. More...
 
static RectD Union (RectD a, RectD b)
 Gets a RectD structure that contains the union of two RectD structures. More...
 
static RectD FromLTRB (double left, double top, double right, double bottom)
 Creates a RectD structure with the specified edge locations. More...
 
static bool operator!= (RectD lhs, RectD rhs)
 Comparison operator for RectD structures. More...
 
static bool operator== (RectD lhs, RectD rhs)
 Comparison operator for RectD structures. More...
 
static implicit operator RectD (Rect rect)
 Implicit conversion from Rect to RectD. More...
 

Public Attributes

double Left
 Left edge of the rectangle.
 
double Top
 Top edge of the rectangle.
 
double Right
 Right edge of the rectangle.
 
double Bottom
 Bottom edge of the rectangle.
 

Static Public Attributes

static readonly RectD Empty = new RectD(0, 0, -1, -1)
 Null-element.
 

Properties

double Width [get, set]
 Width of the rectangle.
 
double Height [get, set]
 Height of the rectangle.
 
Point2Dd 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.
 
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.
 
- Properties inherited from IAreaOfInterest
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
 

Detailed Description

Corresponds in intention and use with the type RectD, although RectD is far more widely used.

Constructor & Destructor Documentation

◆ RectD() [1/2]

RectD ( double  left,
double  top,
double  right,
double  bottom 
)

Construct a RectD structure.

Parameters
leftLeft edge of the rectangle
toptop edge of the rectangle
rightRight edge of the rectangle
bottombottom edge of the rectangle

◆ RectD() [2/2]

RectD ( Point2Dd  location,
Size2Dd  size 
)

Constructs a RectD structure.

Parameters
locationLeft/top location.
sizeWidth and height.

Member Function Documentation

◆ Contains() [1/2]

bool Contains ( double  x,
double  y 
)

Determines if the specified point is contained with this RectD.

Parameters
xX-coordinate of the point to test
yY-coordinate of the point to test
Returns
true of the point defined through the parameters x and y is inside this Rect; false otherwise.

◆ Contains() [2/2]

bool Contains ( Point2Dd  pt)

Check if a point is located inside this RectD.

Parameters
ptPoint to be checked
Returns
true if pt is inside this RectD, false otherwise.

◆ Equals()

override bool Equals ( object  obj)

Tests whether obj is a RectD structure with the same location and size of this RectD structure.

Parameters
objObject to compare to this one.
Returns
true if obj is a RectD and if the borders are equal.

◆ FromLTRB()

static RectD FromLTRB ( double  left,
double  top,
double  right,
double  bottom 
)
static

Creates a RectD structure with the specified edge locations.

Parameters
leftThe x-coordinate of the upper left corner of this Rect structure
topThe y-coordinate of the upper left corner of this Rect structure
rightThe x-coordinate of the lower right corner of this Rect structure
bottomThe y-coordinate of the lower right corner of this Rect structure
Returns
The new Rect that this method creates.

◆ GetHashCode()

override int GetHashCode ( )

Returns the hash code for this Rectangle

Returns
Hash code.

◆ Intersect() [1/2]

static RectD Intersect ( RectD  a,
RectD  b 
)
static

Returns a RectD structure that represents the intersection of the two input rectangles. If there is no intersection, an empty RectD is returned.

Parameters
aRectD to intersect.
bRectD to intersect.
Returns
a RectD that represents the intersection of a and b.

◆ Intersect() [2/2]

void Intersect ( RectD  rect)

Replaces this rectangle with the intersection of itself and the specified rectangle.

Parameters
rectThe rectangle with which to intersect

◆ IntersectsWith()

bool IntersectsWith ( RectD  rect)

Test if this rectangle intersects with rect .

Parameters
rectThe rectangle to test
Returns
true if there is any intersection, false otherwise

◆ operator RectD()

static implicit operator RectD ( Rect  rect)
static

Implicit conversion from Rect to RectD.

Parameters
rectRectangle to be converted.
Returns
New RectD.

◆ operator!=()

static bool operator!= ( RectD  lhs,
RectD  rhs 
)
static

Comparison operator for RectD structures.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
true if lhs != rhs , false otherwise

◆ operator==()

static bool operator== ( RectD  lhs,
RectD  rhs 
)
static

Comparison operator for RectD structures.

Parameters
lhsLeft hand side operand
rhsRight hand side operand
Returns
true if lhs == rhs , false otherwise

◆ ToString()

override string ToString ( )

String conversion.

Returns
String representation of this RectD

◆ Union()

static RectD Union ( RectD  a,
RectD  b 
)
static

Gets a RectD structure that contains the union of two RectD structures.

Parameters
aA rectangle to union
bA rectangle to union
Returns
A RectD that bounds the union of the two RectD structures