1/**
2 * Copyright (c) 2006-2023 LOVE Development Team
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
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 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 **/
20
21#ifndef LOVE_PHYSICS_BOX2D_DISTANCE_JOINT_H
22#define LOVE_PHYSICS_BOX2D_DISTANCE_JOINT_H
23
24// Module
25#include "Joint.h"
26
27namespace love
28{
29namespace physics
30{
31namespace box2d
32{
33
34/**
35 * The DistanceJoint keeps Bodies at a fixed distance
36 * from eachother.
37 **/
38class DistanceJoint : public Joint
39{
40public:
41
42 /**
43 * Creates a DistanceJoint connecting body1 to body2.
44 **/
45 DistanceJoint(Body *body1, Body *body2, float x1, float y1, float x2, float y2, bool collideConnected);
46
47 virtual ~DistanceJoint();
48
49 /**
50 * Sets the equilibrium distance between the two bodies.
51 **/
52 void setLength(float length);
53
54 /**
55 * Gets the equilibrium distance between the two bodies.
56 **/
57 float getLength() const;
58
59 /**
60 * Sets the response speed.
61 **/
62 void setFrequency(float hz);
63
64 /**
65 * Gets the response speed.
66 **/
67 float getFrequency() const;
68
69 /**
70 * Sets the damping ratio.
71 * 0 = no damping, 1 = critical damping.
72 **/
73 void setDampingRatio(float d);
74
75 /**
76 * Gets the damping ratio.
77 * 0 = no damping, 1 = critical damping.
78 **/
79 float getDampingRatio() const;
80
81private:
82 // The Box2D DistanceJoint object.
83 b2DistanceJoint *joint;
84};
85
86} // box2d
87} // physics
88} // love
89
90#endif // LOVE_PHYSICS_BOX2D_DISTANCE_JOINT_H
91