Skip to content

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)

F=⟨Fx,Fy,Fz⟩,∥F∥=Fx2+Fy2+Fz2r^=r2−r1∥r2−r1∥,∥r^∥=1F=∥F∥r^

And, for context (how the magnitude is obtained in Newtonian gravity):

∥F∥=Gm1m2∥r2−r1∥2

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).