Struct MagneticFieldVector3
A 3D vector whose components represent magneticfield, each expressed as a UnitsNet.MagneticField.
public readonly record struct MagneticFieldVector3 : IEquatable<MagneticFieldVector3>
- Implements
- Inherited Members
- Extension Methods
Constructors
MagneticFieldVector3(MagneticField, MagneticField, MagneticField)
Constructs a MagneticFieldVector3 from three UnitsNet.MagneticField components.
public MagneticFieldVector3(MagneticField x, MagneticField y, MagneticField z)
Parameters
xMagneticFieldThe X component.
yMagneticFieldThe Y component.
zMagneticFieldThe Z 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
Z
The Z component.
public MagneticField Z { get; }
Property Value
- MagneticField
Zero
A MagneticFieldVector3 with all components set to zero.
public static MagneticFieldVector3 Zero { get; }
Property Value
Methods
Abs()
Returns a vector with each component replaced by its absolute value.
public MagneticFieldVector3 Abs()
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with non-negative components.
Add(MagneticFieldVector3)
Adds two vectors component-wise.
public MagneticFieldVector3 Add(MagneticFieldVector3 other)
Parameters
otherMagneticFieldVector3The vector to add.
Returns
- MagneticFieldVector3
The component-wise sum.
ApproximatelyEquals(MagneticFieldVector3, MagneticField)
Returns true if each component of this vector is within
tolerance of the corresponding component of other.
public bool ApproximatelyEquals(MagneticFieldVector3 other, MagneticField tolerance)
Parameters
otherMagneticFieldVector3The vector to compare against.
toleranceMagneticFieldThe maximum allowed difference per component (inclusive).
Returns
- bool
true when |X - other.X| <= tolerance, |Y - other.Y| <= tolerance, and |Z - other.Z| <= tolerance.
As(MagneticFieldUnit)
Projects all three components into the requested unit, returning a unit-less DoubleVector3.
public DoubleVector3 As(MagneticFieldUnit unit)
Parameters
unitMagneticFieldUnitThe target unit for each component.
Returns
- DoubleVector3
A DoubleVector3 with components expressed in
unit.
AsDefault()
Returns all three components expressed in the SI base unit as a DoubleVector3.
public DoubleVector3 AsDefault()
Returns
- DoubleVector3
A DoubleVector3 with components in the default SI unit.
Clamp(MagneticFieldVector3, MagneticFieldVector3)
Returns a vector with each component clamped to the range [min, max].
public MagneticFieldVector3 Clamp(MagneticFieldVector3 min, MagneticFieldVector3 max)
Parameters
minMagneticFieldVector3The lower bound vector (inclusive, per component).
maxMagneticFieldVector3The upper bound vector (inclusive, per component).
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with each component in [min, max].
Divide(double)
Divides the vector by a scalar divisor.
public MagneticFieldVector3 Divide(double scalar)
Parameters
scalardoubleThe scalar divisor.
Returns
- MagneticFieldVector3
The divided vector.
Equals(MagneticFieldVector3)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(MagneticFieldVector3 other)
Parameters
otherMagneticFieldVector3An object to compare with this object.
Returns
FromGausses(double, double, double)
Creates a MagneticFieldVector3 with all components created via UnitsNet.MagneticField.FromGausses(UnitsNet.QuantityValue).
public static MagneticFieldVector3 FromGausses(double x, double y, double z)
Parameters
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with all components in the corresponding unit.
FromMicroteslas(double, double, double)
Creates a MagneticFieldVector3 with all components created via UnitsNet.MagneticField.FromMicroteslas(UnitsNet.QuantityValue).
public static MagneticFieldVector3 FromMicroteslas(double x, double y, double z)
Parameters
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with all components in the corresponding unit.
FromMilligausses(double, double, double)
Creates a MagneticFieldVector3 with all components created via UnitsNet.MagneticField.FromMilligausses(UnitsNet.QuantityValue).
public static MagneticFieldVector3 FromMilligausses(double x, double y, double z)
Parameters
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with all components in the corresponding unit.
FromMilliteslas(double, double, double)
Creates a MagneticFieldVector3 with all components created via UnitsNet.MagneticField.FromMilliteslas(UnitsNet.QuantityValue).
public static MagneticFieldVector3 FromMilliteslas(double x, double y, double z)
Parameters
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with all components in the corresponding unit.
FromNanoteslas(double, double, double)
Creates a MagneticFieldVector3 with all components created via UnitsNet.MagneticField.FromNanoteslas(UnitsNet.QuantityValue).
public static MagneticFieldVector3 FromNanoteslas(double x, double y, double z)
Parameters
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with all components in the corresponding unit.
FromTeslas(double, double, double)
Creates a MagneticFieldVector3 with all components created via UnitsNet.MagneticField.FromTeslas(UnitsNet.QuantityValue).
public static MagneticFieldVector3 FromTeslas(double x, double y, double z)
Parameters
Returns
- MagneticFieldVector3
A MagneticFieldVector3 with all 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(MagneticFieldVector3, MagneticFieldVector3, 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(MagneticFieldVector3, MagneticFieldVector3, double) if you need the result bounded to the segment
between a and b.
public static MagneticFieldVector3 Lerp(MagneticFieldVector3 a, MagneticFieldVector3 b, double t)
Parameters
aMagneticFieldVector3The start vector (
t= 0).bMagneticFieldVector3The end vector (
t= 1).tdoubleThe interpolation parameter. Values outside [0, 1] extrapolate.
Returns
- MagneticFieldVector3
The interpolated MagneticFieldVector3.
LerpClamped(MagneticFieldVector3, MagneticFieldVector3, double)
Linearly interpolates between two vectors, with t clamped to [0, 1].
public static MagneticFieldVector3 LerpClamped(MagneticFieldVector3 a, MagneticFieldVector3 b, double t)
Parameters
aMagneticFieldVector3The start vector (
t= 0).bMagneticFieldVector3The end vector (
t= 1).tdoubleThe interpolation parameter, clamped to [0, 1].
Returns
- MagneticFieldVector3
The interpolated MagneticFieldVector3, always between
aandb.
Multiply(double)
Scales the vector by a scalar factor.
public MagneticFieldVector3 Multiply(double scalar)
Parameters
scalardoubleThe scalar factor.
Returns
- MagneticFieldVector3
The scaled vector.
Negate()
Negates all components.
public MagneticFieldVector3 Negate()
Returns
- MagneticFieldVector3
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 DoubleVector3 Normalize()
Returns
- DoubleVector3
A unit-length DoubleVector3 in the same direction.
Subtract(MagneticFieldVector3)
Subtracts two vectors component-wise.
public MagneticFieldVector3 Subtract(MagneticFieldVector3 other)
Parameters
otherMagneticFieldVector3The vector to subtract.
Returns
- MagneticFieldVector3
The component-wise difference.
Operators
operator +(MagneticFieldVector3, MagneticFieldVector3)
Adds two vectors component-wise.
public static MagneticFieldVector3 operator +(MagneticFieldVector3 left, MagneticFieldVector3 right)
Parameters
leftMagneticFieldVector3The left operand.
rightMagneticFieldVector3The right operand.
Returns
- MagneticFieldVector3
The component-wise sum.
operator /(MagneticFieldVector3, double)
Divides the vector by a scalar divisor.
public static MagneticFieldVector3 operator /(MagneticFieldVector3 left, double scalar)
Parameters
leftMagneticFieldVector3The vector to divide.
scalardoubleThe scalar divisor.
Returns
- MagneticFieldVector3
The divided vector.
operator *(double, MagneticFieldVector3)
Scales the vector by a scalar factor. Operands may be supplied in either order.
public static MagneticFieldVector3 operator *(double scalar, MagneticFieldVector3 right)
Parameters
scalardoubleThe scalar factor.
rightMagneticFieldVector3The vector to scale.
Returns
- MagneticFieldVector3
The scaled vector.
operator *(MagneticFieldVector3, double)
Scales the vector by a scalar factor.
public static MagneticFieldVector3 operator *(MagneticFieldVector3 left, double scalar)
Parameters
leftMagneticFieldVector3The vector to scale.
scalardoubleThe scalar factor.
Returns
- MagneticFieldVector3
The scaled vector.
operator -(MagneticFieldVector3, MagneticFieldVector3)
Subtracts two vectors component-wise.
public static MagneticFieldVector3 operator -(MagneticFieldVector3 left, MagneticFieldVector3 right)
Parameters
leftMagneticFieldVector3The left operand.
rightMagneticFieldVector3The right operand.
Returns
- MagneticFieldVector3
The component-wise difference.
operator -(MagneticFieldVector3)
Negates all components.
public static MagneticFieldVector3 operator -(MagneticFieldVector3 value)
Parameters
valueMagneticFieldVector3The vector to negate.
Returns
- MagneticFieldVector3
A vector with all components negated.