Struct ForceVector3
A 3D vector whose components represent force, each expressed as a UnitsNet.Force.
public readonly record struct ForceVector3 : IEquatable<ForceVector3>
- Implements
- Inherited Members
- Extension Methods
Constructors
ForceVector3(Force, Force, Force)
Constructs a ForceVector3 from three UnitsNet.Force components.
public ForceVector3(Force x, Force y, Force z)
Parameters
xForceThe X component.
yForceThe Y component.
zForceThe Z component.
Properties
Magnitude
Returns the Euclidean magnitude of this vector as a UnitsNet.Force. The result is expressed in the same unit as the X component.
public Force Magnitude { get; }
Property Value
- Force
X
The X component.
public Force X { get; }
Property Value
- Force
Y
The Y component.
public Force Y { get; }
Property Value
- Force
Z
The Z component.
public Force Z { get; }
Property Value
- Force
Zero
A ForceVector3 with all components set to zero.
public static ForceVector3 Zero { get; }
Property Value
Methods
Abs()
Returns a vector with each component replaced by its absolute value.
public ForceVector3 Abs()
Returns
- ForceVector3
A ForceVector3 with non-negative components.
Add(ForceVector3)
Adds two vectors component-wise.
public ForceVector3 Add(ForceVector3 other)
Parameters
otherForceVector3The vector to add.
Returns
- ForceVector3
The component-wise sum.
ApproximatelyEquals(ForceVector3, Force)
Returns true if each component of this vector is within
tolerance of the corresponding component of other.
public bool ApproximatelyEquals(ForceVector3 other, Force tolerance)
Parameters
otherForceVector3The vector to compare against.
toleranceForceThe maximum allowed difference per component (inclusive).
Returns
- bool
true when |X - other.X| <= tolerance, |Y - other.Y| <= tolerance, and |Z - other.Z| <= tolerance.
As(ForceUnit)
Projects all three components into the requested unit, returning a unit-less DoubleVector3.
public DoubleVector3 As(ForceUnit unit)
Parameters
unitForceUnitThe 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(ForceVector3, ForceVector3)
Returns a vector with each component clamped to the range [min, max].
public ForceVector3 Clamp(ForceVector3 min, ForceVector3 max)
Parameters
minForceVector3The lower bound vector (inclusive, per component).
maxForceVector3The upper bound vector (inclusive, per component).
Returns
- ForceVector3
A ForceVector3 with each component in [min, max].
Divide(double)
Divides the vector by a scalar divisor.
public ForceVector3 Divide(double scalar)
Parameters
scalardoubleThe scalar divisor.
Returns
- ForceVector3
The divided vector.
Dot(LengthVector3)
Returns the mechanical work done by this force over a displacement (W = F⃗ · d⃗ = Fx·dx + Fy·dy + Fz·dz), expressed as UnitsNet.Energy.
Work is only done by the component of force that is aligned with the direction of
motion: W = |F| · |d| · cos(θ). In 3D, forces and displacements can be at
arbitrary angles; the dot product correctly extracts only the "useful" component.
A force perpendicular to the motion (e.g. gravity on a horizontally-moving object,
or centripetal force on a circular path) does no work. Negative work means the
force is opposing motion (e.g. friction, air resistance).
public Energy Dot(LengthVector3 other)
Parameters
otherLengthVector3The displacement vector over which the force is applied.
Returns
- Energy
The work done in joules (J). Positive = force aids motion; negative = force opposes motion.
Examples
// Rocket thrust of 5000 N upward (+Y), displacement 200 m upward
var force = new ForceVector3(Force.Zero, Force.FromNewtons(5000), Force.Zero);
var disp = new LengthVector3(Length.Zero, Length.FromMeters(200), Length.Zero);
Energy work = force.Dot(disp); // 1 000 000 J = 1 MJ
Dot(SpeedVector3)
Returns the instantaneous mechanical power delivered by this force to an object moving at the given velocity (P = F⃗ · v⃗), expressed as UnitsNet.Power.
Power is the rate at which work is being done in 3D. Like the work dot-product above, only the component of force aligned with velocity contributes. A braking force opposing motion returns negative power (energy is being absorbed). For a rocket with thrust aligned with velocity, all the thrust power goes into kinetic energy.
public Power Dot(SpeedVector3 other)
Parameters
otherSpeedVector3The 3D velocity vector of the object the force is acting on.
Returns
- Power
The instantaneous power in watts (W). Positive = force is doing work on the object; negative = force is absorbing energy from the object.
Examples
// Rocket thrust 50 000 N forward (+Z), velocity 300 m/s forward
var thrust = new ForceVector3(Force.Zero, Force.Zero, Force.FromNewtons(50000));
var velocity = new SpeedVector3(Speed.Zero, Speed.Zero, Speed.FromMetersPerSecond(300));
Power power = thrust.Dot(velocity); // 15 000 000 W = 15 MW
Equals(ForceVector3)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ForceVector3 other)
Parameters
otherForceVector3An object to compare with this object.
Returns
FromDecanewtons(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromDecanewtons(UnitsNet.QuantityValue).
public static ForceVector3 FromDecanewtons(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromDyne(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromDyne(UnitsNet.QuantityValue).
public static ForceVector3 FromDyne(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromKiloPonds(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromKiloPonds(UnitsNet.QuantityValue).
public static ForceVector3 FromKiloPonds(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromKilogramsForce(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromKilogramsForce(UnitsNet.QuantityValue).
public static ForceVector3 FromKilogramsForce(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromKilonewtons(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromKilonewtons(UnitsNet.QuantityValue).
public static ForceVector3 FromKilonewtons(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromKilopoundsForce(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromKilopoundsForce(UnitsNet.QuantityValue).
public static ForceVector3 FromKilopoundsForce(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromMeganewtons(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromMeganewtons(UnitsNet.QuantityValue).
public static ForceVector3 FromMeganewtons(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromMicronewtons(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromMicronewtons(UnitsNet.QuantityValue).
public static ForceVector3 FromMicronewtons(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromMillinewtons(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromMillinewtons(UnitsNet.QuantityValue).
public static ForceVector3 FromMillinewtons(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromNewtons(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromNewtons(UnitsNet.QuantityValue).
public static ForceVector3 FromNewtons(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromOunceForce(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromOunceForce(UnitsNet.QuantityValue).
public static ForceVector3 FromOunceForce(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromPoundals(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromPoundals(UnitsNet.QuantityValue).
public static ForceVector3 FromPoundals(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromPoundsForce(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromPoundsForce(UnitsNet.QuantityValue).
public static ForceVector3 FromPoundsForce(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromShortTonsForce(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromShortTonsForce(UnitsNet.QuantityValue).
public static ForceVector3 FromShortTonsForce(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 with all components in the corresponding unit.
FromTonnesForce(double, double, double)
Creates a ForceVector3 with all components created via UnitsNet.Force.FromTonnesForce(UnitsNet.QuantityValue).
public static ForceVector3 FromTonnesForce(double x, double y, double z)
Parameters
Returns
- ForceVector3
A ForceVector3 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(ForceVector3, ForceVector3, 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(ForceVector3, ForceVector3, double) if you need the result bounded to the segment
between a and b.
public static ForceVector3 Lerp(ForceVector3 a, ForceVector3 b, double t)
Parameters
aForceVector3The start vector (
t= 0).bForceVector3The end vector (
t= 1).tdoubleThe interpolation parameter. Values outside [0, 1] extrapolate.
Returns
- ForceVector3
The interpolated ForceVector3.
LerpClamped(ForceVector3, ForceVector3, double)
Linearly interpolates between two vectors, with t clamped to [0, 1].
public static ForceVector3 LerpClamped(ForceVector3 a, ForceVector3 b, double t)
Parameters
aForceVector3The start vector (
t= 0).bForceVector3The end vector (
t= 1).tdoubleThe interpolation parameter, clamped to [0, 1].
Returns
- ForceVector3
The interpolated ForceVector3, always between
aandb.
Multiply(double)
Scales the vector by a scalar factor.
public ForceVector3 Multiply(double scalar)
Parameters
scalardoubleThe scalar factor.
Returns
- ForceVector3
The scaled vector.
Negate()
Negates all components.
public ForceVector3 Negate()
Returns
- ForceVector3
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(ForceVector3)
Subtracts two vectors component-wise.
public ForceVector3 Subtract(ForceVector3 other)
Parameters
otherForceVector3The vector to subtract.
Returns
- ForceVector3
The component-wise difference.
Operators
operator +(ForceVector3, ForceVector3)
Adds two vectors component-wise.
public static ForceVector3 operator +(ForceVector3 left, ForceVector3 right)
Parameters
leftForceVector3The left operand.
rightForceVector3The right operand.
Returns
- ForceVector3
The component-wise sum.
operator /(ForceVector3, double)
Divides the vector by a scalar divisor.
public static ForceVector3 operator /(ForceVector3 left, double scalar)
Parameters
leftForceVector3The vector to divide.
scalardoubleThe scalar divisor.
Returns
- ForceVector3
The divided vector.
operator /(ForceVector3, Mass)
Divides a ForceVector3 by a UnitsNet.Mass to produce a AccelerationVector3.
public static AccelerationVector3 operator /(ForceVector3 left, Mass right)
Parameters
leftForceVector3The left operand.
rightMassThe right operand.
Returns
operator *(double, ForceVector3)
Scales the vector by a scalar factor. Operands may be supplied in either order.
public static ForceVector3 operator *(double scalar, ForceVector3 right)
Parameters
scalardoubleThe scalar factor.
rightForceVector3The vector to scale.
Returns
- ForceVector3
The scaled vector.
operator *(ForceVector3, double)
Scales the vector by a scalar factor.
public static ForceVector3 operator *(ForceVector3 left, double scalar)
Parameters
leftForceVector3The vector to scale.
scalardoubleThe scalar factor.
Returns
- ForceVector3
The scaled vector.
operator *(ForceVector3, Duration)
Multiplies a force vector by a duration to produce an impulse vector (J = F·Δt), preserving the caller's unit.
The result unit is derived from the force component unit (e.g. kN × s = kN·s, lbf × s = lbf·s). Unmapped units fall back to N·s.
public static ImpulseVector3 operator *(ForceVector3 left, Duration right)
Parameters
leftForceVector3The force vector.
rightDurationThe duration over which the force is applied.
Returns
- ImpulseVector3
The impulse vector in the unit matching the force component unit.
Examples
var drag = new ForceVector3(Force.FromNewtons(-50), Force.Zero, Force.Zero);
ImpulseVector3 impulse = drag * Duration.FromSeconds(4); // (-200 N·s, 0, 0)
operator *(Duration, ForceVector3)
Multiplies a duration by a force vector to produce an impulse vector. Operands may be supplied in either order.
public static ImpulseVector3 operator *(Duration left, ForceVector3 right)
Parameters
leftDurationThe duration over which the force is applied.
rightForceVector3The force vector.
Returns
- ImpulseVector3
The impulse vector in the unit matching the force component unit.
operator -(ForceVector3, ForceVector3)
Subtracts two vectors component-wise.
public static ForceVector3 operator -(ForceVector3 left, ForceVector3 right)
Parameters
leftForceVector3The left operand.
rightForceVector3The right operand.
Returns
- ForceVector3
The component-wise difference.
operator -(ForceVector3)
Negates all components.
public static ForceVector3 operator -(ForceVector3 value)
Parameters
valueForceVector3The vector to negate.
Returns
- ForceVector3
A vector with all components negated.