Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

Physical.cpp

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 // Includes 00012 #include "Physical.h" 00013 using namespace OpenCAL; 00014 00015 using namespace std; 00016 00017 00018 // Defines 00019 #define VERYBIG 9999999999999.99999f 00020 00021 00022 /****************************** 00023 * Constructors and destructor * 00024 ******************************/ 00025 00026 Physical::Physical(float mass) 00027 { 00028 #ifdef VERBOSE 00029 Debug::print("Physical constructor", 2); 00030 #endif // VERBOSE 00031 00032 m_oneOverMass = mass > 0 ? 1.0f / mass : VERYBIG; 00033 } 00034 00035 Physical::~Physical() 00036 { 00037 #ifdef VERBOSE 00038 Debug::print("Physical destructor", 2); 00039 #endif // VERBOSE 00040 } 00041 00042 00043 /************************ 00044 * Get and set functions * 00045 ************************/ 00046 00047 float Physical::getMass() const 00048 { 00049 return m_oneOverMass > 0 ? 1.0f / m_oneOverMass : VERYBIG; 00050 } 00051 00052 void Physical::setMass(float mass) 00053 { 00054 m_oneOverMass = mass > 0 ? 1.0f / mass : VERYBIG; 00055 } 00056 00057 void Physical::setAccelleration(const Vector3 &acceleration) 00058 { 00059 if(m_oneOverMass > 0) 00060 m_force = acceleration / m_oneOverMass; 00061 }

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8