ADG Dynamics Labuser guide Back to the lab Back to ADG

Dynamics Lab – user guide

A laboratory for rigid-body dynamics and classical mechanics. Every scenario is a differential equation written in JavaScript and integrated in the page, with the numerical values exposed next to the motion. Nothing is pre-recorded and no external physics engine is used.

1. What the lab does

The lab contains ten independent scenarios: rolling on an inclined plane, angular momentum (conservation and gyroscopic precession), an eccentric collision, the instantaneous centre of rotation, load transfer on an automobile, a thread pendulum, a lever on a support, a spring-loaded lever, a spindle/flywheel and a rod hanging on a thread. Each has its own parameters, presets, live telemetry and a theory box with the common misconception, the rigorous explanation and the governing equations (MathML).

  • Physics — equations of motion written directly in js/physics.js; the rod/thread/support scenarios use the generic solver in js/builder/engine.js through js/lab_extra.js. No Matter.js, Box2D or any other engine.
  • Integration — RK4 with a fixed 1 ms step for the original five scenarios, velocity Verlet + sequential impulses for the new ones; closed-form impulses for collisions (see the numerical method section).
  • Live values — velocity, angular velocity, the split between translational and rotational kinetic energy, total mechanical energy, and conservation diagnostics.
  • Real-time control — every parameter has a slider and a numeric input; presets put the scenario in a known state.

2. Quick start

  1. Pick a scenario in the Scenario dropdown in the second bar (keys 1…9; 0 for the tenth).
  2. Choose a preset in the left panel — it sets parameters and resets the state.
  3. Press Play (Space) or Step (→).
  4. Move a slider: live parameters (mass, radii, friction, angles, gravity) take effect immediately; initial conditions (initial speed, spin, impact parameter, brake bias) restart the scenario from t = 0.
  5. Read the right-hand panel: telemetry, the energy bar and the diagnostics. The theory box at the bottom shows the live substitution of the equations.
  6. Reset (R) rebuilds the initial state without changing parameters.

3. The interface

AreaWhat it shows
Top barPlay/pause, step (20 ms), reset, simulation clock, theory toggle, help.
Second barScenario dropdown, time scale (0.1× … 2×), vector/trail/velocity-field switches, integration label.
Left panelScenario summary, presets, parameters (slider + numeric input) and the integration description.
CanvasMotion, force vectors, trails and scenario-specific geometry (3D projection for the gyroscope, top + side view for the car).
Right panelLive telemetry, stacked energy bar, diagnostics (conservation drift, friction limits, warnings).
Bottom panelTheory & intuition trap: misconception, real physics, fundamental equations, live numeric substitution.

The canvas renders at the device pixel ratio (DPR) of your screen and is re-fitted when the panels change size, so lines and text stay crisp at 125 %, 150 % or 200 % scaling.

4. Scenario 1 — Rolling on an inclined plane

A round body with shape factor k=I/(mR2) rolls down a slope of length 7 m. The shape factor interpolates from a particle (k=0) through a solid sphere (0.4) and a disk (0.5) to a thin hoop (1.0).

a=gsinθ 1+k , tanθ≤ μs1+kk

Try this: set θ = 45° and μs = 0.15 with k = 0.5. The static limit (0.45) is exceeded, the contact turns red and starts to slip; kinetic friction now removes energy. Then increase μs above 0.67 and the body rolls again without loss.

Watch: the velocity vector grows with the slope, the friction arrow points up the slope, and the energy bar moves energy from potential to translational + rotational kinetic energy. In pure rolling the translational share is 1/(1+k) of the kinetic energy (2/3 for a cylinder, 5/7 for a sphere).

5. Scenario 2 — Angular momentum: conservation and precession

A uniform disk (spin inertia I3=12mR2, transverse inertia about the pivot I1=14mR2+md2) spins on a massless axle. The exact symmetric-top equations are integrated in Euler angles.

I1θ¨= I1φ˙2 sinθcosθ −I3ωs φ˙sinθ +mgdsinθ , Ωp≈ mgdI3ωs

Try this: “Fast top” (220 rad/s) barely nods and precesses slowly; “Slow top” (45 rad/s) falls. Turn Gravity off with the “Torque-free wobble” preset: the axle keeps moving, but L stays fixed in space and |L| no longer changes — the conservation limit. Drag on the canvas to orbit the 3D view.

Watch: the magenta arrow is L, the orange arrow is the torque τ (perpendicular to L). The ratio φ̇ / Ωp tends to 1 for a fast top; below the sleeping-top threshold the diagnostic warns that the spin is too low.

6. Scenario 3 — Eccentric collision

Two disks approach, the striker offset by the impact parameter b (given as a fraction of R₁ + R₂). The time of impact is solved analytically and the collision is a single impulse computed in closed form.

