Table of Contents

Struct LinearDensityVector2

Namespace
Thunder.UnitsNET.Vectors
Assembly
Thunder.UnitsNET.Vectors.dll

A 2D vector whose components represent linear density, each expressed as a UnitsNet.LinearDensity (e.g. kilograms per metre).

public readonly record struct LinearDensityVector2 : IEquatable<LinearDensityVector2>
Implements
Inherited Members
Extension Methods

Examples

var ld = new LinearDensityVector2(LinearDensity.FromKilogramsPerMeter(2), LinearDensity.Zero);

Constructors

LinearDensityVector2(LinearDensity, LinearDensity)

Constructs a LinearDensityVector2 from two UnitsNet.LinearDensity components.

public LinearDensityVector2(LinearDensity x, LinearDensity y)

Parameters

x LinearDensity

The X component.

y LinearDensity

The Y component.

Properties

Magnitude

Returns the Euclidean magnitude of this vector as a UnitsNet.LinearDensity. The result is expressed in the same unit as the X component.

public LinearDensity Magnitude { get; }

Property Value

LinearDensity

X

The X component.

public LinearDensity X { get; }

Property Value

LinearDensity

Y

The Y component.

public LinearDensity Y { get; }

Property Value

LinearDensity

Zero

A LinearDensityVector2 with both components set to zero.

public static LinearDensityVector2 Zero { get; }

Property Value

LinearDensityVector2

Methods

Abs()

Returns a vector with each component replaced by its absolute value.

public LinearDensityVector2 Abs()

Returns

LinearDensityVector2

A LinearDensityVector2 with non-negative components.

Add(LinearDensityVector2)

Adds two vectors component-wise.

public LinearDensityVector2 Add(LinearDensityVector2 other)

Parameters

other LinearDensityVector2

The vector to add.

Returns

LinearDensityVector2

The component-wise sum.

ApproximatelyEquals(LinearDensityVector2, LinearDensity)

Returns true if each component of this vector is within tolerance of the corresponding component of other.

public bool ApproximatelyEquals(LinearDensityVector2 other, LinearDensity tolerance)

Parameters

other LinearDensityVector2

The vector to compare against.

tolerance LinearDensity

The maximum allowed difference per component (inclusive).

Returns

bool

true when |X - other.X| <= tolerance and |Y - other.Y| <= tolerance.

As(LinearDensityUnit)

Projects both components into the requested unit, returning a unit-less DoubleVector2.

public DoubleVector2 As(LinearDensityUnit unit)

Parameters

unit LinearDensityUnit

The target unit for each component.

Returns

DoubleVector2

A DoubleVector2 with components expressed in unit.

AsDefault()

Returns both components expressed in the SI base unit as a DoubleVector2.

public DoubleVector2 AsDefault()

Returns

DoubleVector2

A DoubleVector2 with components in the default SI unit.

Clamp(LinearDensityVector2, LinearDensityVector2)

Returns a vector with each component clamped to the range [min, max].

public LinearDensityVector2 Clamp(LinearDensityVector2 min, LinearDensityVector2 max)

Parameters

min LinearDensityVector2

The lower bound vector (inclusive, per component).

max LinearDensityVector2

The upper bound vector (inclusive, per component).

Returns

LinearDensityVector2

A LinearDensityVector2 with each component in [min, max].

Divide(double)

Divides the vector by a scalar divisor.

public LinearDensityVector2 Divide(double scalar)

Parameters

scalar double

The scalar divisor.

Returns

LinearDensityVector2

The divided vector.

Equals(LinearDensityVector2)

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

public bool Equals(LinearDensityVector2 other)

Parameters

other LinearDensityVector2

An object to compare with this object.

Returns

bool

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

FromGramsPerCentimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromGramsPerCentimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromGramsPerCentimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromGramsPerFoot(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromGramsPerFoot(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromGramsPerFoot(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromGramsPerMeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromGramsPerMeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromGramsPerMeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromGramsPerMillimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromGramsPerMillimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromGramsPerMillimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromKilogramsPerCentimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromKilogramsPerCentimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromKilogramsPerCentimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromKilogramsPerFoot(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromKilogramsPerFoot(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromKilogramsPerFoot(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromKilogramsPerMeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromKilogramsPerMeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromKilogramsPerMeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromKilogramsPerMillimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromKilogramsPerMillimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromKilogramsPerMillimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMicrogramsPerCentimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMicrogramsPerCentimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMicrogramsPerCentimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMicrogramsPerFoot(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMicrogramsPerFoot(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMicrogramsPerFoot(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMicrogramsPerMeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMicrogramsPerMeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMicrogramsPerMeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMicrogramsPerMillimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMicrogramsPerMillimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMicrogramsPerMillimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMilligramsPerCentimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMilligramsPerCentimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMilligramsPerCentimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMilligramsPerFoot(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMilligramsPerFoot(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMilligramsPerFoot(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMilligramsPerMeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMilligramsPerMeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMilligramsPerMeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromMilligramsPerMillimeter(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromMilligramsPerMillimeter(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromMilligramsPerMillimeter(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromPoundsPerFoot(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromPoundsPerFoot(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromPoundsPerFoot(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

FromPoundsPerInch(double, double)

Creates a LinearDensityVector2 with both components created via UnitsNet.LinearDensity.FromPoundsPerInch(UnitsNet.QuantityValue).

public static LinearDensityVector2 FromPoundsPerInch(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

LinearDensityVector2

A LinearDensityVector2 with both components in the corresponding unit.

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.

Lerp(LinearDensityVector2, LinearDensityVector2, double)

Linearly interpolates between two vectors.

The result at t = 0 is a; at t = 1 it is b. Values of t outside [0, 1] extrapolate beyond the endpoints — use LerpClamped(LinearDensityVector2, LinearDensityVector2, double) if you need the result bounded to the segment between a and b.

public static LinearDensityVector2 Lerp(LinearDensityVector2 a, LinearDensityVector2 b, double t)

Parameters

a LinearDensityVector2

The start vector (t = 0).

b LinearDensityVector2

The end vector (t = 1).

t double

The interpolation parameter. Values outside [0, 1] extrapolate.

Returns

LinearDensityVector2

The interpolated LinearDensityVector2.

LerpClamped(LinearDensityVector2, LinearDensityVector2, double)

Linearly interpolates between two vectors, with t clamped to [0, 1].

public static LinearDensityVector2 LerpClamped(LinearDensityVector2 a, LinearDensityVector2 b, double t)

Parameters

a LinearDensityVector2

The start vector (t = 0).

b LinearDensityVector2

The end vector (t = 1).

t double

The interpolation parameter, clamped to [0, 1].

Returns

LinearDensityVector2

The interpolated LinearDensityVector2, always between a and b.

Multiply(double)

Scales the vector by a scalar factor.

public LinearDensityVector2 Multiply(double scalar)

Parameters

scalar double

The scalar factor.

Returns

LinearDensityVector2

The scaled vector.

Negate()

Negates both components.

public LinearDensityVector2 Negate()

Returns

LinearDensityVector2

A vector with all components negated.

Normalize()

Returns a dimensionless unit vector pointing in the same direction. For a zero vector, Zero is returned.

public DoubleVector2 Normalize()

Returns

DoubleVector2

A unit-length DoubleVector2 in the same direction.

Subtract(LinearDensityVector2)

Subtracts two vectors component-wise.

public LinearDensityVector2 Subtract(LinearDensityVector2 other)

Parameters

other LinearDensityVector2

The vector to subtract.

Returns

LinearDensityVector2

The component-wise difference.

Operators

operator +(LinearDensityVector2, LinearDensityVector2)

Adds two vectors component-wise.

public static LinearDensityVector2 operator +(LinearDensityVector2 left, LinearDensityVector2 right)

Parameters

left LinearDensityVector2

The left operand.

right LinearDensityVector2

The right operand.

Returns

LinearDensityVector2

The component-wise sum.

operator /(LinearDensityVector2, double)

Divides the vector by a scalar divisor.

public static LinearDensityVector2 operator /(LinearDensityVector2 left, double scalar)

Parameters

left LinearDensityVector2

The vector to divide.

scalar double

The scalar divisor.

Returns

LinearDensityVector2

The divided vector.

operator *(double, LinearDensityVector2)

Scales the vector by a scalar factor. Operands may be supplied in either order.

public static LinearDensityVector2 operator *(double scalar, LinearDensityVector2 right)

Parameters

scalar double

The scalar factor.

right LinearDensityVector2

The vector to scale.

Returns

LinearDensityVector2

The scaled vector.

operator *(LinearDensityVector2, double)

Scales the vector by a scalar factor.

public static LinearDensityVector2 operator *(LinearDensityVector2 left, double scalar)

Parameters

left LinearDensityVector2

The vector to scale.

scalar double

The scalar factor.

Returns

LinearDensityVector2

The scaled vector.

operator -(LinearDensityVector2, LinearDensityVector2)

Subtracts two vectors component-wise.

public static LinearDensityVector2 operator -(LinearDensityVector2 left, LinearDensityVector2 right)

Parameters

left LinearDensityVector2

The left operand.

right LinearDensityVector2

The right operand.

Returns

LinearDensityVector2

The component-wise difference.

operator -(LinearDensityVector2)

Negates both components.

public static LinearDensityVector2 operator -(LinearDensityVector2 value)

Parameters

value LinearDensityVector2

The vector to negate.

Returns

LinearDensityVector2

A vector with all components negated.

latest ▼