Toggle navigation
PlayRho
0.9.0
GitHub
Main Page
Modules
Classes
Files
Examples
File List
File Members
Dynamics
Joints
WeldJoint.hpp
Go to the documentation of this file.
1
/*
2
* Original work Copyright (c) 2006-2011 Erin Catto http://www.box2d.org
3
* Modified work Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/PlayRho
4
*
5
* This software is provided 'as-is', without any express or implied
6
* warranty. In no event will the authors be held liable for any damages
7
* arising from the use of this software.
8
*
9
* Permission is granted to anyone to use this software for any purpose,
10
* including commercial applications, and to alter it and redistribute it
11
* freely, subject to the following restrictions:
12
*
13
* 1. The origin of this software must not be misrepresented; you must not
14
* claim that you wrote the original software. If you use this software
15
* in a product, an acknowledgment in the product documentation would be
16
* appreciated but is not required.
17
* 2. Altered source versions must be plainly marked as such, and must not be
18
* misrepresented as being the original software.
19
* 3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
#ifndef PLAYRHO_DYNAMICS_JOINTS_WELDJOINT_HPP
23
#define PLAYRHO_DYNAMICS_JOINTS_WELDJOINT_HPP
24
25
#include <
PlayRho/Dynamics/Joints/Joint.hpp
>
26
#include <
PlayRho/Dynamics/Joints/WeldJointConf.hpp
>
27
28
namespace
playrho
{
29
namespace
d2 {
30
38
class
WeldJoint
:
public
Joint
39
{
40
public
:
41
46
WeldJoint
(
const
WeldJointConf
& def);
47
48
void
Accept
(
JointVisitor
& visitor)
const override
;
49
void
Accept
(
JointVisitor
& visitor)
override
;
50
51
Length2
GetAnchorA
()
const override
;
52
Length2
GetAnchorB
()
const override
;
53
54
Momentum2
GetLinearReaction
()
const override
;
55
AngularMomentum
GetAngularReaction
()
const override
;
56
58
Length2
GetLocalAnchorA
()
const
{
return
m_localAnchorA; }
59
61
Length2
GetLocalAnchorB
()
const
{
return
m_localAnchorB; }
62
64
Angle
GetReferenceAngle
()
const
{
return
m_referenceAngle; }
65
67
void
SetFrequency
(
Frequency
frequency) { m_frequency = frequency; }
68
70
Frequency
GetFrequency
()
const
{
return
m_frequency; }
71
73
void
SetDampingRatio
(
Real
ratio) { m_dampingRatio = ratio; }
74
76
Real
GetDampingRatio
()
const
{
return
m_dampingRatio; }
77
78
private
:
79
80
void
InitVelocityConstraints(
BodyConstraintsMap
& bodies,
const
StepConf
& step,
81
const
ConstraintSolverConf
&)
override
;
82
bool
SolveVelocityConstraints(
BodyConstraintsMap
& bodies,
const
StepConf
& step)
override
;
83
bool
SolvePositionConstraints(
BodyConstraintsMap
& bodies,
84
const
ConstraintSolverConf
& conf)
const override
;
85
86
Length2
m_localAnchorA;
87
Length2
m_localAnchorB;
88
Angle
m_referenceAngle;
89
Frequency
m_frequency;
90
Real
m_dampingRatio;
91
92
// Solver shared
93
Vec3
m_impulse =
Vec3
{};
94
95
// Solver temp
96
InvRotInertia
m_gamma;
97
AngularVelocity
m_bias;
98
Length2
m_rA;
99
Length2
m_rB;
100
Mat33
m_mass;
101
};
102
103
}
// namespace d2
104
}
// namespace playrho
105
106
#endif // PLAYRHO_DYNAMICS_JOINTS_WELDJOINT_HPP