Table of Contents

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

xy double

The 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

x double

The X-coordinate of the vertex.

y double

The Y-coordinate of the vertex.

Fields

X

Gets the X-coordinate of the vertex.

public readonly double X

Field Value

double

Y

Gets the Y-coordinate of the vertex.

public readonly double Y

Field Value

double

Methods

Abs(in Vertex)

Computes the absolute value of each element in a specified vertex.

public static Vertex Abs(in Vertex value)

Parameters

value Vertex

The 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

a Vertex

The first vertex.

b Vertex

The second vertex.

Returns

double

The double cross product.

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

a Vertex

The first vertex.

b Vertex

The second vertex.

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

a Vertex

The first vertex.

b Vertex

The second vertex.

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

a Vertex

The first vertex.

b Vertex

The second vertex.

Returns

double

The double dot product.

Equals(Vertex)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Vertex other)

Parameters

other Vertex

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

a Vertex

The first vertex.

b Vertex

The second vertex.

Returns

Vertex

The maximized Vertex.

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

a Vertex

The first vertex.

b Vertex

The second vertex.

Returns

Vertex

The minimized Vertex.

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

left Vertex

The first vector to add.

right Vertex

The second vector to add.

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

left Vertex

The first vertex.

right Vertex

The second vertex.

Returns

Vertex

The vertex that results from dividing left by right.

operator /(in Vertex, double)

Divides the specified vertex by a specified scalar value.

public static Vertex operator /(in Vertex left, double right)

Parameters

left Vertex

The first vertex.

right double

The scalar value.

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

left double

The first vertex.

right Vertex

The scalar value.

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

left Vertex

The first vertex.

right Vertex

The second vertex.

Returns

bool

true if the vertices are equal; otherwise, false.

operator !=(in Vertex, in Vertex)

Determines whether two vertices are not equal.

public static bool operator !=(in Vertex left, in Vertex right)

Parameters

left Vertex

The first vertex.

right Vertex

The second vertex.

Returns

bool

true if the vertices are not equal; otherwise, false.

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

left Vertex

The first vertex.

right Vertex

The second vertex.

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

left Vertex

The first vertex.

right double

The scalar value.

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

left double

The first vertex.

right Vertex

The scalar value.

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

left Vertex

The first vector.

right Vertex

The second vector.

Returns

Vertex

The vector that results from subtracting right from left.

Remarks

The operator -(in Vertex, in Vertex) method defines the subtraction operation for Vector2 objects.