Maritime Science Life

Calculations with context

CPA and TCPA calculator

Calculate CPA, TCPA and minimum separation within a selected time horizon using a constant-velocity relative-motion model.

Explore how relative motion, time direction and a prediction window change the minimum separation between two reference points.

Common starting instant t₀: both positions and ground-velocity vectors must refer to the same instant and the same east/north frame. Positive east is right; positive north is up. The own-ship reference point remains at (0, 0) in this relative frame.

Set up the encounter
Target position relative to own ship at t₀
Relative east / north components

Relative velocity = target ground velocity − own-ship ground velocity. Negative east means west; negative north means south.

Teaching input limits: each position component ±1,000 NM; each relative-velocity component ±200 kn; vessel SOG 0–100 kn; COG 0° to less than 360°. These limits do not establish model accuracy. Use a decimal point, for example 2.5.

0–1,440 minutes. Leave blank for no time-window constraint. Zero asks only about t₀. The same constant-motion assumption applies throughout.

Worked example loaded

Read the three different minima

Future-only closest approach

2 NM

at 30 min

From t₀ onward, with no upper time limit

Minimum inside the window

3.887 NM

at 5 min / 5 min

From t₀ to the entered horizon

Whole-line geometry

30 min

Signed TCPA · Whole-line DCPA: 2 NM

The mathematical time line includes the past.

Current separation

4.472 NM

Closing at t₀

Relative speed: 8 kn

The minimum is at the horizon boundary. This window can end before the whole-line closest approach.

Displayed numbers are rounded; extra digits in the CSV are computational precision, not sensor accuracy.

Relative-motion diagram

Relative-motion diagramEqual-scale east/north relative-motion diagram. Own ship is at the origin. The table below provides numerical positions and times.-0.643.640.682.32213.32-0.324.64-1.64East (NM)North (NM)
  • Own ship
  • Target at t₀
  • Future closest
  • Horizon

This is a point-motion diagram, not a nautical chart. Both axes use the same scale in NM. Marker sizes do not represent hulls.

Solid path: entered window. Dashed extension, if shown: future closest point outside that window.

Numerical counterpart to the relative-motion diagram
Reference point / eventTime from t₀ (min)East (NM)North (NM)Separation (NM)
Own ship000—
Target at t₀0424.472
Future closest30022
Horizon53.33323.887

Calculations stay in this page. CSV export happens only when you click Download; no calculation data is sent to an external service.

How the calculation works

Use nautical miles for position and knots for velocity; time in the vector equation is in hours. DCPA is a distance. TCPA is a signed time, so a negative value is not a future countdown.

  1. r(t) = r₀ + vᵣ t
  2. vᵣ = vtarget − vown
  3. tline = −(r₀ · vᵣ) / (vᵣ · vᵣ), when relative speed is nonzero
  4. DCPAline = |r₀ + vᵣ tline|
  5. tfuture = max(0, tline)
  6. twindow = max(0, min(H, tline))

For COG θ and SOG s: east velocity = s sin θ; north velocity = s cos θ. Angles are converted from degrees before evaluating sine and cosine. Results convert hours to minutes.

At exactly zero relative velocity, separation is constant and every time is a minimizing time. The calculator reports no unique TCPA rather than dividing by zero. Very small nonzero relative speeds can produce a distant, highly sensitive TCPA.

Reproduce the worked example

These are invented teaching inputs, not an observed encounter: r₀ = (4, 2) NM and vᵣ = (−8, 0) kn.

  • Current separation: √(4² + 2²) = 4.472 NM.
  • Signed TCPA: −[4 × (−8) + 2 × 0] / 64 = 0.5 h = 30 min.
  • At 30 min: relative position (0, 2) NM; whole-line and future DCPA = 2.000 NM.
  • Within only the next 5 min: position at the minimum is (3.333, 2) NM; minimum separation = 3.887 NM at the window boundary.

Assumptions and interpretation

  • Both vessels retain constant COG and SOG. Maneuvers, acceleration, current changes and delayed responses are excluded.
  • The east/north model is planar and local. It is not a geodesic calculation; large distances and long extrapolations weaken its physical relevance.
  • Positions and velocities are synchronized at t₀. This tool does not align sensor timestamps or retrieve AIS, radar or live position data.
  • Distances are between reference points. Hull shape, beam, tow, shoreline, depth and clearance are not represented.
  • Measurement error and uncertainty are not modeled. Neither a small nor a large DCPA alone gives a collision probability or a universal passing-distance verdict.

Read the context

The equations and numerical example follow the site’s relative-motion guide. The primary sources explain the wider observation and navigation-rule context.

The USCG states that the navigation rules do not prescribe one distinct safe passing distance. IMO’s COLREG overview describes lookout and risk-assessment duties. This teaching tool does not apply encounter rules or decide operational action.

Read the method and its limits

Related project: Colav Lab

All calculators