22 #ifndef PLAYRHO_DYNAMICS_CONTACTS_CONTACT_HPP
23 #define PLAYRHO_DYNAMICS_CONTACTS_CONTACT_HPP
45 assert(friction1 >= 0 && friction2 >= 0);
46 return sqrt(friction1 * friction2);
56 return (restitution1 > restitution2) ? restitution1 : restitution2;
66 class ContactListener;
137 [[deprecated]]
void SetEnabled(
bool flag) noexcept;
220 using FlagsType = std::uint8_t;
229 e_touchingFlag = 0x02,
232 e_enabledFlag = 0x04,
246 void UnflagForFiltering() noexcept;
249 void UnflagForUpdating() noexcept;
265 void Update(const UpdateConf& conf,
ContactListener* listener =
nullptr);
273 void SetToi(
Real toi) noexcept;
276 void UnsetToi() noexcept;
286 void SetTouching() noexcept;
289 void UnsetTouching() noexcept;
294 Manifold& GetMutableManifold() noexcept;
297 bool IsIslanded() const noexcept;
300 void SetIslanded() noexcept;
303 void UnsetIslanded() noexcept;
334 FlagsType m_flags = e_enabledFlag|e_dirtyFlag;
348 inline Manifold& Contact::GetMutableManifold() noexcept
367 m_flags |= Contact::e_enabledFlag;
372 m_flags &= ~
Contact::e_enabledFlag;
377 return (m_flags & e_enabledFlag) != 0;
384 return (m_flags & e_touchingFlag) != 0;
387 inline void Contact::SetTouching() noexcept
389 m_flags |= e_touchingFlag;
392 inline void Contact::UnsetTouching() noexcept
394 m_flags &= ~e_touchingFlag;
409 m_flags |= e_filterFlag;
412 inline void Contact::UnflagForFiltering() noexcept
414 m_flags &= ~
Contact::e_filterFlag;
419 return (m_flags & Contact::e_filterFlag) != 0;
424 m_flags |= e_dirtyFlag;
427 inline void Contact::UnflagForUpdating() noexcept
429 m_flags &= ~
Contact::e_dirtyFlag;
434 return (m_flags & Contact::e_dirtyFlag) != 0;
439 assert(friction >= 0);
440 m_friction = friction;
450 m_restitution = restitution;
455 return m_restitution;
460 m_tangentSpeed = speed;
465 return m_tangentSpeed;
470 return (m_flags & Contact::e_toiFlag) != 0;
479 inline void Contact::SetToi(
Real toi) noexcept
481 assert(toi >= 0 && toi <= 1);
483 m_flags |= Contact::e_toiFlag;
486 inline void Contact::UnsetToi() noexcept
488 m_flags &= ~
Contact::e_toiFlag;
491 inline void Contact::SetToiCount(
substep_type value) noexcept
501 inline bool Contact::IsIslanded() const noexcept
503 return (m_flags & e_islandFlag) != 0;
506 inline void Contact::SetIslanded() noexcept
508 m_flags |= e_islandFlag;
511 inline void Contact::UnsetIslanded() noexcept
513 m_flags &= ~e_islandFlag;
543 return contact.GetFixtureA();
550 return contact.GetFixtureB();
557 return contact.GetChildIndexA();
564 return contact.GetChildIndexB();
598 #endif // PLAYRHO_DYNAMICS_CONTACTS_CONTACT_HPP