PlanesOperations.cxx

Go to the documentation of this file.
00001 
00002 #include "PlanesOperations.h"
00003 
00004 /********************************************************************************************
00005 ** Start of data viewmanagerData
00006 *********************************************************************************************/
00007 
00008 PlanesOperations::PlanesOperations(){   
00009 }
00010 
00011 
00012 PlanesOperations::~PlanesOperations(){
00013 
00014 }
00015 
00016 
00017 double* PlanesOperations::getCrossProduct(double* vect0,double* vect1){
00018         double* vectCross;
00019         vectCross = new double[3];
00020         vectCross[0] = vect0[1]*vect1[2]-(vect0[2]*vect1[1]);
00021         vectCross[1] = -(vect0[0]*vect1[2]-(vect0[2]*vect1[0]));
00022         vectCross[2] = vect0[0]*vect1[1]-(vect0[1]*vect1[0]);
00023 
00024         return vectCross;
00025 }
00029 double PlanesOperations::getMagnitud(double* vect){
00030 
00031         double mag;
00032 
00033         mag = sqrt(pow(vect[0],2) + pow(vect[1],2) + pow(vect[2],2));
00034 
00035         std::cout<<"mag "<<mag <<std::endl;
00036 
00037         return mag;
00038 
00039 }
00044 double* PlanesOperations::getNormal(double* vect){
00045 
00046         double* vectnorm;
00047         double mag = getMagnitud(vect);
00048 
00049         vectnorm = new double[3];
00050         
00051 
00052         if(mag!=0){
00053                 vectnorm[0] = vect[0]/mag;
00054                 vectnorm[1] = vect[1]/mag;
00055                 vectnorm[2] = vect[2]/mag;
00056         }else{
00057                 vectnorm[0] = 0;
00058                 vectnorm[1] = 0;
00059                 vectnorm[2] = 0;
00060         }
00061 
00062         return vectnorm;
00063 
00064 
00065 }
00066 
00067 double* PlanesOperations::makeVector(double podouble0[3], double podouble1[3]){
00068         double *vect;
00069         vect = new double[3];
00070 
00071         vect[0]= podouble1[0]-podouble0[0];
00072         vect[1]= podouble1[1]-podouble0[1];
00073         vect[2]= podouble1[2]-podouble0[2];
00074 
00075         return vect;
00076 
00077 }

Generated on Wed Jul 29 16:35:32 2009 for creaMaracasVisu_lib by  doxygen 1.5.3