Documentation / @interstellar-tools/types / ForceResultInterface
Interface: ForceResultInterface
Defined in: physics.ts:50
Result of a Newtonian gravitational force computation between two point masses.
Units: SI (newtons for force). vector and direction point from body 1 toward body 2.
Relevant equations (invariants & definitions)
And, for context (how the magnitude is obtained in Newtonian gravity):
Mappings to fields
vector↔ ($ \mathbf F $)magnitude↔ ($ |\mathbf F| $)direction↔ ($ \hat{\mathbf r} $)
Example
ts
const res: ForceResultInterface = gravitationalForce(m1, m2, r1, r2);
// Invariant checks:
const [Fx, Fy, Fz] = res.vector;
const magFromVec = Math.hypot(Fx, Fy, Fz);
console.assert(Math.abs(magFromVec - res.magnitude) / res.magnitude < 1e-9);See
https://en.wikipedia.org/wiki/Newton's_law_of_universal_gravitation
Properties
direction
ts
readonly direction: Vector3DTupleType;Defined in: physics.ts:56
Unit direction from body 1 to body 2 (dimensionless).
magnitude
ts
readonly magnitude: number;Defined in: physics.ts:54
Scalar magnitude of the force (N).
vector
ts
readonly vector: Vector3DTupleType;Defined in: physics.ts:52
Force vector on body 1 due to body 2 (N).