Table of Contents

Struct ImpulseVector2

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

A 2D vector whose components represent impulse, each expressed as an UnitsNet.Impulse (e.g. newton-seconds).

Impulse is the product of force and time (J = F·Δt). It equals the change in momentum of an object, making it useful for modelling collisions and sudden force applications in physics simulations.

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

Examples

var impulse = new ImpulseVector2(Impulse.FromNewtonSeconds(5), Impulse.Zero);

Constructors

ImpulseVector2(Impulse, Impulse)

Constructs a ImpulseVector2 from two UnitsNet.Impulse components.

public ImpulseVector2(Impulse x, Impulse y)

Parameters

x Impulse

The X component.

y Impulse

The Y component.

Properties

Magnitude

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

public Impulse Magnitude { get; }

Property Value

Impulse

X

The X component.

public Impulse X { get; }

Property Value

Impulse

Y

The Y component.

public Impulse Y { get; }

Property Value

Impulse

Zero

A ImpulseVector2 with both components set to zero.

public static ImpulseVector2 Zero { get; }

Property Value

ImpulseVector2

Methods

Abs()

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

public ImpulseVector2 Abs()

Returns

ImpulseVector2

A ImpulseVector2 with non-negative components.

Add(ImpulseVector2)

Adds two vectors component-wise.

public ImpulseVector2 Add(ImpulseVector2 other)

Parameters

other ImpulseVector2

The vector to add.

Returns

ImpulseVector2

The component-wise sum.

ApproximatelyEquals(ImpulseVector2, Impulse)

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

public bool ApproximatelyEquals(ImpulseVector2 other, Impulse tolerance)

Parameters

other ImpulseVector2

The vector to compare against.

tolerance Impulse

The maximum allowed difference per component (inclusive).

Returns

bool

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

As(ImpulseUnit)

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

public DoubleVector2 As(ImpulseUnit unit)

Parameters

unit ImpulseUnit

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

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

public ImpulseVector2 Clamp(ImpulseVector2 min, ImpulseVector2 max)

Parameters

min ImpulseVector2

The lower bound vector (inclusive, per component).

max ImpulseVector2

The upper bound vector (inclusive, per component).

Returns

ImpulseVector2

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

Divide(double)

Divides the vector by a scalar divisor.

public ImpulseVector2 Divide(double scalar)

Parameters

scalar double

The scalar divisor.

Returns

ImpulseVector2

The divided vector.

Equals(ImpulseVector2)

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

public bool Equals(ImpulseVector2 other)

Parameters

other ImpulseVector2

An object to compare with this object.

Returns

bool

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

FromCentinewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromCentinewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromCentinewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromDecanewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromDecanewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromDecanewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromDecinewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromDecinewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromDecinewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromKilogramMetersPerSecond(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromKilogramMetersPerSecond(UnitsNet.QuantityValue).

public static ImpulseVector2 FromKilogramMetersPerSecond(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromKilonewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromKilonewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromKilonewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromMeganewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromMeganewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromMeganewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromMicronewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromMicronewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromMicronewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromMillinewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromMillinewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromMillinewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromNanonewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromNanonewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromNanonewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromNewtonSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromNewtonSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromNewtonSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromPoundFeetPerSecond(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromPoundFeetPerSecond(UnitsNet.QuantityValue).

public static ImpulseVector2 FromPoundFeetPerSecond(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromPoundForceSeconds(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromPoundForceSeconds(UnitsNet.QuantityValue).

public static ImpulseVector2 FromPoundForceSeconds(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

A ImpulseVector2 with both components in the corresponding unit.

FromSlugFeetPerSecond(double, double)

Creates a ImpulseVector2 with both components created via UnitsNet.Impulse.FromSlugFeetPerSecond(UnitsNet.QuantityValue).

public static ImpulseVector2 FromSlugFeetPerSecond(double x, double y)

Parameters

x double

The X component value.

y double

The Y component value.

Returns

ImpulseVector2

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

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

Parameters

a ImpulseVector2

The start vector (t = 0).

b ImpulseVector2

The end vector (t = 1).

t double

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

Returns

ImpulseVector2

The interpolated ImpulseVector2.

LerpClamped(ImpulseVector2, ImpulseVector2, double)

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

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

Parameters

a ImpulseVector2

The start vector (t = 0).

b ImpulseVector2

The end vector (t = 1).

t double

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

Returns

ImpulseVector2

The interpolated ImpulseVector2, always between a and b.

Multiply(double)

Scales the vector by a scalar factor.

public ImpulseVector2 Multiply(double scalar)

Parameters

scalar double

The scalar factor.

Returns

ImpulseVector2

The scaled vector.

Negate()

Negates both components.

public ImpulseVector2 Negate()

Returns

ImpulseVector2

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

Subtracts two vectors component-wise.

public ImpulseVector2 Subtract(ImpulseVector2 other)

Parameters

other ImpulseVector2

The vector to subtract.

Returns

ImpulseVector2

The component-wise difference.

Operators

operator +(ImpulseVector2, ImpulseVector2)

Adds two vectors component-wise.

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

Parameters

left ImpulseVector2

The left operand.

right ImpulseVector2

The right operand.

Returns

ImpulseVector2

The component-wise sum.

operator /(ImpulseVector2, double)

Divides the vector by a scalar divisor.

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

Parameters

left ImpulseVector2

The vector to divide.

scalar double

The scalar divisor.

Returns

ImpulseVector2

The divided vector.

operator *(double, ImpulseVector2)

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

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

Parameters

scalar double

The scalar factor.

right ImpulseVector2

The vector to scale.

Returns

ImpulseVector2

The scaled vector.

operator *(ImpulseVector2, double)

Scales the vector by a scalar factor.

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

Parameters

left ImpulseVector2

The vector to scale.

scalar double

The scalar factor.

Returns

ImpulseVector2

The scaled vector.

operator -(ImpulseVector2, ImpulseVector2)

Subtracts two vectors component-wise.

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

Parameters

left ImpulseVector2

The left operand.

right ImpulseVector2

The right operand.

Returns

ImpulseVector2

The component-wise difference.

operator -(ImpulseVector2)

Negates both components.

public static ImpulseVector2 operator -(ImpulseVector2 value)

Parameters

value ImpulseVector2

The vector to negate.

Returns

ImpulseVector2

A vector with all components negated.

latest ▼