include/vamos/body/Contact_Point.h

Go to the documentation of this file.
00001 //      Contact_Point.h - a particle that responds to collisions.
00002 //
00003 //  Copyright (C) 2002 Sam Varner
00004 //
00005 //  This file is part of Vamos Automotive Simulator.
00006 //
00007 //  This program is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU General Public License as published by
00009 //  the Free Software Foundation; either version 2 of the License, or
00010 //  (at your option) any later version.
00011 //
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU General Public License
00018 //  along with this program; if not, write to the Free Software
00019 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021 #ifndef _CONTACT_POINT_H_
00022 #define _CONTACT_POINT_H_
00023 
00024 #include <vamos/body/Particle.h>
00025 #include <vamos/geometry/Material.h>
00026 
00027 class Vamos_Geometry::Inertia_Tensor;
00028 
00029 namespace Vamos_Body
00030 {
00031   //* A Contact_Point is a Particle that responds to collisions.  The
00032   //  impulse is calculated in the contact() method.
00033   class Contact_Point : public Particle
00034   {
00035   protected:
00036         // true if a collision has occurred.
00037         bool m_contact;
00038 
00039         virtual void find_forces ();
00040 
00041         virtual void end_timestep ();
00042 
00043   public:
00044         //** Constructors
00045 
00046         // Specify position and orientation.
00047         Contact_Point (double mass, const Vamos_Geometry::Three_Vector& position, 
00048                                    const Vamos_Geometry::Three_Matrix& orientation,
00049                                    Vamos_Geometry::Material::Material_Type type,
00050                                    double friction, double restitution);
00051 
00052         // Take the parent's orientation.
00053         Contact_Point (double mass, const Vamos_Geometry::Three_Vector& position,
00054                                    Vamos_Geometry::Material::Material_Type type,
00055                                    double friction, double restitution);
00056 
00057         // Default constructor.
00058         Contact_Point ();
00059 
00060         // Handle collisions.  The return value is how much the particle
00061         // has moved as a result of the contact.  For a Particle, this is
00062         // always 0.  But, for derived classes that model moving parts, a
00063         // non-zero value may be returned.
00064         virtual double contact (const Vamos_Geometry::Three_Vector& position,
00065                                                         const Vamos_Geometry::Inertia_Tensor& inertia,
00066                                                         const Vamos_Geometry::Three_Vector& velocity,
00067                                                         double distance,
00068                                                         const Vamos_Geometry::Three_Vector& normal,
00069                                                         const Vamos_Geometry::Three_Vector& ang_velocity,
00070                                                         Vamos_Geometry::Material_Handle material);
00071 
00072         virtual bool single_contact () const { return true; }
00073   };
00074 }
00075 
00076 #endif // not _CONTACT_POINT_H_

Generated on Thu Oct 19 04:05:47 2006 by  doxygen 1.4.6