Jn= −(1+e)(u·n) 1/m1+1/m2 , |Jt|≤μJn

Try this: “Head-on elastic” (b = 0, e = 1, μ = 0) keeps both momentum and energy; “Eccentric + friction” produces spin. Compare the before/after rows: px, py and L about the contact point are identical; KE is not.

Watch: the normal impulse through the centres cannot rotate a disk. Set μ = 0 with an off-centre impact and both bodies leave without spin — the spin comes only from the tangential friction impulse, saturated at μJn.

7. Scenario 4 — Instantaneous centre of rotation

A wheel with independent centre velocity v and spin ω. The instantaneous centre (ICR) is the point of the plane whose velocity is zero. The app draws the construction, the velocity field and the cycloid traced by a point on the rim.

yICR=R+ vω , vc=v+ωR , acontact=ω2R

Try this: “Locked wheel (skid)” starts with v = 6 m/s and ω = 0; the ICR is far below the ground and friction spins the wheel up until the ICR reaches the contact point. In Kinematic mode you set v and ω directly and friction is switched off.

Watch: the magenta cross is the ICR, the blue arrows are v=ω×r for a grid of points, the red arrow is the slip velocity at the contact and the teal arrow is the normal acceleration ω2R of the contact point.

8. Scenario 5 — Mass transfer under braking and cornering

A quasi-static car model: the total weight is constant, the four normal reactions change with acceleration. Braking loads the front axle; cornering loads the outer wheels. Each wheel has a friction circle and a utilisation ratio Fx2+Fy2/(μN).

Nf= mgbL +maxhL , ΔNlat= mayht , ay=v2R

Try this: “SUV (high CG)” in combined mode exceeds the friction circle at the front outside wheel; “Sports car (low CG)” stays inside it at the same speed. Change the brake balance: moving it forward saturates the front tyres first (understeer at the limit), moving it rearward saturates the rear.

Watch: the top view shows load circles, friction circles and force vectors; the side view shows the reactions and the dimensions used by the formula. The sum of the four loads always equals mg — the diagnostic checks it every frame.

The model has no suspension dynamics, no ABS and no tyre slip curves. It is a steady-state load transfer model, exact within its assumptions; it is not a lap-time simulator.

9. Rods, threads and supports

The last five scenarios use rods (capsules), threads and ideal supports. They share the generic solver in js/builder/engine.js (velocity Verlet + sequential impulses), exposed to the lab by js/lab_extra.js. Select them from the same Scenario dropdown; the parameter panel and the theory box update with the scenario.

ScenarioParametersWhat it demonstrates
Thread pendulumm, R, L, θ0, gravity A tension-only thread. It goes slack when the bob moves closer and becomes taut at distance L. At a taut thread the tension does no work.
Lever on a supportL, m, fulcrum offset, θ0, gravity A rod pivoted at a fixed fulcrum. Gravity creates a moment about the support; the support force acts at a point at rest, so it does no work.
Spring-loaded leverL, m, k, rest length, c, θ0, gravity A spring attached at the rod end. Its force creates a torque about the fulcrum; damping removes energy.
Spindle / flywheelR, m, ω0 An ideal axle at the centre: no external moment, so ω and L = Iω are constant.
Rod on a threadL, m, thread length, θ0, gravity A compound swing: the thread constrains one end while the rod translates and rotates.

Hand checks

  1. Thread pendulum: the displayed distance |p−a| stays at L; total mechanical energy stays constant (about 0.001 % over 2 s).
  2. Lever: the fulcrum error stays below 1 cm; the rod rotates under gravity and the energy drift remains below 0.01 J over 0.4 s.
  3. Spring-loaded lever: with c = 0 the total mechanical energy is conserved; with c > 0 the dissipated energy increases.
  4. Spindle: the centre stays fixed, ω stays at its initial value and L = Iω is constant.
  5. Rod on a thread: the thread-end distance stays at the set thread length; the rod both rotates and translates.
Limits: threads are ideal and world-anchored (no body-to-body threads, pulleys or stretch); supports are ideal pivots (no bearing friction or compliance); rods are capsules (no boxes/polygons). The gyroscope and vehicle models remain separate.

10. Reading the telemetry

QuantityMeaning
v, ωCentre-of-mass speed and angular velocity of the body (yaw rate for the car).
Translational KE12mv2, including both bodies in a collision.
Rotational KE12Iω2; for the car, the four wheels at ω=v/rw.
Total mechanicalKinetic terms plus the potential energy (where defined) — the quantity the conservation check follows.
DissipatedWork done by kinetic friction, integrated at the contact. Adding it to the mechanical energy restores the initial value.
Energy drift|ΔE|/E0 — expect ~1e-9 for RK4 on the smooth scenarios; a visible value means a physical event (impact, stick/slip switch) or a changed parameter.
DiagnosticsConstraint checks: static-friction limit, Coulomb clamp, momentum and angular-momentum balance, ΣN = mg, friction-circle usage.

