PlayRho
1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
|
|
This is the googletest
based unit testing file for the free function interfaces to playrho::d2::World
contact member functions and additional functionality.
#include "UnitTests.hpp"
#include <PlayRho/Dynamics/WorldContact.hpp>
#include <PlayRho/Dynamics/World.hpp>
#include <PlayRho/Dynamics/WorldFixture.hpp>
#include <PlayRho/Dynamics/WorldBody.hpp>
#include <PlayRho/Dynamics/WorldMisc.hpp>
#include <PlayRho/Dynamics/StepConf.hpp>
#include <PlayRho/Dynamics/BodyConf.hpp>
#include <PlayRho/Dynamics/FixtureConf.hpp>
#include <PlayRho/Collision/Shapes/DiskShapeConf.hpp>
{
const auto c = contacts.begin()->second;
}
{
const auto c = contacts.begin()->second;
ASSERT_NEAR(
static_cast<double>(
GetFriction(world, c)),
0.01);
EXPECT_NEAR(
static_cast<double>(
GetFriction(world, c)),
0.01);
}
{
const auto c = contacts.begin()->second;
}
TEST(WorldContact, SetUnsetEnabled)
{
const auto c = contacts.begin()->second;
}
{
const auto c = contacts.begin()->second;
{
}
{
}
}
TEST(WorldContact, WorldManifoldAndMore)
{
const auto c = contacts.begin()->second;
{
EXPECT_EQ(manifold.GetPointCount(), 1u);
}
}
void UnsetEnabled(Body &body) noexcept
Unsets the enabled state.
Definition: Body.hpp:787
@ Static
Static body type.
BodyID CreateBody(World &world, const BodyConf &def)
Creates a rigid body with the given configuration.
Definition: WorldBody.cpp:58
constexpr BodyConf & UseType(BodyType t) noexcept
Use the given type.
Definition: BodyConf.hpp:166
Name space for 2-dimensionally related PlayRho names.
Definition: AABB.cpp:34
static constexpr UnitVec GetRight() noexcept
Gets the right-ward oriented unit vector.
Definition: UnitVec.hpp:74
auto HasValidToi(const Contact &contact) noexcept
Gets whether a TOI is set.
Definition: Contact.hpp:694
bool IsAwake(const Body &body) noexcept
Gets the awake/asleep state of this body.
Definition: Body.hpp:808
Essentially a Manifold expressed in world coordinate terms.
Definition: WorldManifold.hpp:41
SizedRange< std::vector< KeyedContactPtr >::const_iterator > GetContacts(const World &world, BodyID id)
Gets the container of all contacts attached to the identified body.
Definition: WorldBody.cpp:478
Name space for all PlayRho related names.
Definition: AABB.cpp:33
WorldManifold GetWorldManifold(const Manifold &manifold, Transformation xfA, Length radiusA, Transformation xfB, Length radiusB)
Gets the world manifold for the given data.
Definition: WorldManifold.cpp:105
ChildCounter GetChildIndexB(const Contact &contact) noexcept
Gets the child index B of the given contact.
Definition: Contact.hpp:616
ChildCounter GetChildIndexA(const Contact &contact) noexcept
Gets the child index A of the given contact.
Definition: Contact.hpp:609
Definition of an independent and simulatable "world".
Definition: World.hpp:129
void SetTangentSpeed(Contact &contact, LinearVelocity value) noexcept
Sets the desired tangent speed for a conveyor belt behavior.
Definition: Contact.hpp:766
Wider< BodyCounter >::type ContactCounter
Count type for contacts.
Definition: Settings.hpp:221
Real GetFriction(const Shape &shape) noexcept
Gets the coefficient of friction.
Definition: Shape.hpp:294
auto GetTangentSpeed(const Contact &contact) noexcept
Gets the desired tangent speed.
Definition: Contact.hpp:757
void UnsetAwake(Body &body) noexcept
Sets this body to asleep if sleeping is allowed.
Definition: Body.hpp:837
void SetFriction(Contact &contact, Real value) noexcept
Sets the friction value for the identified contact.
Definition: Contact.hpp:728
void ResetRestitution(World &world, ContactID id)
Resets the restitution to the default value.
Definition: WorldContact.hpp:233
bool IsEnabled(const Body &body) noexcept
Gets the enabled/disabled state of the body.
Definition: Body.hpp:771
constexpr bool empty(IndexPair3 pairs) noexcept
Checks whether the given collection of index pairs is empty.
Definition: IndexPair.hpp:69
void SetEnabled(Body &body) noexcept
Sets the enabled state.
Definition: Body.hpp:779
std::remove_const< decltype(MaxChildCount)>::type ChildCounter
Child counter type.
Definition: Settings.hpp:97
Step configuration.
Definition: StepConf.hpp:42
auto GetToiCount(const Contact &contact) noexcept
Gets the time of impact count.
Definition: Contact.hpp:672
FixtureID CreateFixture(World &world, FixtureConf def, bool resetMassData)
Creates a fixture within the specified world.
Definition: WorldFixture.cpp:48
float Real
Real-number type.
Definition: Real.hpp:69
void SetRestitution(Contact &contact, Real value)
Sets the restitution value for the identified contact.
Definition: Contact.hpp:748
Configuration for a body.
Definition: BodyConf.hpp:50
Real GetRestitution(const Shape &shape) noexcept
Gets the coefficient of restitution value of the given shape.
Definition: Shape.hpp:299
void ResetFriction(World &world, ContactID id)
Resets the friction mixture to the default value.
Definition: WorldContact.hpp:225
void SetAwake(Body &body) noexcept
Awakens this body.
Definition: Body.hpp:822
FixtureID GetFixtureB(const Contact &contact) noexcept
Gets the fixture B associated with the given contact.
Definition: Contact.hpp:602
ContactCounter GetContactRange(const World &world) noexcept
Gets the extent of the currently valid contact range.
Definition: WorldContact.cpp:34
Shape.
Definition: Shape.hpp:183
StepStats Step(WorldImpl &world, const StepConf &conf)
Steps the given world the specified amount.
Definition: WorldImplMisc.cpp:85
FixtureID GetFixtureA(const Contact &contact) noexcept
Gets the fixture A associated with the given contact.
Definition: Contact.hpp:595
PLAYRHO_QUANTITY(boost::units::si::velocity) LinearVelocity
Linear velocity quantity.
Definition: Units.hpp:167
Disk shape configuration.
Definition: DiskShapeConf.hpp:42