BioGTK  5.1.1
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images.
Loading...
Searching...
No Matches
BioGTK.RectangleD Struct Reference

Public Member Functions

 RectangleD (double X, double Y, double W, double H)
 
Rectangle ToRectangleInt ()
 
bool IntersectsWith (RectangleD rect1)
 
bool IntersectsWith (PointD p)
 
bool IntersectsWith (double x, double y)
 
RectangleF ToRectangleF ()
 
override string ToString ()
 

Properties

double X [get, set]
 
double Y [get, set]
 
double W [get, set]
 
double H [get, set]
 

Constructor & Destructor Documentation

◆ RectangleD()

BioGTK.RectangleD.RectangleD ( double  X,
double  Y,
double  W,
double  H 
)
inline
320 {
321 x = X;
322 y = Y;
323 w = W;
324 h = H;
325 }
double W
Definition Bio.cs:316
double X
Definition Bio.cs:314
double Y
Definition Bio.cs:315
double H
Definition Bio.cs:317

Member Function Documentation

◆ IntersectsWith() [1/3]

bool BioGTK.RectangleD.IntersectsWith ( double  x,
double  y 
)
inline

If the point is within the rectangle, return true. Otherwise, return false

Parameters
xThe x coordinate of the point to check
yThe y coordinate of the point to test.
Returns
A boolean value.
361 {
362 if (X <= x && (X + W) >= x && Y <= y && (Y + H) >= y)
363 return true;
364 else
365 return false;
366 }

◆ IntersectsWith() [2/3]

bool BioGTK.RectangleD.IntersectsWith ( PointD  p)
inline

‍Returns true if the point is inside the rectangle

Parameters
PointD
Returns
The return value is a boolean value.
351 {
352 return IntersectsWith(p.X, p.Y);
353 }
bool IntersectsWith(RectangleD rect1)
Definition Bio.cs:336

◆ IntersectsWith() [3/3]

bool BioGTK.RectangleD.IntersectsWith ( RectangleD  rect1)
inline

If any of the four corners of the rectangle are inside the polygon, then the rectangle intersects with the polygon

Parameters
RectangleDThe rectangle that is being checked for intersection.
Returns
a boolean value.
337 {
338 if (rect1.X + rect1.W < X || X + W < rect1.X ||
339 rect1.Y + rect1.H < Y || Y + H < rect1.Y)
340 {
341 return false;
342 }
343 return true;
344 }

◆ ToRectangleF()

RectangleF BioGTK.RectangleD.ToRectangleF ( )
inline

It converts a RectangleD to a RectangleF

Returns
A RectangleF object.
371 {
372 return new RectangleF((float)X, (float)Y, (float)W, (float)H);
373 }

◆ ToRectangleInt()

Rectangle BioGTK.RectangleD.ToRectangleInt ( )
inline
327 {
328 return new Rectangle((int)X, (int)Y, (int)W, (int)H);
329 }
AForge.Rectangle Rectangle
Definition ImageView.cs:14

◆ ToString()

override string BioGTK.RectangleD.ToString ( )
inline

This function returns a string that contains the values of the X, Y, W, and H properties of the object

Returns
The X, Y, W, and H values of the rectangle.
379 {
380 double w = Math.Round(W, 2, MidpointRounding.ToZero);
381 double h = Math.Round(H, 2, MidpointRounding.ToZero);
382 double x = Math.Round(X, 2, MidpointRounding.ToZero);
383 double y = Math.Round(Y, 2, MidpointRounding.ToZero);
384 return x + ", " + y + ", " + w + ", " + h;
385 }

Property Documentation

◆ H

double BioGTK.RectangleD.H
getset
317{ get { return h; } set { h = value; } }

◆ W

double BioGTK.RectangleD.W
getset
316{ get { return w; } set { w = value; } }

◆ X

double BioGTK.RectangleD.X
getset
314{ get { return x; } set { x = value; } }

◆ Y

double BioGTK.RectangleD.Y
getset
315{ get { return y; } set { y = value; } }

The documentation for this struct was generated from the following file: