42 public Size(
float width,
float height)
53 public Size(
double width,
double height)
66 divisions = Utils.GetAcceptableNumber(divisions);
70 bool isVertical = this.Height > this.
Width;
76 else if (divisions == 2)
89 else if (divisions == 3)
104 else if (divisions == 5)
123 else if (divisions == 7)
148 for (
int divisorInd = 0; divisorInd < Utils.AcceptableDivisors.Length; divisorInd++)
150 if (divisions % Utils.AcceptableDivisors[divisorInd] == 0)
152 Rectangle[] largerDivisions = this.
Split(divisions / Utils.AcceptableDivisors[divisorInd]);
156 for (
int i = 0; i < largerDivisions.Length; i++)
159 Rectangle[] currDivision = s.
Split(Utils.AcceptableDivisors[divisorInd]);
161 for (
int j = 0; j < currDivision.Length; j++)
163 tbr[pos] =
new Rectangle(largerDivisions[i].X0 + currDivision[j].X0, largerDivisions[i].Y0 + currDivision[j].Y0, largerDivisions[i].X0 + currDivision[j].X1, largerDivisions[i].Y0 + currDivision[j].Y1);
211 divisions = Utils.GetAcceptableNumber(divisions);
215 bool isVertical = this.Height > this.
Width;
221 else if (divisions == 2)
234 else if (divisions == 3)
249 else if (divisions == 5)
268 else if (divisions == 7)
293 for (
int divisorInd = 0; divisorInd < Utils.AcceptableDivisors.Length; divisorInd++)
295 if (divisions % Utils.AcceptableDivisors[divisorInd] == 0)
301 for (
int i = 0; i < largerDivisions.Length; i++)
306 for (
int j = 0; j < currDivision.Length; j++)
308 tbr[pos] =
new RoundedRectangle(largerDivisions[i].X0 + currDivision[j].X0, largerDivisions[i].Y0 + currDivision[j].Y0, largerDivisions[i].X0 + currDivision[j].X1, largerDivisions[i].Y0 + currDivision[j].Y1);
365 public Rectangle(
float x0,
float y0,
float x1,
float y1)
380 public Rectangle(
double x0,
double y0,
double x1,
double y1)
395 (
int)Math.Floor(
X0 + 0.001),
396 (
int)Math.Floor(
Y0 + 0.001),
397 (
int)Math.Ceiling(
X1 - 0.001),
398 (
int)Math.Ceiling(
Y1 - 0.001)
410 (
int)Math.Floor(
X0 * (
float)zoom + 0.001),
411 (
int)Math.Floor(
Y0 * (
float)zoom + 0.001),
412 (
int)Math.Ceiling(
X1 * (
float)zoom - 0.001),
413 (
int)Math.Ceiling(
Y1 * (
float)zoom - 0.001)
424 Size s =
new Size(this.Width, this.Height);
430 for (
int i = 0; i < splitSize.Length; i++)
432 tbr[i] =
new Rectangle(this.X0 + splitSize[i].
X0, this.Y0 + splitSize[i].
Y0, this.X0 + splitSize[i].
X1, this.Y0 + splitSize[i].
Y1);
445 float x0 = Math.Max(this.X0, other.
X0);
446 float y0 = Math.Max(this.Y0, other.
Y0);
448 float x1 = Math.Min(this.X1, other.
X1);
449 float y1 = Math.Min(this.Y1, other.
Y1);
451 if (x1 <= x0 || y1 <= y0)
468 return other.X0 >= this.X0 && other.X1 <= this.X1 && other.Y0 >= this.Y0 && other.Y1 <= this.
Y1;
478 return point.X >= this.X0 && point.X <= this.X1 && point.Y >= this.Y0 && point.Y <= this.
Y1;
554 for (
int i = 0; i < splitSize.Length; i++)
556 tbr[i] =
new RoundedRectangle(this.X0 + splitSize[i].
X0, this.Y0 + splitSize[i].
Y0, this.X0 + splitSize[i].
X1, this.Y0 + splitSize[i].
Y1);
624 this.LowerLeft = lowerLeft;
625 this.UpperLeft = upperLeft;
626 this.UpperRight = upperRight;
627 this.LowerRight = lowerRight;
637 return PointInTriangle(point, this.LowerLeft, this.UpperLeft, this.UpperRight) || PointInTriangle(point, this.LowerLeft, this.UpperRight, this.LowerRight);
650 double signAB = (pt.X - B.
X) * (A.
Y - B.
Y) - (A.X - B.
X) * (pt.
Y - B.
Y);
651 double signBC = (pt.X - C.
X) * (B.
Y - C.
Y) - (B.X - C.
X) * (pt.
Y - C.
Y);
652 double signCA = (pt.X - A.
X) * (C.
Y - A.
Y) - (C.X - A.
X) * (pt.
Y - A.
Y);
654 return !((signAB < 0 || signBC < 0 || signCA < 0) && (signAB > 0 || signBC > 0 || signCA > 0));
float X
The horizontal coordinate of the point.
PointF(float x, float y)
Create a new PointF from the specified coordinates.
float Y
The vertical coordinate of the point.
Represents a quadrilater (not necessarily a rectangle).
Quad(PointF lowerLeft, PointF upperLeft, PointF upperRight, PointF lowerRight)
Creates a new Quad from the specified points.
PointF LowerLeft
The lower left point of the quadrilater.
bool Contains(PointF point)
Checks whether this Quad contains a PointF.
PointF LowerRight
The lower right point of the quadrilater.
PointF UpperRight
The upper right point of the quadrilater.
PointF UpperLeft
The upper left point of the quadrilater.
RoundedRectangle Round()
Round the rectangle's coordinates to the closest integers.
Quad ToQuad()
Converts the Rectangle to a Quad.
bool Contains(PointF point)
Checks whether this Rectangle contains a PointF.
Rectangle(float x0, float y0, float x1, float y1)
Create a new Rectangle from the specified coordinates.
float Width
The width of the rectangle.
Rectangle Intersect(Rectangle other)
Compute the intersection between this Rectangle and another one.
float Height
The height of the rectangle.
RoundedRectangle Round(double zoom)
Round the rectangle's coordinates to the closest integers, applying the specified zoom factor.
float Y0
The top coordinate of the rectangle.
float X1
The right coordinate of the rectangle.
float X0
The left coordinate of the rectangle.
bool Contains(Rectangle other)
Checks whether this Rectangle contains another Rectangle.
float Y1
The bottom coordinate of the rectangle.
Rectangle(double x0, double y0, double x1, double y1)
Create a new Rectangle from the specified coordinates.
Rectangle[] Split(int divisions)
Split the rectangle into the specified number of Rectangles.
Represents a rectangle using only integer numbers.
int Y1
The bottom coordinate of the rectangle.
int Width
The width of the rectangle.
int X1
The right coordinate of the rectangle.
RoundedRectangle(int x0, int y0, int x1, int y1)
Create a new RoundedRectangle from the specified coordinates.
int Height
The height of the rectangle.
RoundedRectangle[] Split(int divisions)
Split the rectangle into the specified number of RoundedRectangles.
int Y0
The top coordinate of the rectangle.
int X0
The left coordinate of the rectangle.
Represents the size of a rectangle using only integer numbers.
int Height
The height of the rectangle.
RoundedSize(int width, int height)
Create a new RoundedSize with the specified width and height.
int Width
The width of the rectangle.
RoundedRectangle[] Split(int divisions)
Split the size into the specified number of RoundedRectangles.
Represents the size of a rectangle.
Size(double width, double height)
Create a new Size with the specified width and height.
float Width
The width of the rectangle.
Size(float width, float height)
Create a new Size with the specified width and height.
Rectangle[] Split(int divisions)
Split the size into the specified number of Rectangles.
float Height
The height of the rectangle.