 |
VectSharp
2.2.1
A light library for C# vector graphics
|
19 using System.Collections.Generic;
44 public Point(
double x,
double y)
56 return Math.Sqrt(
X *
X +
Y *
Y);
66 return new Point(
X / mod,
Y / mod);
77 return (Math.Abs(p2.
X -
this.X) <= tolerance || Math.Abs((p2.
X -
this.X) / (p2.
X +
this.X)) <= tolerance * 0.5) && (Math.Abs(p2.
Y -
this.Y) <= tolerance || Math.Abs((p2.
Y -
this.Y) / (p2.
Y +
this.Y)) <= tolerance * 0.5);
88 return new Point(Math.Min(p1.
X, p2.
X), Math.Min(p1.
Y, p2.
Y));
99 return new Point(Math.Max(p1.
X, p2.
X), Math.Max(p1.
Y, p2.
Y));
109 bool initialised =
false;
110 Point min =
new Point(
double.NaN,
double.NaN);
111 Point max =
new Point(
double.NaN,
double.NaN);
113 foreach (
Point pt
in points)
138 return Bounds((IEnumerable<Point>)points);
162 public Size(
double width,
double height)
196 this.Location = location;
207 public Rectangle(
double x,
double y,
double width,
double height)
220 this.Location = topLeft;
221 this.Size =
new Size(bottomRight.
X - topLeft.
X, bottomRight.
Y - topLeft.
Y);
238 minX = Math.Min(minX, rectangle2.
Location.
X);
242 minY = Math.Min(minY, rectangle2.
Location.
Y);
247 maxX = Math.Max(maxX, rectangle2.
Location.
X);
251 maxY = Math.Max(maxY, rectangle2.
Location.
Y);
254 return new Rectangle(minX, minY, maxX - minX, maxY - minY);
264 if (rectangles.Any())
266 bool initialised =
false;
278 tbr =
Union(rect, tbr);
297 return Union((IEnumerable<Rectangle>)rectangles);
Size(double width, double height)
Create a new Size.
Rectangle(Point topLeft, Point bottomRight)
Create a new Rectangle given its top-left corner and its bottom-right corner.
static Point Min(Point p1, Point p2)
Computes the top-left corner of the Rectangle identified by two Points.
static Rectangle Union(params Rectangle[] rectangles)
Computes the rectangular bounds of the union of multiple Rectangles.
double Height
Height of the object.
bool IsEqual(Point p2, double tolerance)
Checks whether this Point is equal to another Point, up to a specified tolerance.
double Modulus()
Computes the modulus of the vector represented by the Point.
static Rectangle Union(IEnumerable< Rectangle > rectangles)
Computes the rectangular bounds of the union of multiple Rectangles.
Size Size
The size of the rectangle.
Rectangle(Point location, Size size)
Create a new Rectangle given its top-left corner and its size.
static readonly Rectangle NaN
A rectangle whose dimensions are all double.NaN.
Point(double x, double y)
Create a new Point.
double X
Horizontal (x) coordinate, measured to the right of the origin.
static Rectangle Bounds(params Point[] points)
Computes the smallest Rectangle that contains all the specified points.
Represents the size of an object.
Rectangle(double x, double y, double width, double height)
Create a new Rectangle given its top-left corner and its size.
Point Location
The top-left corner of the rectangle.
double Width
Width of the object.
Point Normalize()
Normalises a Point.
static Point Max(Point p1, Point p2)
Computes the bottom-right corner of the Rectangle identified by two Points.
Represents a point relative to an origin in the top-left corner.
static Rectangle Union(Rectangle rectangle1, Rectangle rectangle2)
Computes the rectangular bounds of the union of two Rectangles.
static Rectangle Bounds(IEnumerable< Point > points)
Computes the smallest Rectangle that contains all the specified points.
double Y
Vertical (y) coordinate, measured to the bottom of the origin.