Toggle navigation
PlayRho
0.9.0
GitHub
Main Page
Modules
Classes
Files
Examples
File List
File Members
Dynamics
Contacts
PositionConstraint.hpp
Go to the documentation of this file.
1
/*
2
* Original work Copyright (c) 2006-2009 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
* Permission is granted to anyone to use this software for any purpose,
9
* including commercial applications, and to alter it and redistribute it
10
* freely, subject to the following restrictions:
11
* 1. The origin of this software must not be misrepresented; you must not
12
* claim that you wrote the original software. If you use this software
13
* in a product, an acknowledgment in the product documentation would be
14
* appreciated but is not required.
15
* 2. Altered source versions must be plainly marked as such, and must not be
16
* misrepresented as being the original software.
17
* 3. This notice may not be removed or altered from any source distribution.
18
*/
19
20
#ifndef PLAYRHO_DYNAMICS_CONTACTS_POSITIONCONSTRAINT_HPP
21
#define PLAYRHO_DYNAMICS_CONTACTS_POSITIONCONSTRAINT_HPP
22
23
#include <
PlayRho/Collision/Manifold.hpp
>
24
#include <
PlayRho/Dynamics/Contacts/BodyConstraint.hpp
>
25
26
namespace
playrho
{
27
namespace
d2 {
28
31
class
PositionConstraint
32
{
33
public
:
35
using
size_type
= std::remove_const<decltype(
MaxManifoldPoints
)>::type;
36
37
PositionConstraint
() =
default
;
38
40
PositionConstraint
(
const
Manifold
& m,
41
BodyConstraint
& bA,
Length
rA,
42
BodyConstraint
& bB,
Length
rB):
43
manifold
{m}, m_bodyA{&bA}, m_bodyB{&bB}, m_radiusA{rA}, m_radiusB{rB}
44
{
45
assert(m.GetPointCount() > 0);
46
assert(&bA != &bB);
47
assert(rA >= 0_m);
48
assert(rB >= 0_m);
49
}
50
51
Manifold
manifold
;
52
54
BodyConstraint
*
GetBodyA
() const noexcept {
return
m_bodyA; }
55
57
BodyConstraint
*
GetBodyB
() const noexcept {
return
m_bodyB; }
58
60
Length
GetRadiusA
() const noexcept {
return
m_radiusA; }
61
63
Length
GetRadiusB
() const noexcept {
return
m_radiusB; }
64
65
private
:
66
67
BodyConstraint
* m_bodyA;
68
69
BodyConstraint
* m_bodyB;
70
73
Length
m_radiusA;
// 4-bytes.
74
77
Length
m_radiusB;
// 4-bytes.
78
};
79
80
}
// namespace d2
81
}
// namespace playrho
82
83
#endif // PLAYRHO_DYNAMICS_CONTACTS_POSITIONCONSTRAINT_HPP