Struct AreaVector2
A 2D vector whose components represent area, each expressed as an UnitsNet.Area (e.g. square metres, square feet).
This type arises from operations such as the dot product of two LengthVector2 instances — it carries units-squared rather than a plain double, preserving dimensional safety across the calculation.
public readonly record struct AreaVector2 : IEquatable<AreaVector2>
- Implements
- Inherited Members
Examples
// Dot product of two displacement vectors gives an area
var a = LengthVector2.FromMeters(3, 0);
var b = LengthVector2.FromMeters(0, 4);
Area dot = a.Dot(b); // 0 m²
Constructors
AreaVector2(Area, Area)
Constructs a AreaVector2 from two UnitsNet.Area components.
public AreaVector2(Area x, Area y)
Parameters
xAreaThe X component.
yAreaThe Y component.
Properties
Magnitude
Returns the Euclidean magnitude of this vector as a UnitsNet.Area. The result is expressed in the same unit as the X component.
public Area Magnitude { get; }
Property Value
- Area
X
The X component.
public Area X { get; }
Property Value
- Area
Y
The Y component.
public Area Y { get; }
Property Value
- Area
Zero
A AreaVector2 with both components set to zero.
public static AreaVector2 Zero { get; }
Property Value
Methods
Abs()
Returns a vector with each component replaced by its absolute value.
public AreaVector2 Abs()
Returns
- AreaVector2
A AreaVector2 with non-negative components.
Add(AreaVector2)
Adds two vectors component-wise.
public AreaVector2 Add(AreaVector2 other)
Parameters
otherAreaVector2The vector to add.
Returns
- AreaVector2
The component-wise sum.
ApproximatelyEquals(AreaVector2, Area)
Returns true if each component of this vector is within
tolerance of the corresponding component of other.
public bool ApproximatelyEquals(AreaVector2 other, Area tolerance)
Parameters
otherAreaVector2The vector to compare against.
toleranceAreaThe maximum allowed difference per component (inclusive).
Returns
As(AreaUnit)
Projects both components into the requested unit, returning a unit-less DoubleVector2.
public DoubleVector2 As(AreaUnit unit)
Parameters
unitAreaUnitThe 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(AreaVector2, AreaVector2)
Returns a vector with each component clamped to the range [min, max].
public AreaVector2 Clamp(AreaVector2 min, AreaVector2 max)
Parameters
minAreaVector2The lower bound vector (inclusive, per component).
maxAreaVector2The upper bound vector (inclusive, per component).
Returns
- AreaVector2
A AreaVector2 with each component in [min, max].
Divide(double)
Divides the vector by a scalar divisor.
public AreaVector2 Divide(double scalar)
Parameters
scalardoubleThe scalar divisor.
Returns
- AreaVector2
The divided vector.
Equals(AreaVector2)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(AreaVector2 other)
Parameters
otherAreaVector2An object to compare with this object.
Returns
FromAcres(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromAcres(UnitsNet.QuantityValue).
public static AreaVector2 FromAcres(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromHectares(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromHectares(UnitsNet.QuantityValue).
public static AreaVector2 FromHectares(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareCentimeters(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareCentimeters(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareCentimeters(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareDecimeters(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareDecimeters(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareDecimeters(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareFeet(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareFeet(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareFeet(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareInches(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareInches(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareInches(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareKilometers(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareKilometers(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareKilometers(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareMeters(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareMeters(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareMeters(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareMicrometers(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareMicrometers(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareMicrometers(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareMiles(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareMiles(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareMiles(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareMillimeters(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareMillimeters(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareMillimeters(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareNauticalMiles(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareNauticalMiles(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareNauticalMiles(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromSquareYards(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromSquareYards(UnitsNet.QuantityValue).
public static AreaVector2 FromSquareYards(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 with both components in the corresponding unit.
FromUsSurveySquareFeet(double, double)
Creates a AreaVector2 with both components created via UnitsNet.Area.FromUsSurveySquareFeet(UnitsNet.QuantityValue).
public static AreaVector2 FromUsSurveySquareFeet(double x, double y)
Parameters
Returns
- AreaVector2
A AreaVector2 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(AreaVector2, AreaVector2, 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(AreaVector2, AreaVector2, double) if you need the result bounded to the segment
between a and b.
public static AreaVector2 Lerp(AreaVector2 a, AreaVector2 b, double t)
Parameters
aAreaVector2The start vector (
t= 0).bAreaVector2The end vector (
t= 1).tdoubleThe interpolation parameter. Values outside [0, 1] extrapolate.
Returns
- AreaVector2
The interpolated AreaVector2.
LerpClamped(AreaVector2, AreaVector2, double)
Linearly interpolates between two vectors, with t clamped to [0, 1].
public static AreaVector2 LerpClamped(AreaVector2 a, AreaVector2 b, double t)
Parameters
aAreaVector2The start vector (
t= 0).bAreaVector2The end vector (
t= 1).tdoubleThe interpolation parameter, clamped to [0, 1].
Returns
- AreaVector2
The interpolated AreaVector2, always between
aandb.
Multiply(double)
Scales the vector by a scalar factor.
public AreaVector2 Multiply(double scalar)
Parameters
scalardoubleThe scalar factor.
Returns
- AreaVector2
The scaled vector.
Negate()
Negates both components.
public AreaVector2 Negate()
Returns
- AreaVector2
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(AreaVector2)
Subtracts two vectors component-wise.
public AreaVector2 Subtract(AreaVector2 other)
Parameters
otherAreaVector2The vector to subtract.
Returns
- AreaVector2
The component-wise difference.
Operators
operator +(AreaVector2, AreaVector2)
Adds two vectors component-wise.
public static AreaVector2 operator +(AreaVector2 left, AreaVector2 right)
Parameters
leftAreaVector2The left operand.
rightAreaVector2The right operand.
Returns
- AreaVector2
The component-wise sum.
operator /(AreaVector2, double)
Divides the vector by a scalar divisor.
public static AreaVector2 operator /(AreaVector2 left, double scalar)
Parameters
leftAreaVector2The vector to divide.
scalardoubleThe scalar divisor.
Returns
- AreaVector2
The divided vector.
operator /(AreaVector2, Length)
Divides a AreaVector2 by a UnitsNet.Length to produce a LengthVector2.
public static LengthVector2 operator /(AreaVector2 left, Length right)
Parameters
leftAreaVector2The left operand.
rightLengthThe right operand.
Returns
operator *(double, AreaVector2)
Scales the vector by a scalar factor. Operands may be supplied in either order.
public static AreaVector2 operator *(double scalar, AreaVector2 right)
Parameters
scalardoubleThe scalar factor.
rightAreaVector2The vector to scale.
Returns
- AreaVector2
The scaled vector.
operator *(AreaVector2, double)
Scales the vector by a scalar factor.
public static AreaVector2 operator *(AreaVector2 left, double scalar)
Parameters
leftAreaVector2The vector to scale.
scalardoubleThe scalar factor.
Returns
- AreaVector2
The scaled vector.
operator -(AreaVector2, AreaVector2)
Subtracts two vectors component-wise.
public static AreaVector2 operator -(AreaVector2 left, AreaVector2 right)
Parameters
leftAreaVector2The left operand.
rightAreaVector2The right operand.
Returns
- AreaVector2
The component-wise difference.
operator -(AreaVector2)
Negates both components.
public static AreaVector2 operator -(AreaVector2 value)
Parameters
valueAreaVector2The vector to negate.
Returns
- AreaVector2
A vector with all components negated.