11. Numerical method and accuracy

Smooth systems are integrated with classical Runge–Kutta 4 at a fixed step of 1 ms, independent of the display frame rate. The frame only supplies wall-clock time; the physics always advances in equal steps, so a slow machine and a fast one produce the same trajectory.

y′=f(t,y) , yn+1= yn+h6 (k1+2k2 +2k3+k4)
  • Rolling — the stick/slip transition is detected from the sign of the contact velocity and clamped at the crossing; friction work is integrated with the trapezoid rule.
  • Gyroscope — the two first integrals (pψ, Lz) reduce the problem to one second-order equation for θ; the nutation angle is clamped away from the singularities at 0 and 180°.
  • Collision — the contact time is a quadratic root; the impulse is closed form. Between impacts the motion is exact, which is why momentum is conserved to machine precision.
  • ICR — the slip-to-rolling transition is advanced analytically to vc=0 inside the step.
  • Car — quasi-static: the loads are algebraic, the motion is integrated from the speed and yaw rate.

12. Units and sign conventions

  • SI throughout: metres, kilograms, seconds, radians, newtons, joules, kg·m²/s.
  • Angles in the interface are degrees; the physics uses radians. Friction coefficients are dimensionless.
  • Rolling: s and v are positive down the slope; ω is positive in the rolling sense, so pure rolling is v=ωR.
  • ICR: v is positive to the right and ω positive counter-clockwise (the wheel rolling right has ω<0).
  • Collision: the striker moves along +x; a positive impact parameter offsets it above the target centre.
  • Car: a is measured from the front axle to the CG (so b=L−a); loads are positive downwards on the road.

13. Keyboard and mouse

InputAction
SpacePlay / pause
RReset the scenario
→Advance one step (20 ms)
1…9, 0Switch scenario
Mouse drag (gyroscope)Orbit the 3D view
Slider / numeric inputChange a parameter; live parameters apply immediately, initial conditions restart

14. Hand checks

The automated check node tools/dynamics_check.js compares the engine with the closed-form results below; the numbers are also useful for a manual check in the interface.

ScenarioInputsExpected result
Rolling, no slipθ = 30°, k = 0.5, μs large a = g·sin30°/(1+0.5) = 3.270 m/s²; v = 3.270 m/s after 1 s
Gyroscope, steady precessionm = 1.5 kg, d = 0.18 m, R = 0.12 m, ωs = 150 rad/s I₃ = 0.0108 kg·m²; Ωp = mgd/(I₃ωs) = 1.635 rad/s
Collision, head-on elasticm₁ = 2 kg, m₂ = 1 kg, v = 6 m/s, e = 1, μ = 0 v₁′ = 2 m/s, v₂′ = 8 m/s, p = 12 kg·m/s before and after; KE = 36 J
ICR, skid to rollingR = 0.35 m, m = 8 kg, k = 0.5, v₀ = 6 m/s, ω₀ = 0, μ = 0.5 t* = 0.4077 s; v = 4.000 m/s; ω = −11.43 rad/s; dissipating 48 J
Car, brakingm = 1500 kg, ax = 6 m/s², h = 0.55 m, L = 2.70 m, a = 1.20 m ΔN = 1833 N; Nf = 10.01 kN, Nr = 4.71 kN; ΣN = 14.72 kN = mg

15. Limitations

  • Planar rigid bodies — no 3D tumbling or gyroscopic motion of a free body beyond the symmetric top.
  • Rolling — a rigid wheel on a rigid plane; no rolling resistance, no deformation, no air drag.
  • Gyroscope — disk + massless axle; no bearing friction, no flexible shaft, no motor torque.
  • Collision — two disks, instantaneous contact, constant restitution, Coulomb friction impulse; no deformation, no multiple contacts, no repeated bouncing.
  • ICR — a single wheel; the friction coefficient is constant and the normal force is mg (no load transfer from the same scenario).
  • Car — quasi-static load transfer, no suspension dynamics, no ABS, no tyre slip curves, no aerodynamic downforce; lateral forces are split equally left/right.
  • The canvas is a schematic, not a CAD view: dimensions are to scale, but stiffness, flex and tyre deformation are not drawn.

Files: dynamics_lab.php, help.php, css/dynamics.css, js/core.js, js/integrators.js, js/physics.js, js/render.js, js/app.js; checks in tools/dynamics_check.js and tools/dynamics_ui_smoke.js. Back to the lab.

16. Scenario builder

