00001 /************************************************************************* 00002 * * 00003 * Open Physics Abstraction Layer * 00004 * Copyright (C) 2004-2005 * 00005 * Alan Fischer alan.fischer@gmail.com * 00006 * Andres Reinot andres@reinot.com * 00007 * Tyler Streeter tylerstreeter@gmail.com * 00008 * All rights reserved. * 00009 * Web: opal.sourceforge.net * 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of EITHER: * 00013 * (1) The GNU Lesser General Public License as published by the Free * 00014 * Software Foundation; either version 2.1 of the License, or (at * 00015 * your option) any later version. The text of the GNU Lesser * 00016 * General Public License is included with this library in the * 00017 * file license-LGPL.txt. * 00018 * (2) The BSD-style license that is included with this library in * 00019 * the file license-BSD.txt. * 00020 * * 00021 * This library is distributed in the hope that it will be useful, * 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * 00024 * license-LGPL.txt and license-BSD.txt for more details. * 00025 * * 00026 *************************************************************************/ 00027 00028 #ifndef OPAL_ACCELERATION_SENSOR_H 00029 #define OPAL_ACCELERATION_SENSOR_H 00030 00031 #include "Defines.h" 00032 #include "Sensor.h" 00033 #include "AccelerationSensorData.h" 00034 00035 namespace opal 00036 { 00037 class Simulator; 00038 00043 class AccelerationSensor : public Sensor 00044 { 00045 public: 00046 AccelerationSensor(Simulator* s); 00047 00048 virtual ~AccelerationSensor(); 00049 00053 virtual void OPAL_CALL init(const AccelerationSensorData& data); 00054 00056 virtual const AccelerationSensorData& OPAL_CALL getData()const; 00057 00060 virtual Vec3r OPAL_CALL getGlobalLinearAccel()const; 00061 00064 virtual Vec3r OPAL_CALL getGlobalAngularAccel()const; 00065 00068 virtual Vec3r OPAL_CALL getLocalLinearAccel()const; 00069 00072 virtual Vec3r OPAL_CALL getLocalAngularAccel()const; 00073 00074 virtual void OPAL_CALL setEnabled(bool e); 00075 00076 virtual bool OPAL_CALL isEnabled()const; 00077 00078 virtual void OPAL_CALL setTransform(const Matrix44r& t); 00079 00080 virtual const Matrix44r& OPAL_CALL getTransform()const; 00081 00082 virtual SensorType OPAL_CALL getType()const; 00083 00084 virtual void OPAL_CALL setName(const std::string& name); 00085 00086 virtual const std::string& OPAL_CALL getName()const; 00087 00088 virtual void OPAL_CALL internal_update(); 00089 00090 virtual bool OPAL_CALL internal_dependsOnSolid(Solid* s); 00091 00092 protected: 00094 AccelerationSensorData mData; 00095 00098 Simulator* mSim; 00099 00102 Vec3r mCurrentGlobalLinearVel; 00103 00106 Vec3r mCurrentGlobalAngularVel; 00107 00110 Vec3r mCurrentLocalLinearVel; 00111 00114 Vec3r mCurrentLocalAngularVel; 00115 00118 Vec3r mPrevGlobalLinearVel; 00119 00122 Vec3r mPrevGlobalAngularVel; 00123 00126 Vec3r mPrevLocalLinearVel; 00127 00130 Vec3r mPrevLocalAngularVel; 00131 00132 private: 00133 }; 00134 } 00135 00136 #endif 00137