@flighthq/collision 0.4.0-next.1815.e47cc3c → 0.4.0-next.1821.efb1cbc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ import type { CollisionAabb2D, CollisionCapsule2D, CollisionCircle2D, CollisionContactManifold2D, CollisionObb2D, CollisionPolygon2D } from '@flighthq/types/contract';
2
+ export declare function collideCapsuleAabbContactManifold2D(a: Readonly<CollisionCapsule2D>, b: Readonly<CollisionAabb2D>, out: CollisionContactManifold2D): boolean;
3
+ export declare function collideCapsuleCapsuleContactManifold2D(a: Readonly<CollisionCapsule2D>, b: Readonly<CollisionCapsule2D>, out: CollisionContactManifold2D): boolean;
4
+ export declare function collideCapsuleObbContactManifold2D(a: Readonly<CollisionCapsule2D>, b: Readonly<CollisionObb2D>, out: CollisionContactManifold2D): boolean;
5
+ export declare function collideCapsulePolygonContactManifold2D(a: Readonly<CollisionCapsule2D>, b: Readonly<CollisionPolygon2D>, out: CollisionContactManifold2D): boolean;
6
+ export declare function collideCircleCapsuleContactManifold2D(a: Readonly<CollisionCircle2D>, b: Readonly<CollisionCapsule2D>, out: CollisionContactManifold2D): boolean;
7
+ //# sourceMappingURL=capsuleContact2D.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capsuleContact2D.d.ts","sourceRoot":"","sources":["../src/capsuleContact2D.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,cAAc,EACd,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAgBlC,wBAAgB,mCAAmC,CACjD,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,EAC5B,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAGT;AAQD,wBAAgB,sCAAsC,CACpD,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAkHT;AAgBD,wBAAgB,kCAAkC,CAChD,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC3B,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAGT;AAGD,wBAAgB,sCAAsC,CACpD,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAET;AAOD,wBAAgB,qCAAqC,CACnD,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAC9B,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC/B,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAuBT"}
@@ -0,0 +1,534 @@
1
+ import { packContactFeatureId } from './contactFeatureId';
2
+ import { clearCollisionContactManifold2D } from './contactManifold2D';
3
+ import { writeAabbVertices, writeObbVertices } from './convexVertices2D';
4
+ // Capsule contact manifolds. Separate from `shapeContact2D.ts` because the capsule is the one built-in
5
+ // whose surface is neither a polygon nor a single disc, so it shares neither the SAT-over-vertices core
6
+ // nor the one-point circle writer: it needs a separating-axis search whose candidate set includes its own
7
+ // rounded ends, and it is the only kind that can produce a TWO-POINT manifold from a curved surface.
8
+ //
9
+ // Every function here writes the normal pushing **A out of B** and places contact points on **A's
10
+ // surface**, matching `shapeContact2D.ts` exactly. Touching is exclusive: a pair at precisely zero
11
+ // separation is reported as not overlapping.
12
+ // Capsule vs axis-aligned box.
13
+ export function collideCapsuleAabbContactManifold2D(a, b, out) {
14
+ writeAabbVertices(b, capsuleScratch.vertices);
15
+ return capsulePolygonContact(a, capsuleScratch.vertices, 4, out);
16
+ }
17
+ // Capsule vs capsule.
18
+ //
19
+ // Two rounded shapes, and yet this is the pair most likely to need TWO points: two capsules lying
20
+ // side by side is a resting configuration, and a single contact point would let the pair rock about it
21
+ // forever. The parallel case is detected and clipped; everything else is a one-point rounded contact
22
+ // between the closest points on the two axes.
23
+ export function collideCapsuleCapsuleContactManifold2D(a, b, out) {
24
+ if (!(a.radius > 0) || !(b.radius > 0)) {
25
+ clearCollisionContactManifold2D(out);
26
+ return false;
27
+ }
28
+ // A separating-axis search, NOT a distance between the two axes. The distance reduction is only valid
29
+ // while the segments are disjoint: two capsules crossing in an X have axes at distance zero and are
30
+ // deeply interpenetrating, and reading that as "the surfaces just barely reach" reports a depth of
31
+ // `rA + rB` along an arbitrary perpendicular — which does not separate them at all, because clearing a
32
+ // crossed pair means moving far enough for the SEGMENTS to clear, a distance set by their lengths and
33
+ // not by their radii.
34
+ //
35
+ // The candidate set is the boundary of the pair's Minkowski difference, which is the sum of segment A,
36
+ // reflected segment B, and a disc of radius `rA + rB`: four flat sides, from the two axes' own
37
+ // perpendiculars, and four circular corners, one per endpoint pair.
38
+ let bestSeparation = Number.NEGATIVE_INFINITY;
39
+ let bestNormalX = 0;
40
+ let bestNormalY = 0;
41
+ writePerpendicular(a.x1 - a.x0, a.y1 - a.y0);
42
+ const perpAX = capsuleScratch.axis[0];
43
+ const perpAY = capsuleScratch.axis[1];
44
+ writePerpendicular(b.x1 - b.x0, b.y1 - b.y0);
45
+ const perpBX = capsuleScratch.axis[0];
46
+ const perpBY = capsuleScratch.axis[1];
47
+ for (const [nx, ny] of [
48
+ [perpAX, perpAY],
49
+ [-perpAX, -perpAY],
50
+ [perpBX, perpBY],
51
+ [-perpBX, -perpBY],
52
+ ]) {
53
+ const separation = capsuleCapsuleSeparation(a, b, nx, ny);
54
+ if (separation > bestSeparation) {
55
+ bestSeparation = separation;
56
+ bestNormalX = nx;
57
+ bestNormalY = ny;
58
+ }
59
+ }
60
+ for (const [ax, ay] of [
61
+ [a.x0, a.y0],
62
+ [a.x1, a.y1],
63
+ ]) {
64
+ for (const [bx, by] of [
65
+ [b.x0, b.y0],
66
+ [b.x1, b.y1],
67
+ ]) {
68
+ const dx = ax - bx;
69
+ const dy = ay - by;
70
+ const length = Math.hypot(dx, dy);
71
+ if (length <= EPSILON)
72
+ continue;
73
+ const separation = capsuleCapsuleSeparation(a, b, dx / length, dy / length);
74
+ if (separation > bestSeparation) {
75
+ bestSeparation = separation;
76
+ bestNormalX = dx / length;
77
+ bestNormalY = dy / length;
78
+ }
79
+ }
80
+ }
81
+ if (bestSeparation >= 0 || bestSeparation === Number.NEGATIVE_INFINITY) {
82
+ clearCollisionContactManifold2D(out);
83
+ return false;
84
+ }
85
+ const depth = -bestSeparation;
86
+ // Parallel and overlapping: the flat sides face each other and the contact is a span, not a point.
87
+ if (writeParallelAxisOverlap(a, b, bestNormalX, bestNormalY) > 0) {
88
+ out.overlapping = true;
89
+ out.normalX = bestNormalX;
90
+ out.normalY = bestNormalY;
91
+ out.depth = depth;
92
+ for (let at = 0; at < 2; at += 1) {
93
+ const point = out.points[at];
94
+ point.x = capsuleScratch.span[at * 2] - bestNormalX * a.radius;
95
+ point.y = capsuleScratch.span[at * 2 + 1] - bestNormalY * a.radius;
96
+ point.depth = depth;
97
+ point.featureId = packContactFeatureId(true, 0, 0, at === 1);
98
+ }
99
+ out.pointCount = 2;
100
+ return true;
101
+ }
102
+ // One point, on A's surface. WHICH axis point to offset from depends on how the normal sits relative
103
+ // to the axis, and getting this wrong puts the contact inside the shape rather than on it.
104
+ //
105
+ // When the normal is perpendicular to the axis the contact is on A's flat side, every axis point is
106
+ // equally valid, and the closest point to B is the best-positioned one. When it is not — a rounded end
107
+ // pressed into something — only the SUPPORT point works: `axisPoint - normal * radius` sits at
108
+ // `radius * |sin(angle)|` from the axis for any other choice, which is inside the capsule. The support
109
+ // point is on the boundary by definition, which is exactly the property needed here.
110
+ const axisLength = Math.hypot(a.x1 - a.x0, a.y1 - a.y0);
111
+ const alongAxis = axisLength > EPSILON ? ((a.x1 - a.x0) * bestNormalX + (a.y1 - a.y0) * bestNormalY) / axisLength : 0;
112
+ if (Math.abs(alongAxis) <= PARALLEL_EPSILON) {
113
+ writeClosestPointsBetweenSegments(a.x0, a.y0, a.x1, a.y1, b.x0, b.y0, b.x1, b.y1);
114
+ }
115
+ else if (a.x0 * bestNormalX + a.y0 * bestNormalY <= a.x1 * bestNormalX + a.y1 * bestNormalY) {
116
+ capsuleScratch.closest[0] = a.x0;
117
+ capsuleScratch.closest[1] = a.y0;
118
+ }
119
+ else {
120
+ capsuleScratch.closest[0] = a.x1;
121
+ capsuleScratch.closest[1] = a.y1;
122
+ }
123
+ return writeSingleCapsulePoint(capsuleScratch.closest[0], capsuleScratch.closest[1], a.radius, bestNormalX, bestNormalY, depth, 0, out);
124
+ }
125
+ // How far A's surface clears B's along `normal`, which points from B toward A. Negative means
126
+ // overlapping. Both extents come from the axes plus a radius, with no surface to sample.
127
+ function capsuleCapsuleSeparation(a, b, normalX, normalY) {
128
+ const minimumA = Math.min(a.x0 * normalX + a.y0 * normalY, a.x1 * normalX + a.y1 * normalY) - a.radius;
129
+ const maximumB = Math.max(b.x0 * normalX + b.y0 * normalY, b.x1 * normalX + b.y1 * normalY) + b.radius;
130
+ return minimumA - maximumB;
131
+ }
132
+ // Capsule vs oriented box.
133
+ export function collideCapsuleObbContactManifold2D(a, b, out) {
134
+ writeObbVertices(b, capsuleScratch.vertices);
135
+ return capsulePolygonContact(a, capsuleScratch.vertices, 4, out);
136
+ }
137
+ // Capsule vs convex polygon.
138
+ export function collideCapsulePolygonContactManifold2D(a, b, out) {
139
+ return capsulePolygonContact(a, b.points, b.points.length >> 1, out);
140
+ }
141
+ // Circle vs capsule.
142
+ //
143
+ // Exactly circle-vs-circle once the capsule is reduced to the disc at its closest axis point, which is
144
+ // what a capsule IS at any single point of contact — there is no separate body and cap case to get
145
+ // wrong, and no approximation in saying so.
146
+ export function collideCircleCapsuleContactManifold2D(a, b, out) {
147
+ writeClosestPointOnSegment(b.x0, b.y0, b.x1, b.y1, a.x, a.y);
148
+ const closestX = capsuleScratch.closest[0];
149
+ const closestY = capsuleScratch.closest[1];
150
+ let normalX = a.x - closestX;
151
+ let normalY = a.y - closestY;
152
+ const distance = Math.hypot(normalX, normalY);
153
+ const sum = a.radius + b.radius;
154
+ if (distance >= sum) {
155
+ clearCollisionContactManifold2D(out);
156
+ return false;
157
+ }
158
+ if (distance > EPSILON) {
159
+ normalX /= distance;
160
+ normalY /= distance;
161
+ }
162
+ else {
163
+ // The circle's centre sits on the capsule's axis. Push it out sideways: the perpendicular is the
164
+ // shortest way out of a capsule from its own axis, and it is defined even here.
165
+ writePerpendicular(b.x1 - b.x0, b.y1 - b.y0);
166
+ normalX = capsuleScratch.axis[0];
167
+ normalY = capsuleScratch.axis[1];
168
+ }
169
+ return writeSingleCapsulePoint(a.x, a.y, a.radius, normalX, normalY, sum - distance, 0, out);
170
+ }
171
+ // The separating-axis search for a capsule against a convex polygon, and the clipping that follows it.
172
+ //
173
+ // The candidate set is what makes this exact rather than approximate, and it has three parts because a
174
+ // capsule can meet a polygon three ways:
175
+ // - the polygon's face normals, for the capsule resting against a flat side;
176
+ // - the capsule's own two side normals, for a polygon face lying along the capsule's straight body;
177
+ // - the direction from each polygon VERTEX to the nearest point on the capsule's axis, for a rounded
178
+ // end pressed into a corner. Nothing else covers that case: at a corner the deepest direction is
179
+ // radial from the vertex and matches no face normal of either shape, so a search over face normals
180
+ // alone reports a corner contact along whichever face happens to be least wrong.
181
+ function capsulePolygonContact(a, vertices, count, out) {
182
+ if (count < 3 || !(a.radius > 0)) {
183
+ clearCollisionContactManifold2D(out);
184
+ return false;
185
+ }
186
+ let bestSeparation = Number.NEGATIVE_INFINITY;
187
+ let bestNormalX = 0;
188
+ let bestNormalY = 0;
189
+ let bestFace = -1;
190
+ let bestSource = SOURCE_VERTEX;
191
+ let bestIndex = 0;
192
+ for (let face = 0; face < count; face += 1) {
193
+ const next = face + 1 === count ? 0 : face + 1;
194
+ const x0 = vertices[face << 1];
195
+ const y0 = vertices[(face << 1) + 1];
196
+ const edgeX = vertices[next << 1] - x0;
197
+ const edgeY = vertices[(next << 1) + 1] - y0;
198
+ const length = Math.hypot(edgeX, edgeY);
199
+ if (length <= EPSILON)
200
+ continue;
201
+ // Both windings are admitted, as everywhere else in this package, by orienting the face normal
202
+ // away from the polygon's own interior rather than by assuming a winding.
203
+ let normalX = edgeY / length;
204
+ let normalY = -edgeX / length;
205
+ if (!isOutwardFromPolygon(vertices, count, x0, y0, normalX, normalY)) {
206
+ normalX = -normalX;
207
+ normalY = -normalY;
208
+ }
209
+ const separation = capsuleSeparation(a, vertices, count, normalX, normalY);
210
+ if (separation > bestSeparation) {
211
+ bestSeparation = separation;
212
+ bestNormalX = normalX;
213
+ bestNormalY = normalY;
214
+ bestFace = face;
215
+ bestSource = SOURCE_POLYGON_FACE;
216
+ bestIndex = face;
217
+ }
218
+ }
219
+ writePerpendicular(a.x1 - a.x0, a.y1 - a.y0);
220
+ for (let side = 0; side < 2; side += 1) {
221
+ const normalX = side === 0 ? capsuleScratch.axis[0] : -capsuleScratch.axis[0];
222
+ const normalY = side === 0 ? capsuleScratch.axis[1] : -capsuleScratch.axis[1];
223
+ const separation = capsuleSeparation(a, vertices, count, normalX, normalY);
224
+ if (separation > bestSeparation) {
225
+ bestSeparation = separation;
226
+ bestNormalX = normalX;
227
+ bestNormalY = normalY;
228
+ bestFace = -1;
229
+ bestSource = SOURCE_CAPSULE_SIDE;
230
+ bestIndex = side;
231
+ }
232
+ }
233
+ for (let vertex = 0; vertex < count; vertex += 1) {
234
+ const vx = vertices[vertex << 1];
235
+ const vy = vertices[(vertex << 1) + 1];
236
+ writeClosestPointOnSegment(a.x0, a.y0, a.x1, a.y1, vx, vy);
237
+ const dx = capsuleScratch.closest[0] - vx;
238
+ const dy = capsuleScratch.closest[1] - vy;
239
+ const length = Math.hypot(dx, dy);
240
+ if (length <= EPSILON)
241
+ continue;
242
+ const normalX = dx / length;
243
+ const normalY = dy / length;
244
+ const separation = capsuleSeparation(a, vertices, count, normalX, normalY);
245
+ if (separation > bestSeparation) {
246
+ bestSeparation = separation;
247
+ bestNormalX = normalX;
248
+ bestNormalY = normalY;
249
+ bestFace = -1;
250
+ bestSource = SOURCE_VERTEX;
251
+ bestIndex = vertex;
252
+ }
253
+ }
254
+ if (bestSeparation >= 0 || bestSeparation === Number.NEGATIVE_INFINITY) {
255
+ clearCollisionContactManifold2D(out);
256
+ return false;
257
+ }
258
+ const depth = -bestSeparation;
259
+ // A polygon face won, and the capsule's axis lies along it: the contact is a span. Clipping the axis
260
+ // to the face's extent is what produces the second point, and it is the whole reason a capsule can
261
+ // rest flat on a floor instead of rocking on one point forever.
262
+ if (bestSource === SOURCE_POLYGON_FACE && writeFaceSpan(a, vertices, count, bestFace, bestNormalX, bestNormalY)) {
263
+ out.overlapping = true;
264
+ out.normalX = bestNormalX;
265
+ out.normalY = bestNormalY;
266
+ out.depth = depth;
267
+ for (let at = 0; at < 2; at += 1) {
268
+ const point = out.points[at];
269
+ point.x = capsuleScratch.span[at * 2] - bestNormalX * a.radius;
270
+ point.y = capsuleScratch.span[at * 2 + 1] - bestNormalY * a.radius;
271
+ point.depth = capsuleScratch.spanDepth[at];
272
+ point.featureId = packContactFeatureId(false, bestFace, 0, at === 1);
273
+ }
274
+ out.pointCount = 2;
275
+ return true;
276
+ }
277
+ // One point, at whichever place on the capsule's axis is deepest along the winning normal.
278
+ writeDeepestAxisPoint(a, bestNormalX, bestNormalY, vertices, count, bestSource, bestIndex);
279
+ return writeSingleCapsulePoint(capsuleScratch.closest[0], capsuleScratch.closest[1], a.radius, bestNormalX, bestNormalY, depth, packContactFeatureId(bestSource === SOURCE_CAPSULE_SIDE, bestIndex, 0, false), out);
280
+ }
281
+ // How far the capsule's surface clears the polygon along `normal`, which points from the polygon toward
282
+ // the capsule. Negative means overlapping by that much.
283
+ //
284
+ // The capsule's extent subtracts its radius rather than scanning a surface: every point of a capsule is
285
+ // within `radius` of its axis, so the axis's own minimum along the normal, less the radius, IS the
286
+ // surface minimum with no sampling.
287
+ function capsuleSeparation(a, vertices, count, normalX, normalY) {
288
+ const axisMinimum = Math.min(a.x0 * normalX + a.y0 * normalY, a.x1 * normalX + a.y1 * normalY) - a.radius;
289
+ let polygonMaximum = Number.NEGATIVE_INFINITY;
290
+ for (let vertex = 0; vertex < count; vertex += 1) {
291
+ const projection = vertices[vertex << 1] * normalX + vertices[(vertex << 1) + 1] * normalY;
292
+ if (projection > polygonMaximum)
293
+ polygonMaximum = projection;
294
+ }
295
+ return axisMinimum - polygonMaximum;
296
+ }
297
+ // Whether `normal` at (`x`,`y`) points out of the polygon rather than into it.
298
+ function isOutwardFromPolygon(vertices, count, x, y, normalX, normalY) {
299
+ for (let vertex = 0; vertex < count; vertex += 1) {
300
+ const projection = (vertices[vertex << 1] - x) * normalX + (vertices[(vertex << 1) + 1] - y) * normalY;
301
+ if (projection > EPSILON)
302
+ return false;
303
+ }
304
+ return true;
305
+ }
306
+ // Clips the capsule's axis to the winning face's extent and keeps the result only if BOTH ends survive
307
+ // with real depth, which is what distinguishes a capsule lying along a face from one touching it at a
308
+ // point. Returns false for the point case, leaving the caller to write a single contact.
309
+ function writeFaceSpan(a, vertices, count, face, normalX, normalY) {
310
+ const axisX = a.x1 - a.x0;
311
+ const axisY = a.y1 - a.y0;
312
+ const axisLength = Math.hypot(axisX, axisY);
313
+ if (axisLength <= EPSILON)
314
+ return false;
315
+ // The capsule's flat SIDE has to be the thing facing the face, which means its axis lies along the
316
+ // face and not into it. Without this a near-end-on capsule still projects a span onto the face and
317
+ // still clears both depth checks, and the two points it produces are placed by stepping `radius` along
318
+ // a normal that is nearly parallel to the axis — which lands them deep INSIDE the capsule rather than
319
+ // on it. An end-on capsule has one genuine point of contact and must be left to the single-point path.
320
+ if (Math.abs((axisX / axisLength) * normalX + (axisY / axisLength) * normalY) > PARALLEL_EPSILON)
321
+ return false;
322
+ const next = face + 1 === count ? 0 : face + 1;
323
+ const faceX0 = vertices[face << 1];
324
+ const faceY0 = vertices[(face << 1) + 1];
325
+ const faceX1 = vertices[next << 1];
326
+ const faceY1 = vertices[(next << 1) + 1];
327
+ const tangentX = faceX1 - faceX0;
328
+ const tangentY = faceY1 - faceY0;
329
+ const faceLength = Math.hypot(tangentX, tangentY);
330
+ if (faceLength <= EPSILON)
331
+ return false;
332
+ const unitX = tangentX / faceLength;
333
+ const unitY = tangentY / faceLength;
334
+ // The capsule's axis projected onto the face's own direction, clipped to the face's span.
335
+ const start = (a.x0 - faceX0) * unitX + (a.y0 - faceY0) * unitY;
336
+ const end = (a.x1 - faceX0) * unitX + (a.y1 - faceY0) * unitY;
337
+ const low = Math.max(Math.min(start, end), 0);
338
+ const high = Math.min(Math.max(start, end), faceLength);
339
+ if (high - low <= CONTACT_SPAN_EPSILON)
340
+ return false;
341
+ for (let at = 0; at < 2; at += 1) {
342
+ const along = at === 0 ? low : high;
343
+ // Back from the face's parameter to the point on the capsule's axis with that projection.
344
+ const fraction = (along - start) / (end - start);
345
+ const x = a.x0 + (a.x1 - a.x0) * fraction;
346
+ const y = a.y0 + (a.y1 - a.y0) * fraction;
347
+ capsuleScratch.span[at * 2] = x;
348
+ capsuleScratch.span[at * 2 + 1] = y;
349
+ capsuleScratch.spanDepth[at] = a.radius - ((x - faceX0) * normalX + (y - faceY0) * normalY);
350
+ }
351
+ // A span whose ends do not both touch is a point contact wearing a span's clothing: keeping it would
352
+ // hand the solver a contact at a place the shapes are not in contact.
353
+ return capsuleScratch.spanDepth[0] > 0 && capsuleScratch.spanDepth[1] > 0;
354
+ }
355
+ // The point on the capsule's AXIS that is deepest along the contact normal, written into `closest`.
356
+ function writeDeepestAxisPoint(a, normalX, normalY, vertices, count, source, index) {
357
+ if (source === SOURCE_VERTEX) {
358
+ // The winning axis came from this vertex, so the contact is where the axis is nearest to it.
359
+ writeClosestPointOnSegment(a.x0, a.y0, a.x1, a.y1, vertices[index << 1], vertices[(index << 1) + 1]);
360
+ return;
361
+ }
362
+ const projection0 = a.x0 * normalX + a.y0 * normalY;
363
+ const projection1 = a.x1 * normalX + a.y1 * normalY;
364
+ if (source === SOURCE_CAPSULE_SIDE) {
365
+ // A capsule side won, so both endpoints project equally along the normal and the axial position is
366
+ // undetermined by it. The polygon's own deepest vertex decides where along the capsule to sit.
367
+ let deepest = 0;
368
+ let deepestProjection = Number.NEGATIVE_INFINITY;
369
+ for (let vertex = 0; vertex < count; vertex += 1) {
370
+ const value = vertices[vertex << 1] * normalX + vertices[(vertex << 1) + 1] * normalY;
371
+ if (value > deepestProjection) {
372
+ deepestProjection = value;
373
+ deepest = vertex;
374
+ }
375
+ }
376
+ writeClosestPointOnSegment(a.x0, a.y0, a.x1, a.y1, vertices[deepest << 1], vertices[(deepest << 1) + 1]);
377
+ return;
378
+ }
379
+ if (projection0 <= projection1) {
380
+ capsuleScratch.closest[0] = a.x0;
381
+ capsuleScratch.closest[1] = a.y0;
382
+ }
383
+ else {
384
+ capsuleScratch.closest[0] = a.x1;
385
+ capsuleScratch.closest[1] = a.y1;
386
+ }
387
+ }
388
+ // The overlap of two parallel capsule axes along their shared direction, written into `span` as points
389
+ // on A's axis. Returns the overlap length, or 0 when the pair is not parallel enough to have one.
390
+ function writeParallelAxisOverlap(a, b, normalX, normalY) {
391
+ const axisAX = a.x1 - a.x0;
392
+ const axisAY = a.y1 - a.y0;
393
+ const lengthA = Math.hypot(axisAX, axisAY);
394
+ const lengthB = Math.hypot(b.x1 - b.x0, b.y1 - b.y0);
395
+ if (lengthA <= EPSILON || lengthB <= EPSILON)
396
+ return 0;
397
+ const unitX = axisAX / lengthA;
398
+ const unitY = axisAY / lengthA;
399
+ // Both axes must be perpendicular to the contact normal, which is what "lying side by side" means.
400
+ // A pair meeting end-to-end or at an angle has a genuine single point of contact and must not be
401
+ // handed a fabricated second one.
402
+ if (Math.abs(unitX * normalX + unitY * normalY) > PARALLEL_EPSILON)
403
+ return 0;
404
+ const unitBX = (b.x1 - b.x0) / lengthB;
405
+ const unitBY = (b.y1 - b.y0) / lengthB;
406
+ if (Math.abs(unitBX * normalX + unitBY * normalY) > PARALLEL_EPSILON)
407
+ return 0;
408
+ const startB = (b.x0 - a.x0) * unitX + (b.y0 - a.y0) * unitY;
409
+ const endB = (b.x1 - a.x0) * unitX + (b.y1 - a.y0) * unitY;
410
+ const low = Math.max(Math.min(startB, endB), 0);
411
+ const high = Math.min(Math.max(startB, endB), lengthA);
412
+ const overlap = high - low;
413
+ if (overlap <= CONTACT_SPAN_EPSILON)
414
+ return 0;
415
+ capsuleScratch.span[0] = a.x0 + unitX * low;
416
+ capsuleScratch.span[1] = a.y0 + unitY * low;
417
+ capsuleScratch.span[2] = a.x0 + unitX * high;
418
+ capsuleScratch.span[3] = a.y0 + unitY * high;
419
+ return overlap;
420
+ }
421
+ // The closest point on a segment to a point, written into `closest[0..1]`.
422
+ function writeClosestPointOnSegment(x0, y0, x1, y1, px, py) {
423
+ const dx = x1 - x0;
424
+ const dy = y1 - y0;
425
+ const lengthSquared = dx * dx + dy * dy;
426
+ let t = 0;
427
+ if (lengthSquared > 0) {
428
+ t = ((px - x0) * dx + (py - y0) * dy) / lengthSquared;
429
+ t = t < 0 ? 0 : t > 1 ? 1 : t;
430
+ }
431
+ capsuleScratch.closest[0] = x0 + t * dx;
432
+ capsuleScratch.closest[1] = y0 + t * dy;
433
+ }
434
+ // The closest pair of points between two segments, written into `closest[0..3]` as A's then B's.
435
+ //
436
+ // The clamped analytic solution, with the parallel case falling back to the four endpoint-to-segment
437
+ // distances. Parallel segments have a whole interval of equally-close pairs, so any single answer is as
438
+ // correct as another and the caller decides whether the pair earns two contact points.
439
+ function writeClosestPointsBetweenSegments(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1) {
440
+ const dax = ax1 - ax0;
441
+ const day = ay1 - ay0;
442
+ const dbx = bx1 - bx0;
443
+ const dby = by1 - by0;
444
+ const rx = ax0 - bx0;
445
+ const ry = ay0 - by0;
446
+ const aa = dax * dax + day * day;
447
+ const bb = dbx * dbx + dby * dby;
448
+ const f = dbx * rx + dby * ry;
449
+ let s = 0;
450
+ let t = 0;
451
+ if (aa <= EPSILON && bb <= EPSILON) {
452
+ s = 0;
453
+ t = 0;
454
+ }
455
+ else if (aa <= EPSILON) {
456
+ t = clamp01(f / bb);
457
+ }
458
+ else {
459
+ const c = dax * rx + day * ry;
460
+ if (bb <= EPSILON) {
461
+ s = clamp01(-c / aa);
462
+ }
463
+ else {
464
+ const b = dax * dbx + day * dby;
465
+ const denominator = aa * bb - b * b;
466
+ s = denominator > EPSILON ? clamp01((b * f - c * bb) / denominator) : 0;
467
+ t = (b * s + f) / bb;
468
+ if (t < 0) {
469
+ t = 0;
470
+ s = clamp01(-c / aa);
471
+ }
472
+ else if (t > 1) {
473
+ t = 1;
474
+ s = clamp01((b - c) / aa);
475
+ }
476
+ }
477
+ }
478
+ capsuleScratch.closest[0] = ax0 + dax * s;
479
+ capsuleScratch.closest[1] = ay0 + day * s;
480
+ capsuleScratch.closest[2] = bx0 + dbx * t;
481
+ capsuleScratch.closest[3] = by0 + dby * t;
482
+ }
483
+ // The unit perpendicular of a direction, written into `axis`. Falls back to +x for a zero-length input,
484
+ // which is the degenerate capsule that is really a circle and has no axis to be perpendicular to.
485
+ function writePerpendicular(dx, dy) {
486
+ const length = Math.hypot(dx, dy);
487
+ if (length <= EPSILON) {
488
+ capsuleScratch.axis[0] = 1;
489
+ capsuleScratch.axis[1] = 0;
490
+ return;
491
+ }
492
+ capsuleScratch.axis[0] = -dy / length;
493
+ capsuleScratch.axis[1] = dx / length;
494
+ }
495
+ // The one-point manifold shared by every capsule pair that does not resolve to a span. `surfaceX`/
496
+ // `surfaceY` is the point on A's AXIS (or A's centre, for a circle) that the normal is measured from.
497
+ function writeSingleCapsulePoint(axisX, axisY, radius, normalX, normalY, depth, featureId, out) {
498
+ out.overlapping = true;
499
+ out.normalX = normalX;
500
+ out.normalY = normalY;
501
+ out.depth = depth;
502
+ const point = out.points[0];
503
+ point.x = axisX - normalX * radius;
504
+ point.y = axisY - normalY * radius;
505
+ point.depth = depth;
506
+ point.featureId = featureId;
507
+ out.pointCount = 1;
508
+ return true;
509
+ }
510
+ function clamp01(value) {
511
+ return value < 0 ? 0 : value > 1 ? 1 : value;
512
+ }
513
+ const EPSILON = 1e-9;
514
+ // A span shorter than this is a point contact, and fabricating a second point on it would hand the
515
+ // solver two contacts where the shapes touch once.
516
+ const CONTACT_SPAN_EPSILON = 1e-6;
517
+ // How close to perpendicular the two axes must be to the contact normal before the pair counts as lying
518
+ // side by side. Generous on purpose: a nearly-parallel resting pair wants two points, and one point
519
+ // short of the threshold rocks.
520
+ const PARALLEL_EPSILON = 1e-3;
521
+ const SOURCE_POLYGON_FACE = 0;
522
+ const SOURCE_CAPSULE_SIDE = 1;
523
+ const SOURCE_VERTEX = 2;
524
+ // Reused across every capsule contact: these run per collider pair per step in a physics world.
525
+ const capsuleScratch = {
526
+ axis: [0, 0],
527
+ closest: [0, 0, 0, 0],
528
+ span: [0, 0, 0, 0],
529
+ spanDepth: [0, 0],
530
+ // A Float64Array because that is what `writeAabbVertices`/`writeObbVertices` write into, and eight
531
+ // slots because both produce exactly four corners.
532
+ vertices: new Float64Array(8),
533
+ };
534
+ //# sourceMappingURL=capsuleContact2D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capsuleContact2D.js","sourceRoot":"","sources":["../src/capsuleContact2D.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,uGAAuG;AACvG,wGAAwG;AACxG,0GAA0G;AAC1G,qGAAqG;AACrG,EAAE;AACF,kGAAkG;AAClG,mGAAmG;AACnG,6CAA6C;AAE7C,+BAA+B;AAC/B,MAAM,UAAU,mCAAmC,CACjD,CAA+B,EAC/B,CAA4B,EAC5B,GAA+B;IAE/B,iBAAiB,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SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACjB,mGAAmG;IACnG,mDAAmD;IACnD,QAAQ,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC;CAC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"collideContactManifold2D.d.ts","sourceRoot":"","sources":["../src/collideContactManifold2D.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EAExB,MAAM,0BAA0B,CAAC;AA0ClC,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACpC,CAAC,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACpC,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAiET"}
1
+ {"version":3,"file":"collideContactManifold2D.d.ts","sourceRoot":"","sources":["../src/collideContactManifold2D.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EAExB,MAAM,0BAA0B,CAAC;AAiDlC,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACpC,CAAC,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACpC,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAsFT"}