VectSharp 2.6.1
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.Point Struct Reference

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

Inheritance diagram for VectSharp.Point:

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...
 
IEnumerator< double > GetEnumerator ()
 
IEnumerator IEnumerable. GetEnumerator ()
 

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...
 
static implicit operator (double X, double Y)(Point point)
 Implicit conversion to a tuple. More...
 
static implicit operator double[] (Point point)
 Implicit conversion to an array. More...
 
static implicit operator Point ((double X, double Y) tuple)
 Implicit conversion from a tuple. More...
 
static operator Point (double[] array)
 Explicit conversion from an array (will throw an exception if the array does not contain exactly two elements). More...
 
static Point operator- (Point p1, Point p2)
 Subtract the coordinates of two points. More...
 
static Point operator+ (Point p1, Point p2)
 Add the coordinates of two points. More...
 
static Point operator* (double t, Point p)
 Multiply the coordinates of a point by a scalar. More...
 
static Point operator* (Point p, double t)
 Multiply the coordinates of a point by a scalar. 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...
 

Properties

int Count [get]
 
double this[int index] [get]
 

Detailed Description

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

Definition at line 31 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 71 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 135 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 164 of file Point.cs.

◆ GetEnumerator()

IEnumerator< double > VectSharp.Point.GetEnumerator ( )

Definition at line 170 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 103 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 125 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 114 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 81 of file Point.cs.

◆ Normalize()

Point VectSharp.Point.Normalize ( )

Normalises a Point.

Returns
The normalised Point.

Definition at line 91 of file Point.cs.

◆ operator()

static implicit VectSharp.Point.operator ( double  X,
double  Y 
)
static

Implicit conversion to a tuple.

Parameters
pointThe point to convert.

Definition at line 183 of file Point.cs.

◆ operator double[]()

static implicit VectSharp.Point.operator double[] ( Point  point)
static

Implicit conversion to an array.

Parameters
pointThe point to convert

Definition at line 192 of file Point.cs.

◆ operator Point() [1/2]

static implicit VectSharp.Point.operator Point ( (double X, double Y tuple)
static

Implicit conversion from a tuple.

Parameters
tupleThe tuple to convert.

Definition at line 201 of file Point.cs.

◆ operator Point() [2/2]

static VectSharp.Point.operator Point ( double[]  array)
explicitstatic

Explicit conversion from an array (will throw an exception if the array does not contain exactly two elements).

Parameters
arrayThe array to convert. It must contain exactly two elements.

Definition at line 210 of file Point.cs.

◆ operator*() [1/2]

static Point VectSharp.Point.operator* ( double  t,
Point  p 
)
static

Multiply the coordinates of a point by a scalar.

Parameters
tThe scalar.
pThe point.
Returns
A new Point whose coordinates are the product of the original points' and the scalar.

Definition at line 252 of file Point.cs.

◆ operator*() [2/2]

static Point VectSharp.Point.operator* ( Point  p,
double  t 
)
static

Multiply the coordinates of a point by a scalar.

Parameters
tThe scalar.
pThe point.
Returns
A new Point whose coordinates are the product of the original points' and the scalar.

Definition at line 263 of file Point.cs.

◆ operator+()

static Point VectSharp.Point.operator+ ( Point  p1,
Point  p2 
)
static

Add the coordinates of two points.

Parameters
p1The first point.
p2The second point.
Returns
A new Point whose coordinates are the sum of the coordinates of the original points.

Definition at line 241 of file Point.cs.

◆ operator-()

static Point VectSharp.Point.operator- ( Point  p1,
Point  p2 
)
static

Subtract the coordinates of two points.

Parameters
p1The first point.
p2The second point.
Returns
A new Point whose coordinates are the difference between the coordinates of the original points.

Definition at line 230 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 36 of file Point.cs.

◆ Y

double VectSharp.Point.Y

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

Definition at line 41 of file Point.cs.

Property Documentation

◆ Count

int VectSharp.Point.Count
get

Definition at line 44 of file Point.cs.

◆ this[int index]

double VectSharp.Point.this[int index]
get

Definition at line 47 of file Point.cs.


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