| 347 | } |
| 348 | |
| 349 | func B2GetPointStates(state1 *[B2_maxManifoldPoints]uint8, state2 *[B2_maxManifoldPoints]uint8, manifold1 B2Manifold, manifold2 B2Manifold) { |
| 350 | |
| 351 | for i := 0; i < B2_maxManifoldPoints; i++ { |
| 352 | state1[i] = B2PointState.B2_nullState |
| 353 | state2[i] = B2PointState.B2_nullState |
| 354 | } |
| 355 | |
| 356 | // Detect persists and removes. |
| 357 | for i := 0; i < manifold1.PointCount; i++ { |
| 358 | id := manifold1.Points[i].Id |
| 359 | |
| 360 | state1[i] = B2PointState.B2_removeState |
| 361 | |
| 362 | for j := 0; j < manifold2.PointCount; j++ { |
| 363 | if manifold2.Points[j].Id.Key() == id.Key() { |
| 364 | state1[i] = B2PointState.B2_persistState |
| 365 | break |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | // Detect persists and adds. |
| 371 | for i := 0; i < manifold2.PointCount; i++ { |
| 372 | id := manifold2.Points[i].Id |
| 373 | |
| 374 | state2[i] = B2PointState.B2_addState |
| 375 | |
| 376 | for j := 0; j < manifold1.PointCount; j++ { |
| 377 | if manifold1.Points[j].Id.Key() == id.Key() { |
| 378 | state2[i] = B2PointState.B2_persistState |
| 379 | break |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | // From Real-time Collision Detection, p179. |
| 386 | func (bb B2AABB) RayCast(output *B2RayCastOutput, input B2RayCastInput) bool { |