VectSharp  2.2.1
A light library for C# vector graphics
VectSharp.Point Struct Reference

Represents a point relative to an origin in the top-left corner. More...

Public Member Functions

 Point (double x, double y)
 Create a new Point. More...
 
double Modulus ()
 Computes the modulus of the vector represented by the Point. More...
 
Point Normalize ()
 Normalises a Point. More...
 
bool IsEqual (Point p2, double tolerance)
 Checks whether this Point is equal to another Point, up to a specified tolerance. More...
 

Static Public Member Functions

static Point Min (Point p1, Point p2)
 Computes the top-left corner of the Rectangle identified by two Points. More...
 
static Point Max (Point p1, Point p2)
 Computes the bottom-right corner of the Rectangle identified by two Points. More...
 
static Rectangle Bounds (IEnumerable< Point > points)
 Computes the smallest Rectangle that contains all the specified points. More...
 
static Rectangle Bounds (params Point[] points)
 Computes the smallest Rectangle that contains all the specified points. More...
 

Public Attributes

double X
 Horizontal (x) coordinate, measured to the right of the origin. More...
 
double Y
 Vertical (y) coordinate, measured to the bottom of the origin. More...
 

Detailed Description

Represents a point relative to an origin in the top-left corner.

Definition at line 27 of file Point.cs.

Constructor & Destructor Documentation

◆ Point()

VectSharp.Point.Point ( double  x,
double  y 
)

Create a new Point.

Parameters
xThe horizontal (x) coordinate.
yThe vertical (y) coordinate.

Definition at line 44 of file Point.cs.

Member Function Documentation

◆ Bounds() [1/2]

static Rectangle VectSharp.Point.Bounds ( IEnumerable< Point points)
static

Computes the smallest Rectangle that contains all the specified points.

Parameters
pointsThe points whose bounds are being computed.
Returns
The smallest Rectangle that contains all the specified points.

Definition at line 107 of file Point.cs.

◆ Bounds() [2/2]

static Rectangle VectSharp.Point.Bounds ( params Point[]  points)
static

Computes the smallest Rectangle that contains all the specified points.

Parameters
pointsThe points whose bounds are being computed.
Returns
The smallest Rectangle that contains all the specified points.

Definition at line 136 of file Point.cs.

◆ IsEqual()

bool VectSharp.Point.IsEqual ( Point  p2,
double  tolerance 
)

Checks whether this Point is equal to another Point, up to a specified tolerance.

Parameters
p2The Point to compare.
toleranceThe tolerance threshold.
Returns
true if both coordinates of the Points are closer than tolerance or if their relative difference (i.e. (a - b) / (a + b) * 2) is smaller than tolerance . false otherwise.

Definition at line 75 of file Point.cs.

◆ Max()

static Point VectSharp.Point.Max ( Point  p1,
Point  p2 
)
static

Computes the bottom-right corner of the Rectangle identified by two Points.

Parameters
p1The first point.
p2The second point.
Returns
A Point whose X coordinate is the largest between the one of p1 and p2 , and likewise for the Y coordinate.

Definition at line 97 of file Point.cs.

◆ Min()

static Point VectSharp.Point.Min ( Point  p1,
Point  p2 
)
static

Computes the top-left corner of the Rectangle identified by two Points.

Parameters
p1The first point.
p2The second point.
Returns
A Point whose X coordinate is the smallest between the one of p1 and p2 , and likewise for the Y coordinate.

Definition at line 86 of file Point.cs.

◆ Modulus()

double VectSharp.Point.Modulus ( )

Computes the modulus of the vector represented by the Point.

Returns
The modulus of the vector represented by the Point.

Definition at line 54 of file Point.cs.

◆ Normalize()

Point VectSharp.Point.Normalize ( )

Normalises a Point.

Returns
The normalised Point.

Definition at line 63 of file Point.cs.

Member Data Documentation

◆ X

double VectSharp.Point.X

Horizontal (x) coordinate, measured to the right of the origin.

Definition at line 32 of file Point.cs.

◆ Y

double VectSharp.Point.Y

Vertical (y) coordinate, measured to the bottom of the origin.

Definition at line 37 of file Point.cs.


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