Biomechanical Joint Model
 Author: Anderson Maciel

comecurve.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 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 #include        <algebra/comecurve.h>
00021 #include        <algebra/comepoint.h>
00022 #include        <stdio.h>
00023 
00024 
00025 COME_Curve::~COME_Curve(){
00026         
00027         if( controlPoints ){
00028                 delete controlPoints;
00029                 controlPoints = NULL;
00030         }
00031 }
00032 
00033 COME_Curve::COME_Curve(){
00034         
00035         controlPoints = NULL;
00036 }
00037 
00038 COME_Curve::COME_Curve( COME_Vertex3D   *pts){
00039 
00040         controlPoints = pts;
00041 }
00042                 
00043 void
00044 COME_Curve::setControlPoints( COME_Vertex3D     *p ){
00045         controlPoints = p;
00046 }
00047 
00048 COME_Vertex3D*
00049 COME_Curve::getControlPoints( void ){
00050         return controlPoints;
00051 }
00052 
00053 COME_Point3D
00054 COME_Curve::getPointAsPoint( float t ){
00055 
00056         COME_Point3D    *p = new COME_Point3D();
00057 /*      COME_Vertex3D p0 = getControlPoint(0);
00058         COME_Vertex3D p1 = getControlPoint(1);
00059         COME_Vertex3D p2 = getControlPoint(2);
00060         COME_Vertex3D p3 = getControlPoint(3);
00061         
00062         p->setX( p0.getX()*(1-t)*(1-t)*(1-t) + p1.getX()*3*t*(1-t)*(1-t) +
00063                                                  p2.getX()*3*t*t*(1-t) + p3.getX()*t*t*t );
00064         p->setY( p0.getY()*(1-t)*(1-t)*(1-t) + p1.getY()*3*t*(1-t)*(1-t) +
00065                                                  p2.getY()*3*t*t*(1-t) + p3.getY()*t*t*t );
00066         p->setZ( p0.getZ()*(1-t)*(1-t)*(1-t) + p1.getZ()*3*t*(1-t)*(1-t) +
00067                                                  p2.getZ()*3*t*t*(1-t) + p3.getZ()*t*t*t );
00068 */      
00069         return *p;
00070 }
00071 
00072 void
00073 COME_Curve::vpRender( void ){
00074         // meanwhile do nothing
00075 }

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