Table of Contents

Struct MagneticFieldVector2

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

A 2D vector whose components represent a magnetic field, each expressed as a UnitsNet.MagneticField (e.g. tesla).

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

Examples

var field = new MagneticFieldVector2(MagneticField.FromTeslas(0.5), MagneticField.Zero);

Constructors

MagneticFieldVector2(MagneticField, MagneticField)

Constructs a MagneticFieldVector2 from two UnitsNet.MagneticField components.

public MagneticFieldVector2(MagneticField x, MagneticField y)

Parameters

x MagneticField

The X component.

y MagneticField

The Y component.

Properties

Magnitude

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

public MagneticField Magnitude { get; }

Property Value

MagneticField

X

The X component.

public MagneticField X { get; }

Property Value

MagneticField

Y

The Y component.

public MagneticField Y { get; }

Property Value

MagneticField

Zero

A MagneticFieldVector2 with both components set to zero.

public static MagneticFieldVector2 Zero { get; }

Property Value

MagneticFieldVector2

Methods

Abs()

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

public MagneticFieldVector2 Abs()

Returns

MagneticFieldVector2

A MagneticFieldVector2 with non-negative components.

Add(MagneticFieldVector2)

Adds two vectors component-wise.

public MagneticFieldVector2 Add(MagneticFieldVector2 other)

Parameters

other MagneticFieldVector2

The vector to add.

Returns

MagneticFieldVector2

The component-wise sum.

ApproximatelyEquals(MagneticFieldVector2, MagneticField)

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

public bool ApproximatelyEquals(MagneticFieldVector2 other, MagneticField tolerance)

Parameters

other MagneticFieldVector2

The vector to compare against.

tolerance MagneticField

The maximum allowed difference per component (inclusive).

Returns

bool

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

As(MagneticFieldUnit)

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

public DoubleVector2 As(MagneticFieldUnit unit)

Parameters

unit MagneticFieldUnit

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(MagneticFieldVector2, MagneticFieldVector2)

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

public MagneticFieldVector2 Clamp(MagneticFieldVector2 min, MagneticFieldVector2 max)

Parameters

min MagneticFieldVector2

The lower bound vector (inclusive, per component).

max MagneticFieldVector2

The upper bound vector (inclusive, per component).

Returns

MagneticFieldVector2

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

Divide(double)

Divides the vector by a scalar divisor.

public MagneticFieldVector2 Divide(double scalar)

Parameters

scalar double

The scalar divisor.

Returns

MagneticFieldVector2

The divided vector.

Equals(MagneticFieldVector2)

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

public bool Equals(MagneticFieldVector2 other)

Parameters

other MagneticFieldVector2

An object to compare with this object.

Returns

bool

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

FromGausses(double, double)

Creates a MagneticFieldVector2 with both components created via UnitsNet.MagneticField.FromGausses(UnitsNet.QuantityValue).

public static MagneticFieldVector2 FromGausses(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

MagneticFieldVector2

A MagneticFieldVector2 with both components in the corresponding unit.

FromMicroteslas(double, double)

Creates a MagneticFieldVector2 with both components created via UnitsNet.MagneticField.FromMicroteslas(UnitsNet.QuantityValue).

public static MagneticFieldVector2 FromMicroteslas(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

MagneticFieldVector2

A MagneticFieldVector2 with both components in the corresponding unit.

FromMilligausses(double, double)

Creates a MagneticFieldVector2 with both components created via UnitsNet.MagneticField.FromMilligausses(UnitsNet.QuantityValue).

public static MagneticFieldVector2 FromMilligausses(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

MagneticFieldVector2

A MagneticFieldVector2 with both components in the corresponding unit.

FromMilliteslas(double, double)

Creates a MagneticFieldVector2 with both components created via UnitsNet.MagneticField.FromMilliteslas(UnitsNet.QuantityValue).

public static MagneticFieldVector2 FromMilliteslas(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

MagneticFieldVector2

A MagneticFieldVector2 with both components in the corresponding unit.

FromNanoteslas(double, double)

Creates a MagneticFieldVector2 with both components created via UnitsNet.MagneticField.FromNanoteslas(UnitsNet.QuantityValue).

public static MagneticFieldVector2 FromNanoteslas(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

MagneticFieldVector2

A MagneticFieldVector2 with both components in the corresponding unit.

FromTeslas(double, double)

Creates a MagneticFieldVector2 with both components created via UnitsNet.MagneticField.FromTeslas(UnitsNet.QuantityValue).

public static MagneticFieldVector2 FromTeslas(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

MagneticFieldVector2

A MagneticFieldVector2 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(MagneticFieldVector2, MagneticFieldVector2, 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(MagneticFieldVector2, MagneticFieldVector2, double) if you need the result bounded to the segment between a and b.

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

Parameters

a MagneticFieldVector2

The start vector (t = 0).

b MagneticFieldVector2

The end vector (t = 1).

t double

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

Returns

MagneticFieldVector2

The interpolated MagneticFieldVector2.

LerpClamped(MagneticFieldVector2, MagneticFieldVector2, double)

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

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

Parameters

a MagneticFieldVector2

The start vector (t = 0).

b MagneticFieldVector2

The end vector (t = 1).

t double

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

Returns

MagneticFieldVector2

The interpolated MagneticFieldVector2, always between a and b.

Multiply(double)

Scales the vector by a scalar factor.

public MagneticFieldVector2 Multiply(double scalar)

Parameters

scalar double

The scalar factor.

Returns

MagneticFieldVector2

The scaled vector.

Negate()

Negates both components.

public MagneticFieldVector2 Negate()

Returns

MagneticFieldVector2

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(MagneticFieldVector2)

Subtracts two vectors component-wise.

public MagneticFieldVector2 Subtract(MagneticFieldVector2 other)

Parameters

other MagneticFieldVector2

The vector to subtract.

Returns

MagneticFieldVector2

The component-wise difference.

Operators

operator +(MagneticFieldVector2, MagneticFieldVector2)

Adds two vectors component-wise.

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

Parameters

left MagneticFieldVector2

The left operand.

right MagneticFieldVector2

The right operand.

Returns

MagneticFieldVector2

The component-wise sum.

operator /(MagneticFieldVector2, double)

Divides the vector by a scalar divisor.

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

Parameters

left MagneticFieldVector2

The vector to divide.

scalar double

The scalar divisor.

Returns

MagneticFieldVector2

The divided vector.

operator *(double, MagneticFieldVector2)

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

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

Parameters

scalar double

The scalar factor.

right MagneticFieldVector2

The vector to scale.

Returns

MagneticFieldVector2

The scaled vector.

operator *(MagneticFieldVector2, double)

Scales the vector by a scalar factor.

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

Parameters

left MagneticFieldVector2

The vector to scale.

scalar double

The scalar factor.

Returns

MagneticFieldVector2

The scaled vector.

operator -(MagneticFieldVector2, MagneticFieldVector2)

Subtracts two vectors component-wise.

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

Parameters

left MagneticFieldVector2

The left operand.

right MagneticFieldVector2

The right operand.

Returns

MagneticFieldVector2

The component-wise difference.

operator -(MagneticFieldVector2)

Negates both components.

public static MagneticFieldVector2 operator -(MagneticFieldVector2 value)

Parameters

value MagneticFieldVector2

The vector to negate.

Returns

MagneticFieldVector2

A vector with all components negated.

v0.7.0 ▼