Biomechanical Joint Model
 Author: Anderson Maciel

comeforce.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002 by Anderson Maciel                                 *
00003  *   andi.maciel@gmail.com                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  **************************************************************************/
00020 
00022 //
00023 //  PROJECT.....: CO-ME
00024 //  RESPONSIBLE.: 
00025 //
00026 //  FILE........: comeforce.cpp
00027 //  DESCRIPTION.: 
00028 //                                 
00029 //
00030 //  AUTHOR......: Anderson Maciel
00031 //  DATE........: Jun/04/2002
00032 //  DESCRIPTION.: Class definition.
00033 //
00035 
00036 #include <physics/comeforce.h>
00037 
00039 // Construction/Destruction
00041 
00042 COME_Force::COME_Force(){
00043 
00044         force = COME_Vector3D( 0, 0, 0 );
00045 }
00046 
00047 COME_Force::COME_Force( double x, double y, double z ){
00048 
00049         force = COME_Vector3D( x, y, z );
00050 }
00051 
00052 COME_Force::COME_Force( const COME_Vector3D& vectorN ){
00053 
00054         force = COME_Vector3D( vectorN );
00055 }
00056 
00057 COME_Force::COME_Force( COME_Point3D& pointN ){
00058 
00059         force = COME_Vector3D( pointN.getX(), pointN.getY(), pointN.getZ() );
00060 }
00061 
00062 COME_Force::~COME_Force()
00063 {
00064 
00065 }
00066 
00067 void
00068 COME_Force::setIntensity( float intensityN ){
00069 
00070         force.vpNormalize();
00071         force = force*intensityN;
00072 }
00073 
00074 void
00075 COME_Force::setDirection( COME_Vector3D &directionN ){
00076         
00077         double module = getIntensity();
00078         directionN.vpNormalize();
00079         directionN = directionN*module;
00080 }
00081 
00082 void
00083 COME_Force::setForceVector( COME_Vector3D &vectorN ){
00084         
00085         force.setXYZ( vectorN.getX(), vectorN.getY(), vectorN.getZ() );
00086 }
00087 
00088 double
00089 COME_Force::getIntensity(){
00090 
00091         return force.vpModule();
00092 }
00093 
00094 COME_Vector3D*
00095 COME_Force::getDirection() const {
00096 
00097         COME_Vector3D* forceN = new COME_Vector3D( force );
00098         forceN->vpNormalize();
00099         return forceN;
00100 }
00101 
00102 
00103 COME_Vector3D
00104 COME_Force::getForceVector() const{
00105 
00106         return force;
00107 }
00108 
00109 COME_Force
00110 COME_Force::operator+ (const COME_Force& f) {
00111  
00112         COME_Force ff( force + f.getForceVector() );
00113         return ( ff ) ;
00114 } 
00115 
00116 COME_Force
00117 COME_Force::operator- (const COME_Force& f) {
00118  
00119         COME_Force ff( force - f.getForceVector() );
00120         return ( ff ) ;
00121 }
00122 
00123 COME_Force
00124 COME_Force::operator/ ( const double& f ) {
00125       COME_Force ff( force.getX() / f, force.getY() / f, force.getZ() / f );
00126       return ( ff ) ;
00127 }

Generated on Thu Dec 1 10:13:33 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5