Struct Vertex
- Namespace
- SixLabors.PolygonClipper
- Assembly
- SixLabors.PolygonClipper.dll
Represents a two-dimensional vertex with X and Y coordinates.
public readonly struct Vertex : IEquatable<Vertex>
- Implements
- Inherited Members
Constructors
Vertex(double)
Initializes a new instance of the Vertex struct.
public Vertex(double xy)
Parameters
xydoubleThe X and Y coordinates of the vertex.
Vertex(double, double)
Initializes a new instance of the Vertex struct.
public Vertex(double x, double y)
Parameters
Fields
X
Gets the X-coordinate of the vertex.
public readonly double X
Field Value
Y
Gets the Y-coordinate of the vertex.
public readonly double Y
Field Value
Methods
Abs(in Vertex)
Computes the absolute value of each element in a specified vertex.
public static Vertex Abs(in Vertex value)
Parameters
valueVertexThe vertex that will have its absolute value computed.
Returns
- Vertex
A vertex with the absolute value of each of the elements in
value.
Cross(in Vertex, in Vertex)
Returns the cross product of two vertices.
public static double Cross(in Vertex a, in Vertex b)
Parameters
Returns
Distance(in Vertex, in Vertex)
Computes the Euclidean distance between the two given vertices.
public static double Distance(in Vertex a, in Vertex b)
Parameters
Returns
- double
The distance.
DistanceSquared(in Vertex, in Vertex)
Returns the Euclidean distance squared between two specified vertices.
public static double DistanceSquared(in Vertex a, in Vertex b)
Parameters
Returns
- double
The distance squared.
Dot(in Vertex, in Vertex)
Returns the dot product of two vertices.
public static double Dot(in Vertex a, in Vertex b)
Parameters
Returns
Equals(Vertex)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Vertex other)
Parameters
otherVertexAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Length()
Returns the length of the vertex.
public double Length()
Returns
- double
The vertex's length.
LengthSquared()
Returns the length of the vertex squared.
public double LengthSquared()
Returns
- double
The vertex's length squared.
Remarks
This operation offers better performance than a call to the Length() method.
Max(in Vertex, in Vertex)
Returns a vertex whose elements are the maximum of each of the pairs of elements in two specified vertices.
public static Vertex Max(in Vertex a, in Vertex b)
Parameters
Returns
Min(in Vertex, in Vertex)
Returns a vertex whose elements are the minimum of each of the pairs of elements in two specified vertices.
public static Vertex Min(in Vertex a, in Vertex b)
Parameters
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator +(in Vertex, in Vertex)
Adds two vectors together.
public static Vertex operator +(in Vertex left, in Vertex right)
Parameters
Returns
- Vertex
The summed vector.
Remarks
The operator +(in Vertex, in Vertex) method defines the addition operation for Vector2 objects.
operator /(in Vertex, in Vertex)
Divides the first vertex by the second.
public static Vertex operator /(in Vertex left, in Vertex right)
Parameters
Returns
- Vertex
The vertex that results from dividing
leftbyright.
operator /(in Vertex, double)
Divides the specified vertex by a specified scalar value.
public static Vertex operator /(in Vertex left, double right)
Parameters
Returns
- Vertex
The result of the division.
operator /(double, in Vertex)
Divides the specified vertex by the specified scalar value.
public static Vertex operator /(double left, in Vertex right)
Parameters
Returns
- Vertex
The result of the division.
operator ==(in Vertex, in Vertex)
Determines whether two vertices are equal.
public static bool operator ==(in Vertex left, in Vertex right)
Parameters
Returns
operator !=(in Vertex, in Vertex)
Determines whether two vertices are not equal.
public static bool operator !=(in Vertex left, in Vertex right)
Parameters
Returns
operator *(in Vertex, in Vertex)
Returns a new vector whose values are the product of each pair of elements in two specified vertices.
public static Vertex operator *(in Vertex left, in Vertex right)
Parameters
Returns
- Vertex
The element-wise product vertex.
operator *(in Vertex, double)
Multiplies the specified vertex by the specified scalar value.
public static Vertex operator *(in Vertex left, double right)
Parameters
Returns
- Vertex
The scaled vertex.
operator *(double, in Vertex)
Multiplies the specified vertex by the specified scalar value.
public static Vertex operator *(double left, in Vertex right)
Parameters
Returns
- Vertex
The scaled vertex.
operator -(in Vertex, in Vertex)
Subtracts the second vector from the first.
public static Vertex operator -(in Vertex left, in Vertex right)
Parameters
Returns
- Vertex
The vector that results from subtracting
rightfromleft.
Remarks
The operator -(in Vertex, in Vertex) method defines the subtraction operation for Vector2 objects.