[go: up one dir, main page]

Menu

[e79954]: / body / Contact_Point.h  Maximize  Restore  History

Download this file

74 lines (62 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Contact_Point.h - a particle that responds to collisions.
//
// Copyright (C) 2002 Sam Varner
//
// This file is part of Vamos Automotive Simulator.
//
// Vamos is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vamos is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vamos. If not, see <http://www.gnu.org/licenses/>.
#ifndef _CONTACT_POINT_H_
#define _CONTACT_POINT_H_
#include "Particle.h"
#include "../geometry/Material.h"
namespace Vamos_Body
{
// A Contact_Point is a Particle that responds to collisions. The
// impulse is calculated in the contact() method.
class Contact_Point : public Particle
{
public:
// Specify position and orientation.
Contact_Point (double mass,
const Vamos_Geometry::Three_Vector& position,
const Vamos_Geometry::Three_Matrix& orientation,
Vamos_Geometry::Material::Material_Type type,
double friction,
double restitution,
const Frame* parent = 0);
// Take the parent's orientation.
Contact_Point (double mass, const Vamos_Geometry::Three_Vector& position,
Vamos_Geometry::Material::Material_Type type,
double friction, double restitution,
const Frame* parent = 0);
Contact_Point (const Particle& particle,
const Vamos_Geometry::Material& material);
// Handle collisions. The return value is how much the particle
// has moved as a result of the contact. For a Particle, this is
// always 0. But, for derived classes that model moving parts, a
// non-zero value may be returned.
virtual double contact (const Vamos_Geometry::Three_Vector& impulse,
const Vamos_Geometry::Three_Vector& velocity,
double distance,
const Vamos_Geometry::Three_Vector& normal,
const Vamos_Geometry::Three_Vector& angular_velocity,
const Vamos_Geometry::Material& material);
protected:
// true if a collision has occurred.
bool m_contact;
virtual void find_forces ();
virtual void end_timestep ();
};
}
#endif // not _CONTACT_POINT_H_