Represents the state of an object in terms of its kinematic properties (in space-time): position, velocity, and acceleration. Provides methods to calculate its state after a time shift, as well as methods to compute derived values such as position and velocity shifts. All vectors are in SI units (meters for position, meters/second for velocity, meters/second² for acceleration).
Instances of this class are immutable and time-shiftable, adhering to the TimeShiftable trait.
Value parameters
- acceleration
-
The acceleration vector of the object in 3D space (meters/second²).
- position
-
The position vector of the object in 3D space (meters).
- velocity
-
The velocity vector of the object in 3D space (meters/second).
Attributes
- See also
-
TimeShiftable
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait TimeShiftable[KinematicState]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Constructors
Auxiliary constructor for creating a KinematicState with the specified position. Sets velocity and acceleration to zero by default.
Auxiliary constructor for creating a KinematicState with the specified position. Sets velocity and acceleration to zero by default.
Value parameters
- position
-
The initial position vector of the kinematic state (meters).
Attributes
Auxiliary constructor for creating a KinematicState with the specified position and velocity. Sets acceleration to zero by default.
Auxiliary constructor for creating a KinematicState with the specified position and velocity. Sets acceleration to zero by default.
Value parameters
- position
-
The initial position vector of the kinematic state (meters).
- velocity
-
The initial velocity vector of the kinematic state (meters/second).
Attributes
Concrete methods
Scales the kinematic state by a scalar value. Each component (position, velocity, acceleration) is multiplied by the scalar.
Scales the kinematic state by a scalar value. Each component (position, velocity, acceleration) is multiplied by the scalar.
Value parameters
- scalar
-
The scaling factor.
Attributes
- Returns
-
A new KinematicState with scaled components.
Shifts the kinematic state forward by a time interval dt using constant-acceleration kinematics. Returns a new KinematicState with updated position and velocity, while acceleration remains unchanged.
Shifts the kinematic state forward by a time interval dt using constant-acceleration kinematics. Returns a new KinematicState with updated position and velocity, while acceleration remains unchanged.
Value parameters
- dt
-
Time interval in seconds.
Attributes
- Returns
-
A new KinematicState representing the state after time dt.
- Definition Classes
Subtracts another kinematic state from this one. Performs component-wise subtraction: position - position, velocity - velocity, acceleration - acceleration.
Subtracts another kinematic state from this one. Performs component-wise subtraction: position - position, velocity - velocity, acceleration - acceleration.
Value parameters
- second
-
The kinematic state to subtract.
Attributes
- Returns
-
A new KinematicState representing the difference.
Computes the cross product of two kinematic states. The cross product is applied component-wise, with velocity and acceleration terms derived to maintain consistency:
Computes the cross product of two kinematic states. The cross product is applied component-wise, with velocity and acceleration terms derived to maintain consistency:
- Position: P₁ × P₂
- Velocity: (V₁ × P₂) + (P₁ × V₂)
- Acceleration: (A₁ × P₂) + (P₁ × A₂) + 2(V₁ × V₂)
where P₁, V₁, A₁ are the position, velocity, and acceleration of the first state, and P₂, V₂, A₂ are those of the second state.
Value parameters
- second
-
The kinematic state to compute the cross product with.
Attributes
- Returns
-
A new KinematicState representing the cross product.
Computes the angular momentum of the object based on its position and velocity.
Computes the angular momentum of the object based on its position and velocity.
The angular momentum L is calculated as: L = r × v where:
- r is the position vector (meters)
- v is the velocity vector (meters/second)
The resulting vector is perpendicular to both the position and velocity vectors, with magnitude equal to |r|·|v|·sin(θ), where θ is the angle between r and v.
Attributes
- Returns
-
A Vector3D representing the angular momentum vector.
- Note
-
This is the momentum for a unit mass. Multiply this result by the object's mass to get the actual momentum.
Computes the angular velocity of the object based on its position and velocity.
Computes the angular velocity of the object based on its position and velocity.
The angular velocity ω is calculated as: ω = (r × v) / |r|² where:
- r is the position vector (meters)
- v is the velocity vector (meters/second)
- |r|² is the squared magnitude of the position vector
If the position vector is zero (|r| = 0), the angular velocity is undefined, and a zero vector is returned to avoid division by zero.
Attributes
- Returns
-
A Vector3D representing the angular velocity in radians per second.
Returns a new KinematicState with all components negated. Negation applies to position, velocity, and acceleration vectors.
Returns a new KinematicState with all components negated. Negation applies to position, velocity, and acceleration vectors.
Attributes
- Returns
-
A new KinematicState with negated position, velocity, and acceleration.
Normalizes the position vector and adjusts velocity and acceleration to maintain consistent derivatives.
Normalizes the position vector and adjusts velocity and acceleration to maintain consistent derivatives.
The position is normalized to unit length: u = r / |r|, where r is the position vector. The velocity is computed as the derivative of the normalized position: u̇ = v - (u · v)·u, where v is the original velocity. The acceleration is computed as the derivative of u̇: ü = w - 2(u · v)·v + (3(u · v)² - v · v - u · w)·u, where w is the original acceleration.
Attributes
- Returns
-
A new KinematicState with normalized position and consistent velocity and acceleration derivatives.
Calculates the position after a time interval dt using the kinematic equation: r(t + dt) = r(t) + v(t)·dt + (1/2)·a(t)·dt²
Calculates the position after a time interval dt using the kinematic equation: r(t + dt) = r(t) + v(t)·dt + (1/2)·a(t)·dt²
where:
- r(t) is the initial position (meters)
- v(t) is the initial velocity (meters/second)
- a(t) is the acceleration (meters/second²)
- dt is the time interval (seconds)
Value parameters
- dt
-
Time interval in seconds.
Attributes
- Returns
-
New position vector after time dt (meters).
Returns a string representation of the kinematic state. Format: {Pos[position], Vel[velocity], Acc[acceleration]}.
Returns a string representation of the kinematic state. Format: {Pos[position], Vel[velocity], Acc[acceleration]}.
Attributes
- Returns
-
A string describing the position, velocity, and acceleration vectors.
- Definition Classes
-
Any
Calculates the velocity after a time interval dt using the kinematic equation: v(t + dt) = v(t) + a(t)·dt
Calculates the velocity after a time interval dt using the kinematic equation: v(t + dt) = v(t) + a(t)·dt
where:
- v(t) is the initial velocity (meters/second)
- a(t) is the acceleration (meters/second²)
- dt is the time interval (seconds)
Value parameters
- dt
-
Time interval in seconds.
Attributes
- Returns
-
New velocity vector after time dt (meters/second).
Inherited methods
Get a timeshifted instance of T
Get a timeshifted instance of T
Value parameters
- timeFormat
-
time to be shifted in TimeFormat
Attributes
- See also
-
TimeFormat
- Inherited from:
- TimeShiftable
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Get a timeshifted instance of T
Get a timeshifted instance of T
Value parameters
- timeFormat
-
time to be shifted in TimeFormat
Attributes
- See also
-
TimeFormat
- Inherited from:
- TimeShiftable
Get a timeshifted instance of T
Get a timeshifted instance of T
Value parameters
- dt
-
time to be shifted in seconds
Attributes
- Inherited from:
- TimeShiftable