Kinematics
The KinematicsExtensions class provides a set of extension methods for performing common kinematic calculations in both scalar and vector form. It covers free fall, constant velocity, constant acceleration, time-independent SUVAT equations, and circular motion.
β¬οΈ Free Fallβ
Compute the velocity or time of a freely falling object:
double v = 10.0.FreeFallVelocity(); // scalar: v = sqrt(2*g*h)
double t = 10.0.FreeFallTime(); // scalar: t = sqrt(2*h/g)
// Vector version with optional direction (default downward)
Vector dir = new Vector(0,0,-1);
Vector vVec = 10.0.FreeFallVelocity(dir);
β‘οΈ Constant Velocityβ
Compute position given constant velocity:
double s = 3.0.PositionFromConstantVelocity(time: 5, initialPosition: 2);
Vector velocity = new Vector(2, 0, 0);
Vector initialPosition = new Vector(1, 0, 0);
Vector position = velocity.PositionFromConstantVelocity(4, initialPosition);
π Constant Accelerationβ
Compute velocity or position under constant acceleration:
// Scalar
double v = 2.0.VelocityFromConstantAcceleration(time: 4, initialVelocity: 1);
double s = 2.0.PositionFromConstantAcceleration(time: 3, initialVelocity: 1, initialPosition: 0);
// Vector
Vector a = new Vector(1, 0, 0);
Vector v0 = new Vector(0, 0, 0);
Vector s0 = new Vector(0, 0, 0);
Vector vVec = a.VelocityFromConstantAcceleration(3, v0);
Vector sVec = a.PositionFromConstantAcceleration(2, v0, s0);
β±οΈ Time-Independent (SUVAT) Equationsβ
Compute kinematics without explicit time:
double finalV = 2.0.VelocityFromDisplacement(5, initialVelocity: 1);
double displacement = 2.0.DisplacementFromVelocities(finalVelocity: 5, initialVelocity: 1);
double t = 2.0.TimeToReachVelocity(finalVelocity: 5, initialVelocity: 1);
double sAvg = 3.0.DisplacementFromAverageVelocity(initialVelocity: 2, finalVelocity: 4);
// Vector versions are also supported
Vector a = new Vector(2, 0, 0);
Vector s = new Vector(3, 0, 0);
Vector v0 = new Vector(1, 0, 0);
Vector finalVVec = a.VelocityFromDisplacement(s, v0);
Vector displacementVec = a.DisplacementFromVelocities(finalVVec, v0);
π Circular Motionβ
Compute centripetal acceleration:
double a = 3.0.CentripetalAcceleration(radius: 2); // scalar
Vector velocity = new Vector(2, 0, 0);
Vector radius = new Vector(0, 3, 0);
Vector ac = velocity.CentripetalAcceleration(radius); // vector, towards center
Angular speed, period, and frequency:
double omega = 10.0.AngularSpeed(radius: 5); // Ο = v/r = 2 rad/s
double T = 10.0.Period(radius: 5); // T = 2Οr/v
double f = 10.0.Frequency(radius: 5); // f = v/(2Οr) = 1/T
Angular velocity vector and tangential velocity:
// Object at (5,0,0) moving at (0,10,0) β angular velocity along +Z
Vector omega = vel.AngularVelocity(radius); // Ο = (r Γ v) / |r|Β²
// Reverse: angular velocity β tangential velocity
Vector v = omega.TangentialVelocity(radius); // v = Ο Γ r
π― Projectile Motionβ
Compute projectile trajectory, time of flight, maximum height, and range:
Create an initial velocity vector from speed and launch angle:
// 20 m/s at 45Β° β vβ = (vΒ·cos(ΞΈ), 0, vΒ·sin(ΞΈ))
Vector v0 = 20.0.ProjectileVelocityFromAngle(Math.PI / 4);
Position and velocity at any time:
Vector pos = v0.ProjectilePosition(time: 1.5);
Vector vel = v0.ProjectileVelocity(time: 1.5);
// With initial height (e.g. launched from a 10m cliff)
Vector pos2 = v0.ProjectilePosition(time: 1.5, initialHeight: 10);
Time of flight, maximum height, and range:
// Vector versions (support initial height)
double T = v0.ProjectileTimeOfFlight();
double H = v0.ProjectileMaxHeight();
double R = v0.ProjectileRange();
// With elevated launch
double T2 = v0.ProjectileTimeOfFlight(initialHeight: 10);
double R2 = v0.ProjectileRange(initialHeight: 10);
// Scalar versions (speed + angle, same-height launch)
double T3 = 20.0.ProjectileTimeOfFlight(Math.PI / 4); // T = 2vβsin(ΞΈ)/g
double H3 = 20.0.ProjectileMaxHeight(Math.PI / 4); // H = vβΒ²sinΒ²(ΞΈ)/(2g)
double R3 = 20.0.ProjectileRange(Math.PI / 4); // R = vβΒ²sin(2ΞΈ)/g
π Orbital Mechanicsβ
Gravitational and circular-orbit calculations:
Gravitational helpers:
// Gravitational field strength at distance r from a mass: g = GM/rΒ²
double g = PhysicsConstants.EarthMass.GravitationalFieldStrength(PhysicsConstants.EarthRadius);
// Gravitational force between two masses: F = GΒ·mβΒ·mβ/rΒ²
double F = PhysicsConstants.EarthMass.GravitationalForce(PhysicsConstants.MoonMass, 3.844e8);
// Escape velocity: v = β(2GM/r)
double vEsc = PhysicsConstants.EarthMass.EscapeVelocity(PhysicsConstants.EarthRadius);
Circular orbit scalars:
double r = PhysicsConstants.EarthRadius + 408000; // ISS altitude
double speed = PhysicsConstants.EarthMass.OrbitalSpeed(r); // v = β(GM/r) β 7660 m/s
double period = PhysicsConstants.EarthMass.OrbitalPeriod(r); // T = 2Οβ(rΒ³/GM) β 92 min
Position, velocity, and acceleration on a circular orbit at time :
double M = PhysicsConstants.EarthMass;
double r = 1e7; // 10 000 km radius
Vector pos = M.OrbitalPosition(r, time); // RΒ·(cos Οt, sin Οt, 0)
Vector vel = M.OrbitalVelocity(r, time); // RΟΒ·(-sin Οt, cos Οt, 0)
Vector acc = M.OrbitalAcceleration(r, time); // -ΟΒ²RΒ·(cos Οt, sin Οt, 0)
π Relative Motionβ
Compute relative kinematics between two objects or reference frames:
var vA = new Vector(30, 0, 0);
var vB = new Vector(-20, 0, 0);
Vector vRel = vA.RelativeVelocity(vB); // v_A - v_B = (50, 0, 0)
Vector rRel = posA.RelativePosition(posB); // r_A - r_B
Vector aRel = accA.RelativeAcceleration(accB); // a_A - a_B
Closing speed (positive = approaching, negative = separating):
double cs = vA.ClosingSpeed(vB, posA, posB);
Position in a moving reference frame over time:
Vector relPos = vObj.RelativePositionAtTime(vRef, time: 5.0, r0Obj, r0Ref);
Closest approach between two objects at constant velocity:
double t = vA.TimeOfClosestApproach(vB, posA, posB);
double d = vA.MinimumDistance(vB, posA, posB);