How this calculation works
Compute the first contact and complete overlap-time interval for two convex polygons translating at constant velocities.
For every edge normal n, intersect times satisfying min_A(t)<=max_B(t) and min_B(t)<=max_A(t).A worked example
A unit square moving right at one unit per time meets the stationary square spanning x=3 to 4 at time 2. Their closed shapes intersect through time 4.
Good to know
Two convex polygons≤20 vertices, constant planar velocities and finite horizon. Intersect continuous separating-axis time intervals, distinguish initial overlap, touching and no collision; provide active axis/contact witness. No rotation, acceleration, arbitrary concavity or frame-sampling guarantee.
Reference: Primary method or official documentation (opens in a new tab) ↗
Continuous contact rather than frame sampling
Two moving polygons can collide between two displayed animation frames. A continuous collision calculation follows their motion over the whole time interval and finds the first instant at which the closed shapes intersect. For constant translations of convex polygons, this can be determined from one-dimensional projection intervals without taking a sequence of guessed time samples.
The returned time is relative to the entered initial positions and velocities. Touching counts as intersection under the closed-shape convention. A single instant of grazing contact can therefore be a valid answer even if the interiors never overlap for a positive duration. The status must distinguish that event from an interval of overlap and from no collision.
Compare this with the Convex polygon intersection area calculator from coordinates. Find the first and last contact times during prescribed translation, rather than intersect polygons at one static instant.
Preparing the polygon and velocity inputs
List each convex polygon's boundary vertices consecutively. Vertices must form a nondegenerate simple convex boundary; a concave shape cannot be treated as convex merely by preserving its row order. Supply a constant two-component velocity for each polygon and a finite nonnegative time horizon. Position and velocity must use consistent spatial and time units.
The motion is translation only. Edge orientations and separating axes stay fixed, making the interval construction valid. Rotation, acceleration or changing vertex positions alter that assumption. Replacing a rotating polygon with its initial orientation would answer a different problem and could miss a collision, so those motions require another method instead of an undocumented approximation here.
Projecting onto separating axes
For each edge normal from both polygons, project all vertices to find a minimum and maximum scalar coordinate. Two convex polygons are disjoint when at least one such axis has disjoint projection intervals. Under constant translation, each endpoint moves linearly in time at the normal component of its polygon's velocity.
The overlap conditions on an axis become two linear inequalities in time. Their intersection gives either an allowed interval, all times or no times. Intersecting those intervals over every edge normal gives the complete contact interval within the requested horizon. This reduces a continuous two-dimensional question to a finite collection of exactly stated one-dimensional motion constraints.
Relative velocity and stationary axes
Only the velocity difference affects whether the polygons meet. Adding the same velocity to both shapes should leave contact times unchanged. If the relative normal velocity is zero on an axis, its projection gap cannot close on that axis. A positive initial gap then proves no collision, while initial projection overlap imposes no additional time restriction there.
The latest entry time among all axes determines first contact. The earliest exit time determines when intersection ends. If entry exceeds exit, the polygons never meet within the horizon. Equality represents an isolated touching event. An initially overlapping pair has entry time zero in the clipped result, even if its unrestricted overlap interval began before the chosen starting instant.
The moving-square worked example
The first default polygon is the unit square from x zero to one and y zero to one. It moves right at one coordinate unit per time unit. The second unit square is stationary between x three and four with the same y range. Their vertical projections already overlap, while their horizontal gap is initially two.
At time two, the moving square's right side reaches x three, producing first contact. At time four, its left side reaches x four, producing the last contact. The closed shapes therefore intersect on the interval from two through four. A horizon of one would return no collision during that horizon, although the same motions would meet later.
Witnesses and numerical checks
The active axis identifies which projection inequality becomes tight at first contact. Translating the two polygons to that time should show nonnegative overlap on all axes and a near-zero overlap on at least one separating direction. A contact witness should be interpreted alongside these projection residuals, because a rounded display may make a tiny contact gap look positive or negative.
Swapping the two polygons should preserve the interval. Translating both initial polygons by the same vector should also preserve it. Doubling both velocities while leaving the horizon sufficiently long should halve the contact times. These are useful independent structural tests in addition to checking the square example, and they expose sign mistakes in the entry and exit formulas.
Limits of the collision statement
This calculation concerns the entered ideal closed polygons. It does not include manufacturing tolerances, safety margins or the swept volume of a three-dimensional object. If a nonzero clearance is needed, the geometry must be expanded appropriately before applying a suitable collision method. A contact event alone is not a physically simulated impact response.
The page does not compute bouncing, friction, deformation or post-contact velocities. It identifies when the prescribed motions intersect. A no-collision result means no collision within the stated finite horizon under constant translation, not that the objects can never meet after the horizon or under a future change in direction or speed.
A few questions, answered
Does touching count as a collision?
Yes. Closed polygon intersection includes edge or vertex contact, even for a single instant.
Why can a zero relative speed prove no collision?
On a separating axis with an initial gap and zero relative normal speed, that gap never closes.
Can I enter angular velocity?
No. The fixed-axis construction supports translation only.
Does no collision mean never?
It means no intersection within the supplied finite time horizon under the stated constant velocities.