The Scenario Builder is a separate page of the Dynamics module. It uses the same theme, canvas and theory box, but instead of a fixed scenario it lets you assemble a planar rigid-body scene and run it with a generic solver.

Start from a demo: the Demo list contains a rolling incline, elastic and frictional eccentric collisions, a wheel skidding to rolling (ICR), a spring oscillator, a physical pendulum, a thread pendulum, a lever on a support, a spring-loaded lever, a spindle/flywheel and a rod hanging on a thread. Every demo is fully editable; Save/Open keep your own scenes as JSON.

Objects

ObjectWhat it adds
DiskA rigid disk with radius r, mass m and shape factor k = I/(mr²). It can be free or fixed in space (a peg).
Rod / leverA dynamic bar with length L, thickness t and inertia I = m(L²+t²)/12. It collides as a capsule (rounded ends) and can carry a support, a spring, a thread or a pin at any local point.
SegmentA static line: ground, incline or wall, with friction mu and restitution e.
SpringA linear spring from a fixed world anchor to a local point on a body: stiffness k, damping c and rest length L0. On a rod, an end spring creates a torque.
ThreadAn inextensible, tension-only rope from a world anchor to a local point. It can go slack and never pushes; use it for pendulums and swings.
SupportA fixed pivot drawn as a stand: a fulcrum for a lever or an axle for a spinning disk. It holds the local point in place and allows rotation.
PinA small hinge between a fixed world anchor and a local point. An offset pin gives a physical pendulum; at the centre it is an axle.

Tools and keyboard

ActionHow
Select / move1 — click an object; drag a body, a rod end, a segment endpoint or an anchor.
Add disk2 — click on the canvas.
Add rod3 — click the first end, then the second end. A selected rod has a handle at each end.
Add segment4 — click the start point, then the end point. Snap is 0.1 m.
Add spring5 — select a body, then click the world anchor.
Add thread6 — click a body at the attachment point, then click the world anchor.
Add support7 — click a body at the fulcrum/axle point.
Add pin8 — click a body at the desired pin point.
Delete9 or the Delete key (or the × in the object list).
Play / resetSpace / R. Editing resets the run to t = 0.
Save / openCtrl+S / Ctrl+O; JSON scene files.

Inspector and telemetry

The inspector edits the selected object: mass, rod length/thickness or disk radius, shape factor, initial position, angle, velocity and spin, friction, restitution, colour, spring constants, thread length, and the local attachment point for springs, threads, supports and pins. The right panel shows the selected body (speed, angular velocity, inertia, ICR), the system energy (translational, rotational, spring, gravitational), momentum and the contact penetration. The diagnostics list the solver settings, deep penetration and high-speed warnings.

Saving, sharing and the model box

  • Save downloads a JSON file; Open reads one back, with validation and limits.
  • Share puts a base64 scene in the URL hash (copy it from the address bar). Very large scenes are rejected; use the JSON file instead.
  • The scene is autosaved in localStorage; New starts from a ground segment only.
  • The bottom panel shows the model table, the governing equations (Newton–Euler, contact impulse, friction, spring, rod inertia, thread and support constraints) and a trap selected from the scene features (threads, supports, springs, pins, collisions, rolling).

Hand checks with the builder

  1. Load Rolling on an incline; the cylinder should reach about 3.33 m/s after 0.5 s on the horizontal test (builder engine check) because v = v0/(1+k) for a disk with k = 0.5.
  2. Load Eccentric elastic collision and check the momentum: 2 kg × 5 m/s = 10 kg·m/s before and after; the total kinetic energy stays 25 J with e = 1 and no friction.
  3. Load Spring oscillator: the total mechanical energy (KE + spring PE + gravity) stays within about 0.01 % over 5 s at the fixed 1 ms step.
  4. Load Lever on a support: the fulcrum point must stay fixed while the rod rotates; load Spindle / flywheel: the axle holds the centre while the disk spins at constant ω.
  5. Load Thread pendulum: the thread length stays 1.414 m (up to 1 mm) and the total energy is conserved; a slack thread must not push the bob.
Limits of the builder: planar disks, rods (capsules) and line segments only (no boxes/polygons or stacking); no continuous collision detection, so very fast bodies can tunnel through thin segments; threads are ideal (no stretch, no bending, no pulley routing); supports are ideal pivots (no bearing friction or compliance). The car load-transfer and gyroscope models are not part of this generic solver and remain in the lab. The solver uses velocity Verlet plus sequential impulses at a fixed 1 ms step, with 8 iterations and a small Baumgarte correction.

Files: builder.php, js/builder/model.js, engine.js, demos.js, theory.js, render.js, ui.js; checks in tools/dynamics_builder_check.js and tools/dynamics_builder_smoke.js. Open the Scenario Builder.