Table of Contents

Struct XVector

Namespace
PdfSharp.Drawing
Assembly
PdfSharp.dll

Represents a two-dimensional vector specified by x- and y-coordinates. It is a displacement in 2-D space.

public struct XVector : IFormattable
Implements
Inherited Members

Constructors

XVector(double, double)

Initializes a new instance of the XVector struct.

public XVector(double x, double y)

Parameters

x double

The X-offset of the new Vector.

y double

The Y-offset of the new Vector.

Properties

Length

Gets the length of this vector.

public double Length { get; }

Property Value

double

LengthSquared

Gets the square of the length of this vector.

public double LengthSquared { get; }

Property Value

double

X

Gets or sets the X component of this vector.

public double X { get; set; }

Property Value

double

Y

Gets or sets the Y component of this vector.

public double Y { get; set; }

Property Value

double

Methods

Add(XVector, XPoint)

Translates a point by the specified vector and returns the resulting point.

public static XPoint Add(XVector vector, XPoint point)

Parameters

vector XVector

The vector used to translate point.

point XPoint

The point to translate.

Returns

XPoint

Add(XVector, XVector)

Adds two vectors and returns the result as a Vector structure.

public static XVector Add(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to add.

vector2 XVector

The second vector to add.

Returns

XVector

AngleBetween(XVector, XVector)

Retrieves the angle, expressed in degrees, between the two specified vectors.

public static double AngleBetween(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to evaluate.

vector2 XVector

The second vector to evaluate.

Returns

double

CrossProduct(XVector, XVector)

Calculates the cross product of two vectors.

public static double CrossProduct(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to evaluate.

vector2 XVector

The second vector to evaluate.

Returns

double

Determinant(XVector, XVector)

Calculates the determinant of two vectors.

public static double Determinant(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to evaluate.

vector2 XVector

The second vector to evaluate.

Returns

double

Divide(XVector, double)

Divides the specified vector by the specified scalar and returns the result as a Vector.

public static XVector Divide(XVector vector, double scalar)

Parameters

vector XVector

The vector structure to divide.

scalar double

The amount by which vector is divided.

Returns

XVector

Equals(XVector)

Compares two vectors for equality.

public bool Equals(XVector value)

Parameters

value XVector

The vector to compare with this vector.

Returns

bool

Equals(XVector, XVector)

Compares two vectors for equality.

public static bool Equals(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to compare.

vector2 XVector

The second vector to compare.

Returns

bool

Equals(object?)

Determines whether the specified Object is a Vector structure and, if it is, whether it has the same X and Y values as this vector.

public override bool Equals(object? o)

Parameters

o object

The vector to compare.

Returns

bool

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

Multiply(XVector, XMatrix)

Transforms the coordinate space of the specified vector using the specified Matrix.

public static XVector Multiply(XVector vector, XMatrix matrix)

Parameters

vector XVector

The vector to transform.

matrix XMatrix

The transformation to apply to vector.

Returns

XVector

Multiply(XVector, XVector)

Calculates the dot product of the two specified vectors and returns the result as a Double.

public static double Multiply(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to multiply.

vector2 XVector

The second vector structure to multiply.

Returns

double

Multiply(XVector, double)

Multiplies the specified vector by the specified scalar and returns the resulting vector.

public static XVector Multiply(XVector vector, double scalar)

Parameters

vector XVector

The vector to multiply.

scalar double

The scalar to multiply.

Returns

XVector

Multiply(double, XVector)

Multiplies the specified scalar by the specified vector and returns the resulting Vector.

public static XVector Multiply(double scalar, XVector vector)

Parameters

scalar double

The scalar to multiply.

vector XVector

The vector to multiply.

Returns

XVector

Negate()

Negates this vector. The vector has the same magnitude as before, but its direction is now opposite.

public void Negate()

Normalize()

Normalizes this vector.

public void Normalize()

Parse(string)

Converts a string representation of a vector into the equivalent Vector structure.

public static XVector Parse(string source)

Parameters

source string

The string representation of the vector.

Returns

XVector

Subtract(XVector, XVector)

Subtracts the specified vector from another specified vector.

public static XVector Subtract(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The vector from which vector2 is subtracted.

vector2 XVector

The vector to subtract from vector1.

Returns

XVector

ToString()

Returns the string representation of this Vector structure.

public override string ToString()

Returns

string

ToString(IFormatProvider)

Returns the string representation of this Vector structure with the specified formatting information.

public string ToString(IFormatProvider provider)

Parameters

provider IFormatProvider

The culture-specific formatting information.

Returns

string

Operators

operator +(XVector, XPoint)

Translates a point by the specified vector and returns the resulting point.

public static XPoint operator +(XVector vector, XPoint point)

Parameters

vector XVector

The vector used to translate point.

point XPoint

The point to translate.

Returns

XPoint

operator +(XVector, XVector)

Adds two vectors and returns the result as a vector.

public static XVector operator +(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to add.

vector2 XVector

The second vector to add.

Returns

XVector

operator /(XVector, double)

Divides the specified vector by the specified scalar and returns the resulting vector.

public static XVector operator /(XVector vector, double scalar)

Parameters

vector XVector

The vector to divide.

scalar double

The scalar by which vector will be divided.

Returns

XVector

operator ==(XVector, XVector)

Compares two vectors for equality.

public static bool operator ==(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to compare.

vector2 XVector

The second vector to compare.

Returns

bool

explicit operator XPoint(XVector)

Creates a Point with the X and Y values of this vector.

public static explicit operator XPoint(XVector vector)

Parameters

vector XVector

The vector to convert.

Returns

XPoint

explicit operator XSize(XVector)

Creates a Size from the offsets of this vector.

public static explicit operator XSize(XVector vector)

Parameters

vector XVector

The vector to convert.

Returns

XSize

operator !=(XVector, XVector)

Compares two vectors for inequality.

public static bool operator !=(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to compare.

vector2 XVector

The second vector to compare.

Returns

bool

operator *(XVector, XMatrix)

Transforms the coordinate space of the specified vector using the specified Matrix.

public static XVector operator *(XVector vector, XMatrix matrix)

Parameters

vector XVector

The vector to transform.

matrix XMatrix

The transformation to apply to vector.

Returns

XVector

operator *(XVector, XVector)

Calculates the dot product of the two specified vector structures and returns the result as a Double.

public static double operator *(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The first vector to multiply.

vector2 XVector

The second vector to multiply.

Returns

double

operator *(XVector, double)

Multiplies the specified vector by the specified scalar and returns the resulting vector.

public static XVector operator *(XVector vector, double scalar)

Parameters

vector XVector

The vector to multiply.

scalar double

The scalar to multiply.

Returns

XVector

operator *(double, XVector)

Multiplies the specified scalar by the specified vector and returns the resulting vector.

public static XVector operator *(double scalar, XVector vector)

Parameters

scalar double

The scalar to multiply.

vector XVector

The vector to multiply.

Returns

XVector

operator -(XVector, XVector)

Subtracts one specified vector from another.

public static XVector operator -(XVector vector1, XVector vector2)

Parameters

vector1 XVector

The vector from which vector2 is subtracted.

vector2 XVector

The vector to subtract from vector1.

Returns

XVector

operator -(XVector)

Negates the specified vector.

public static XVector operator -(XVector vector)

Parameters

vector XVector

The vector to negate.

Returns

XVector