PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
WheelJoint.cpp

This is the googletest based unit testing file for the interfaces to playrho::d2::WheelJointConf.

/*
* Copyright (c) 2020 Louis Langholtz https://github.com/louis-langholtz/PlayRho
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "UnitTests.hpp"
#include <PlayRho/Dynamics/Joints/Joint.hpp>
#include <PlayRho/Dynamics/Joints/WheelJointConf.hpp>
#include <PlayRho/Dynamics/World.hpp>
#include <PlayRho/Dynamics/BodyConf.hpp>
#include <PlayRho/Dynamics/WorldBody.hpp>
#include <PlayRho/Dynamics/WorldFixture.hpp>
#include <PlayRho/Dynamics/WorldJoint.hpp>
#include <PlayRho/Dynamics/WorldMisc.hpp>
#include <PlayRho/Dynamics/StepConf.hpp>
#include <PlayRho/Collision/Shapes/DiskShapeConf.hpp>
#include <cstring> // for std::memcmp
using namespace playrho;
using namespace playrho::d2;
TEST(WheelJointConf, ByteSize)
{
// Check size at test runtime instead of compile-time via static_assert to avoid stopping
// builds and to report actual size rather than just reporting that expected size is wrong.
switch (sizeof(Real)) {
case 4:
EXPECT_EQ(sizeof(WheelJointConf), std::size_t(124));
break;
case 8:
EXPECT_EQ(sizeof(WheelJointConf), std::size_t(240));
break;
case 16:
EXPECT_EQ(sizeof(WheelJointConf), std::size_t(480));
break;
default:
FAIL();
break;
}
}
TEST(WheelJointConf, DefaultConstruction)
{
EXPECT_EQ(def.bodyA, InvalidBodyID);
EXPECT_EQ(def.bodyB, InvalidBodyID);
EXPECT_EQ(def.collideConnected, false);
EXPECT_EQ(def.localAnchorA, (Length2{}));
EXPECT_EQ(def.localAnchorB, (Length2{}));
EXPECT_EQ(def.localXAxisA, UnitVec::GetRight());
EXPECT_EQ(def.localYAxisA, GetRevPerpendicular(UnitVec::GetRight()));
EXPECT_FALSE(def.enableMotor);
EXPECT_EQ(def.maxMotorTorque, Torque(0));
EXPECT_EQ(def.motorSpeed, 0_rpm);
EXPECT_EQ(def.frequency, 2_Hz);
EXPECT_EQ(def.dampingRatio, Real(0.7f));
}
TEST(WheelJointConf, Traits)
{
}
TEST(WheelJointConf, Construction)
{
Joint joint{def};
EXPECT_EQ(GetType(joint), GetTypeID<WheelJointConf>());
EXPECT_EQ(GetBodyA(joint), def.bodyA);
EXPECT_EQ(GetBodyB(joint), def.bodyB);
EXPECT_EQ(GetCollideConnected(joint), def.collideConnected);
EXPECT_EQ(GetLinearReaction(joint), Momentum2{});
EXPECT_EQ(GetAngularReaction(joint), AngularMomentum{0});
EXPECT_EQ(GetLocalAnchorA(joint), def.localAnchorA);
EXPECT_EQ(GetLocalAnchorB(joint), def.localAnchorB);
EXPECT_EQ(GetLocalXAxisA(joint), def.localXAxisA);
EXPECT_EQ(IsMotorEnabled(joint), def.enableMotor);
EXPECT_EQ(GetMaxMotorTorque(joint), def.maxMotorTorque);
EXPECT_EQ(GetMotorSpeed(joint), def.motorSpeed);
EXPECT_EQ(GetFrequency(joint), def.frequency);
EXPECT_EQ(GetDampingRatio(joint), def.dampingRatio);
EXPECT_EQ(GetMotorTorque(joint, 1_Hz), 0 * NewtonMeter);
}
{
World world;
const auto b0 = CreateBody(world);
const auto b1 = CreateBody(world);
auto jd = WheelJointConf{};
jd.bodyA = b0;
jd.bodyB = b1;
jd.localAnchorA = Length2(4_m, 5_m);
jd.localAnchorB = Length2(6_m, 7_m);
auto joint = Joint{jd};
EXPECT_FALSE(IsMotorEnabled(joint));
EnableMotor(joint, false);
EXPECT_FALSE(IsMotorEnabled(joint));
EnableMotor(joint, true);
EXPECT_TRUE(IsMotorEnabled(joint));
}
TEST(WheelJointConf, MotorSpeed)
{
World world;
const auto b0 = CreateBody(world);
const auto b1 = CreateBody(world);
auto jd = WheelJointConf{};
jd.bodyA = b0;
jd.bodyB = b1;
jd.localAnchorA = Length2(4_m, 5_m);
jd.localAnchorB = Length2(6_m, 7_m);
const auto newValue = 5_rad / 1_s;
auto joint = Joint{jd};
ASSERT_NE(GetMotorSpeed(joint), newValue);
EXPECT_EQ(GetMotorSpeed(joint), jd.motorSpeed);
SetMotorSpeed(joint, newValue);
EXPECT_EQ(GetMotorSpeed(joint), newValue);
}
TEST(WheelJointConf, MaxMotorTorque)
{
World world;
const auto b0 = CreateBody(world);
const auto b1 = CreateBody(world);
auto jd = WheelJointConf{};
jd.bodyA = b0;
jd.bodyB = b1;
jd.localAnchorA = Length2(4_m, 5_m);
jd.localAnchorB = Length2(6_m, 7_m);
const auto newValue = 5_Nm;
auto joint = Joint{jd};
ASSERT_NE(GetMaxMotorTorque(joint), newValue);
EXPECT_EQ(GetMaxMotorTorque(joint), jd.maxMotorTorque);
SetMaxMotorTorque(joint, newValue);
EXPECT_EQ(GetMaxMotorTorque(joint), newValue);
}
TEST(WheelJointConf, GetAnchorAandB)
{
World world;
const auto loc0 = Length2{+1_m, -3_m};
const auto loc1 = Length2{-2_m, Real(+1.2f) * Meter};
const auto b0 = CreateBody(world, BodyConf{}.UseLocation(loc0));
const auto b1 = CreateBody(world, BodyConf{}.UseLocation(loc1));
auto jd = WheelJointConf{};
jd.bodyA = b0;
jd.bodyB = b1;
jd.localAnchorA = Length2(4_m, 5_m);
jd.localAnchorB = Length2(6_m, 7_m);
auto joint = CreateJoint(world, Joint{jd});
ASSERT_EQ(GetLocalAnchorA(world, joint), jd.localAnchorA);
ASSERT_EQ(GetLocalAnchorB(world, joint), jd.localAnchorB);
EXPECT_EQ(GetAnchorA(world, joint), loc0 + jd.localAnchorA);
EXPECT_EQ(GetAnchorB(world, joint), loc1 + jd.localAnchorB);
}
{
World world;
const auto loc0 = Length2{+1_m, -3_m};
const auto loc1 = Length2{+1_m, +3_m};
const auto b0 = CreateBody(world, BodyConf{}.UseLocation(loc0));
const auto b1 = CreateBody(world, BodyConf{}.UseLocation(loc1));
auto jd = WheelJointConf{};
jd.bodyA = b0;
jd.bodyB = b1;
jd.localAnchorA = Length2(-1_m, 5_m);
jd.localAnchorB = Length2(+1_m, 5_m);
auto joint = CreateJoint(world, Joint{jd});
EXPECT_EQ(GetJointTranslation(world, joint), Length(2_m));
}
{
Joint joint{def};
ASSERT_EQ(GetType(joint), GetTypeID<WheelJointConf>());
ASSERT_EQ(GetBodyA(joint), def.bodyA);
ASSERT_EQ(GetBodyB(joint), def.bodyB);
ASSERT_EQ(GetCollideConnected(joint), def.collideConnected);
ASSERT_EQ(GetLocalAnchorA(joint), def.localAnchorA);
ASSERT_EQ(GetLocalAnchorB(joint), def.localAnchorB);
ASSERT_EQ(GetLocalXAxisA(joint), def.localXAxisA);
ASSERT_EQ(GetLocalYAxisA(joint), def.localYAxisA);
ASSERT_EQ(IsMotorEnabled(joint), def.enableMotor);
ASSERT_EQ(GetMaxMotorTorque(joint), def.maxMotorTorque);
ASSERT_EQ(GetMotorSpeed(joint), def.motorSpeed);
ASSERT_EQ(GetFrequency(joint), def.frequency);
ASSERT_EQ(GetDampingRatio(joint), def.dampingRatio);
const auto cdef = GetWheelJointConf(joint);
EXPECT_EQ(cdef.bodyA, InvalidBodyID);
EXPECT_EQ(cdef.bodyB, InvalidBodyID);
EXPECT_EQ(cdef.collideConnected, false);
EXPECT_EQ(cdef.localAnchorA, (Length2{}));
EXPECT_EQ(cdef.localAnchorB, (Length2{}));
EXPECT_EQ(cdef.localXAxisA, UnitVec::GetRight());
EXPECT_FALSE(cdef.enableMotor);
EXPECT_EQ(cdef.maxMotorTorque, Torque(0));
EXPECT_EQ(cdef.motorSpeed, 0_rpm);
EXPECT_EQ(cdef.frequency, 2_Hz);
EXPECT_EQ(cdef.dampingRatio, Real(0.7f));
}
TEST(WheelJointConf, WithDynamicCircles)
{
const auto circle = DiskShapeConf{}.UseRadius(2_m).UseDensity(10_kgpm2);
auto world = World{};
const auto p1 = Length2{-1_m, 0_m};
const auto p2 = Length2{+1_m, 0_m};
const auto b1 = CreateBody(world, BodyConf{}.UseType(BodyType::Dynamic).UseLocation(p1));
const auto b2 = CreateBody(world, BodyConf{}.UseType(BodyType::Dynamic).UseLocation(p2));
CreateFixture(world, b1, Shape{circle});
CreateFixture(world, b2, Shape{circle});
const auto anchor = Length2(2_m, 1_m);
const auto jd = GetWheelJointConf(world, b1, b2, anchor);
const auto joint = CreateJoint(world, Joint{jd});
ASSERT_NE(joint, InvalidJointID);
auto stepConf = StepConf{};
stepConf.doWarmStart = true;
Step(world, stepConf);
EXPECT_NEAR(double(Real{GetX(GetLocation(world, b1)) / Meter}), -1.0, 0.001);
EXPECT_NEAR(double(Real{GetY(GetLocation(world, b1)) / Meter}), 0.0, 0.001);
EXPECT_NEAR(double(Real{GetX(GetLocation(world, b2)) / Meter}), +1.0, 0.01);
EXPECT_NEAR(double(Real{GetY(GetLocation(world, b2)) / Meter}), 0.0, 0.01);
EXPECT_EQ(GetAngle(world, b1), 0_deg);
EXPECT_EQ(GetAngle(world, b2), 0_deg);
EXPECT_EQ(GetAngularVelocity(world, joint), 0 * RadianPerSecond);
EXPECT_EQ(GetAngularMass(world, joint), RotInertia(0));
SetFrequency(world, joint, 0_Hz);
Step(world, stepConf);
EXPECT_FALSE(IsMotorEnabled(world, joint));
EXPECT_EQ(GetFrequency(world, joint), 0_Hz);
EXPECT_EQ(GetLinearReaction(world, joint), Momentum2{});
EXPECT_EQ(GetAngularMass(world, joint), RotInertia(0));
EnableMotor(world, joint, true);
EXPECT_TRUE(IsMotorEnabled(world, joint));
Step(world, stepConf);
EXPECT_NEAR(static_cast<double>(StripUnit(GetAngularMass(world, joint))), 125.66370391845703,
0.1);
stepConf.doWarmStart = false;
Step(world, stepConf);
EXPECT_NEAR(double(Real{GetX(GetLocation(world, b1)) / Meter}), -1.0, 0.001);
EXPECT_NEAR(double(Real{GetY(GetLocation(world, b1)) / Meter}), 0.0, 0.001);
EXPECT_NEAR(double(Real{GetX(GetLocation(world, b2)) / Meter}), +1.0, 0.01);
EXPECT_NEAR(double(Real{GetY(GetLocation(world, b2)) / Meter}), 0.0, 0.01);
EXPECT_EQ(GetAngle(world, b1), 0_deg);
EXPECT_EQ(GetAngle(world, b2), 0_deg);
EXPECT_EQ(GetAngularVelocity(world, joint), 0 * RadianPerSecond);
EXPECT_NEAR(static_cast<double>(StripUnit(GetAngularMass(world, joint))), 125.66370391845703,
0.1);
}
{
auto world = World{};
const auto bodyA = world.CreateBody();
const auto bodyB = world.CreateBody();
auto conf = WheelJointConf{bodyA, bodyB};
auto angularVelocity = AngularVelocity{};
EXPECT_NO_THROW(angularVelocity = GetAngularVelocity(world, conf));
EXPECT_EQ(angularVelocity, 0_rpm);
// TODO: add tests for angularVelocity other than 0 rpm
}
{
auto jd = WheelJointConf{BodyID(0u), BodyID(1u)};
auto copy = WheelJointConf{};
// Do copy = jd without missing padding so memcmp works
std::memcpy(&copy, &jd, sizeof(WheelJointConf));
EXPECT_FALSE(ShiftOrigin(jd, Length2{0_m, 0_m}));
// Use memcmp since easier than writing full == suport pre C++20.
EXPECT_TRUE(std::memcmp(&jd, &copy, sizeof(WheelJointConf)) == 0);
}
TEST(WheelJointConf, EqualsOperator)
{
EXPECT_TRUE(WheelJointConf() == WheelJointConf());
{
auto conf = WheelJointConf{};
conf.localAnchorA = Length2{1.2_m, -3_m};
EXPECT_TRUE(conf == conf);
EXPECT_FALSE(WheelJointConf() == conf);
}
{
auto conf = WheelJointConf{};
conf.localAnchorB = Length2{1.2_m, -3_m};
EXPECT_TRUE(conf == conf);
EXPECT_FALSE(WheelJointConf() == conf);
}
{
auto conf = WheelJointConf{};
conf.motorSpeed = 0.12_rpm;
EXPECT_TRUE(conf == conf);
EXPECT_FALSE(WheelJointConf() == conf);
}
// TODO: test remaining fields.
}
TEST(WheelJointConf, NotEqualsOperator)
{
EXPECT_FALSE(WheelJointConf() != WheelJointConf());
{
auto conf = WheelJointConf{};
conf.frequency = 13_Hz;
EXPECT_FALSE(conf != conf);
EXPECT_TRUE(WheelJointConf() != conf);
}
// TODO: test remaining fields.
}
{
EXPECT_STREQ(GetName(GetTypeID<WheelJointConf>()), "d2::WheelJointConf");
}
playrho::d2::WheelJointConf::localYAxisA
UnitVec localYAxisA
The local Y translation axis in body-A.
Definition: WheelJointConf.hpp:112
playrho::BodyType::Static
@ Static
Static body type.
playrho::d2::CreateBody
BodyID CreateBody(World &world, const BodyConf &def)
Creates a rigid body with the given configuration.
Definition: WorldBody.cpp:58
playrho::d2::BodyConf::UseType
constexpr BodyConf & UseType(BodyType t) noexcept
Use the given type.
Definition: BodyConf.hpp:166
playrho::Length
PLAYRHO_QUANTITY(boost::units::si::length) Length
Length quantity.
Definition: Units.hpp:158
playrho::d2::World::CreateBody
BodyID CreateBody(const BodyConf &def=GetDefaultBodyConf())
Creates a rigid body with the given configuration.
Definition: World.cpp:161
playrho::Torque
PLAYRHO_QUANTITY(boost::units::si::torque) Torque
Torque quantity.
Definition: Units.hpp:255
playrho::d2::GetWheelJointConf
WheelJointConf GetWheelJointConf(const Joint &joint)
Gets the definition data for the given joint.
Definition: WheelJointConf.cpp:73
playrho::d2
Name space for 2-dimensionally related PlayRho names.
Definition: AABB.cpp:34
playrho::d2::JointConf::bodyA
BodyID bodyA
1st attached body.
Definition: JointConf.hpp:36
playrho::d2::GetLocalYAxisA
UnitVec GetLocalYAxisA(const Joint &object)
Gets the given joint's local Y axis A if its type supports that.
Definition: Joint.cpp:242
playrho::d2::UnitVec::GetRight
static constexpr UnitVec GetRight() noexcept
Gets the right-ward oriented unit vector.
Definition: UnitVec.hpp:74
playrho::InvalidJointID
constexpr auto InvalidJointID
Invalid joint ID value.
Definition: JointID.hpp:33
playrho::d2::SetFrequency
constexpr void SetFrequency(DistanceJointConf &object, NonNegative< Frequency > value) noexcept
Free function for setting the frequency value of the given configuration.
Definition: DistanceJointConf.hpp:205
playrho::d2::WheelJointConf::dampingRatio
Real dampingRatio
Suspension damping ratio, one indicates critical damping.
Definition: WheelJointConf.hpp:127
playrho::d2::GetName
const char * GetName(Manifold::Type type) noexcept
Gets a unique name for the given manifold type.
Definition: Manifold.cpp:788
playrho::d2::ShapeBuilder::UseDensity
constexpr ConcreteConf & UseDensity(NonNegative< AreaDensity > value) noexcept
Uses the given density.
Definition: ShapeConf.hpp:111
playrho::GetX
constexpr auto & GetX(T &value)
Gets the "X" element of the given value - i.e. the first element.
Definition: Math.hpp:66
playrho
Name space for all PlayRho related names.
Definition: AABB.cpp:33
playrho::d2::SetMaxMotorTorque
void SetMaxMotorTorque(Joint &object, Torque value)
Sets the given joint's max motor torque if its type supports that.
Definition: Joint.cpp:363
playrho::d2::GetAngularVelocity
AngularVelocity GetAngularVelocity(const Body &body) noexcept
Gets the angular velocity.
Definition: Body.hpp:1178
playrho::d2::GetLocalAnchorA
Length2 GetLocalAnchorA(const Joint &object)
Get the anchor point on body-A in local coordinates.
Definition: Joint.cpp:62
playrho::d2::GetJointTranslation
Length GetJointTranslation(const World &world, JointID id)
Gets the current joint translation.
Definition: WorldJoint.cpp:229
playrho::RadianPerSecond
constexpr auto RadianPerSecond
Radian per second unit of angular velocity.
Definition: Units.hpp:384
playrho::d2::World
Definition of an independent and simulatable "world".
Definition: World.hpp:129
playrho::d2::GetAnchorB
Length2 GetAnchorB(const World &world, JointID id)
Get the anchor point on body-B in world coordinates.
Definition: WorldJoint.cpp:216
playrho::NewtonMeter
constexpr auto NewtonMeter
Newton meter unit of torque.
Definition: Units.hpp:408
playrho::d2::EnableMotor
void EnableMotor(Joint &object, bool value)
Enables the specified joint's motor property if it supports one.
Definition: Joint.cpp:575
playrho::d2::ShiftOrigin
constexpr bool ShiftOrigin(DistanceJointConf &, Length2) noexcept
Shifts the origin notion of the given configuration.
Definition: DistanceJointConf.hpp:177
playrho::d2::GetMotorTorque
Torque GetMotorTorque(const Joint &joint, Frequency inv_dt)
Gets the current motor torque for the given joint given the inverse time step.
Definition: Joint.hpp:791
playrho::d2::GetBodyB
BodyID GetBodyB(const Contact &contact) noexcept
Gets the body B ID of the given contact.
Definition: Contact.hpp:588
playrho::StripUnit
constexpr auto StripUnit(const T &v) -> decltype(StripUnit(v.get()))
Strips the unit from the given value.
Definition: Math.hpp:121
playrho::d2::GetCollideConnected
bool GetCollideConnected(const Joint &object) noexcept
Gets collide connected.
Definition: Joint.hpp:293
playrho::d2::GetBodyA
BodyID GetBodyA(const Contact &contact) noexcept
Gets the body A ID of the given contact.
Definition: Contact.hpp:581
playrho::d2::BodyConf::UseLocation
constexpr BodyConf & UseLocation(Length2 l) noexcept
Use the given location.
Definition: BodyConf.hpp:172
playrho::d2::IsMotorEnabled
bool IsMotorEnabled(const Joint &object)
Gets the specified joint's motor property value if it supports one.
Definition: Joint.cpp:560
playrho::Meter
constexpr auto Meter
Meter unit of Length.
Definition: Units.hpp:337
playrho::d2::WheelJointConf::localAnchorB
Length2 localAnchorB
The local anchor point relative to body B's origin.
Definition: WheelJointConf.hpp:106
playrho::d2::GetLocalXAxisA
UnitVec GetLocalXAxisA(const Joint &object)
Gets the given joint's local X axis A if its type supports that.
Definition: Joint.cpp:230
playrho::d2::GetMaxMotorTorque
Torque GetMaxMotorTorque(const Joint &object)
Gets the given joint's max motor torque if its type supports that.
Definition: Joint.cpp:351
playrho::d2::CreateJoint
JointID CreateJoint(WorldImpl &world, const Joint &def)
Creates a new joint.
Definition: WorldImplJoint.cpp:47
playrho::d2::GetLocalAnchorB
Length2 GetLocalAnchorB(const Joint &object)
Get the anchor point on body-B in local coordinates.
Definition: Joint.cpp:96
playrho::IsAddable
Template for determining if the given types are addable.
Definition: Templates.hpp:189
playrho::d2::GetAngle
Angle GetAngle(const UnitVec value)
Gets the angle of the given unit vector.
Definition: Math.hpp:718
playrho::StepConf::doWarmStart
bool doWarmStart
Do warm start.
Definition: StepConf.hpp:269
playrho::d2::WheelJointConf
Wheel joint definition.
Definition: WheelJointConf.hpp:55
playrho::InvalidBodyID
constexpr auto InvalidBodyID
Invalid body ID value.
Definition: BodyID.hpp:33
playrho::d2::GetRevPerpendicular
constexpr UnitVec GetRevPerpendicular(const UnitVec vector) noexcept
Gets a vector counter-clockwise (reverse-clockwise) perpendicular to the given vector.
Definition: UnitVec.hpp:330
playrho::AngularMomentum
PLAYRHO_QUANTITY(boost::units::si::angular_momentum) AngularMomentum
Angular momentum quantity.
Definition: Units.hpp:304
playrho::StepConf
Step configuration.
Definition: StepConf.hpp:42
playrho::d2::GetMotorSpeed
AngularVelocity GetMotorSpeed(const Joint &object)
Gets the given joint's motor speed if its type supports that.
Definition: Joint.cpp:254
playrho::d2::GetFrequency
Frequency GetFrequency(const Joint &object)
Gets the frequency of the joint if it has this property.
Definition: Joint.cpp:407
playrho::d2::GetAngularMass
RotInertia GetAngularMass(const Joint &object)
Gets the given joint's angular mass.
Definition: Joint.cpp:287
playrho::d2::GetAngularReaction
constexpr AngularMomentum GetAngularReaction(const DistanceJointConf &) noexcept
Gets the current angular reaction for the given configuration.
Definition: DistanceJointConf.hpp:170
playrho::d2::CreateFixture
FixtureID CreateFixture(World &world, FixtureConf def, bool resetMassData)
Creates a fixture within the specified world.
Definition: WorldFixture.cpp:48
playrho::Real
float Real
Real-number type.
Definition: Real.hpp:69
playrho::d2::DiskShapeConf::UseRadius
constexpr DiskShapeConf & UseRadius(NonNegative< Length > r) noexcept
Uses the given value as the radius.
Definition: DiskShapeConf.hpp:65
playrho::d2::BodyConf
Configuration for a body.
Definition: BodyConf.hpp:50
playrho::d2::GetLocation
constexpr Length2 GetLocation(const Transformation &value) noexcept
Gets the location information from the given transformation.
Definition: Transformation.hpp:69
playrho::d2::WheelJointConf::localAnchorA
Length2 localAnchorA
The local anchor point relative to body A's origin.
Definition: WheelJointConf.hpp:103
playrho::BodyID
detail::IndexingNamedType< BodyCounter, struct BodyIdentifier > BodyID
Identifier for bodies.
Definition: BodyID.hpp:30
playrho::d2::WheelJointConf::enableMotor
bool enableMotor
Enable/disable the joint motor.
Definition: WheelJointConf.hpp:115
playrho::d2::GetDampingRatio
Real GetDampingRatio(const Joint &object)
Gets the given joint's damping ratio property if it has one.
Definition: Joint.cpp:389
playrho::d2::SetMotorSpeed
void SetMotorSpeed(Joint &object, AngularVelocity value)
Sets the given joint's motor speed if its type supports that.
Definition: Joint.cpp:269
playrho::d2::WheelJointConf::maxMotorTorque
Torque maxMotorTorque
The maximum motor torque.
Definition: WheelJointConf.hpp:118
playrho::Vector
Vector.
Definition: Vector.hpp:49
playrho::d2::GetAnchorA
Length2 GetAnchorA(const World &world, JointID id)
Get the anchor point on body-A in world coordinates.
Definition: WorldJoint.cpp:208
playrho::d2::GetType
TypeID GetType(const Shape &shape) noexcept
Gets the type info of the use of the given shape.
Definition: Shape.hpp:329
playrho::IsIterable
typename detail::IsIterableImpl< T > IsIterable
Determines whether the given type is an iterable type.
Definition: Templates.hpp:225
playrho::d2::GetLinearReaction
constexpr Momentum2 GetLinearReaction(const DistanceJointConf &object) noexcept
Gets the current linear reaction for the given configuration.
Definition: DistanceJointConf.hpp:163
playrho::d2::WheelJointConf::motorSpeed
AngularVelocity motorSpeed
The desired angular motor speed.
Definition: WheelJointConf.hpp:121
playrho::RotInertia
PLAYRHO_QUANTITY(boost::units::si::moment_of_inertia) RotInertia
Rotational inertia quantity.
Definition: Units.hpp:274
playrho::d2::Joint
A joint-like constraint on one or more bodies.
Definition: Joint.hpp:144
playrho::d2::JointConf::bodyB
BodyID bodyB
2nd attached body.
Definition: JointConf.hpp:39
playrho::d2::Shape
Shape.
Definition: Shape.hpp:183
playrho::GetY
constexpr auto & GetY(T &value)
Gets the "Y" element of the given value - i.e. the second element.
Definition: Math.hpp:73
playrho::Length2
Vector2< Length > Length2
2-element vector of Length quantities.
Definition: Vector2.hpp:43
playrho::d2::WheelJointConf::localXAxisA
UnitVec localXAxisA
The local X translation axis in body-A.
Definition: WheelJointConf.hpp:109
playrho::d2::WheelJointConf::frequency
NonNegative< Frequency > frequency
Suspension frequency, zero indicates no suspension.
Definition: WheelJointConf.hpp:124
playrho::d2::Step
StepStats Step(WorldImpl &world, const StepConf &conf)
Steps the given world the specified amount.
Definition: WorldImplMisc.cpp:85
playrho::d2::JointConf::collideConnected
bool collideConnected
Collide connected.
Definition: JointConf.hpp:43
playrho::AngularVelocity
PLAYRHO_QUANTITY(boost::units::si::angular_velocity) AngularVelocity
Angular velocity quantity.
Definition: Units.hpp:225
playrho::d2::DiskShapeConf
Disk shape configuration.
Definition: DiskShapeConf.hpp:42