PlaneDirectionManagerData Class Reference

#include <PlaneDirectionManagerData.h>

Inheritance diagram for PlaneDirectionManagerData:
Inheritance graph
[legend]
Collaboration diagram for PlaneDirectionManagerData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PlaneDirectionManagerData (int radio, double colour[3], int opacity)
 ~PlaneDirectionManagerData ()
void setPoint0 (double x, double y, double z)
void setPoint1 (double x, double y, double z)
void setPoint2 (double x, double y, double z)
double * getPoint0 ()
double * getPoint1 ()
double * getPoint2 ()
void UpdateActor ()
vtkProp3D * GetActor ()
double * GetDirection ()
void ChangeColour (double r, double g, double b)
double * getCrossProduct (double *vect0, double *vect1)
double getPodoubleProduct (double *vect0, double *vect1)
double * getNormal (double *vect)
double getMagnitud (double *vect)
double * makeVector (double podouble0[3], double podouble1[3])

Private Member Functions

double * GetMidPoint ()

Private Attributes

double * p0
double * p1
double * p2
int _radio
double * _colour
int _opacity
double * _dir
vtkArrowSource * _vtkarrow
vtkPolyDataMapper * _arrowMapper
vtkActor * _arrowActor

Detailed Description

Definition at line 20 of file PlaneDirectionManagerData.h.


Constructor & Destructor Documentation

PlaneDirectionManagerData::PlaneDirectionManagerData ( int  radio,
double  colour[3],
int  opacity 
)

Definition at line 8 of file PlaneDirectionManagerData.cxx.

References _arrowActor, _arrowMapper, _colour, _dir, _opacity, _radio, _vtkarrow, p0, p1, and p2.

00009 :PlanesOperations(){    
00010         _vtkarrow               = vtkArrowSource::New();        
00011         _arrowMapper    = vtkPolyDataMapper::New();
00012         _arrowActor     = vtkActor::New();
00013 
00014         _vtkarrow->SetTipResolution(30);
00015         _vtkarrow->SetShaftResolution( 30  );   
00016         _arrowMapper->SetInput( _vtkarrow->GetOutput() );       
00017         _arrowActor->SetMapper(_arrowMapper);   
00018 
00019         _radio = radio;
00020         _colour = colour;
00021         _opacity = opacity;
00022 
00023         p0 = new double[3];
00024         p0[0] = 0;
00025         p0[1] = 0;
00026         p0[2] = 0;
00027         p1 = new double[3];
00028         p1[0] = 0;
00029         p1[1] = 0;
00030         p1[2] = 0;
00031         p2 = new double[3];
00032         p2[0] = 1;
00033         p2[1] = 1;
00034         p2[2] = 1;
00035         _dir = new double[3];
00036         _dir[0] = 0;
00037         _dir[1] = 0;
00038         _dir[2] = 0;
00039 }

PlaneDirectionManagerData::~PlaneDirectionManagerData (  ) 

Definition at line 42 of file PlaneDirectionManagerData.cxx.

References _arrowActor, _arrowMapper, _dir, _vtkarrow, p0, p1, and p2.

00042                                                      {
00043 
00044         _vtkarrow->Delete();
00045         _arrowMapper->Delete();
00046         _arrowActor->Delete();
00047         delete p0;
00048         delete p1;
00049         delete p2;
00050         delete _dir;
00051 }


Member Function Documentation

void PlaneDirectionManagerData::ChangeColour ( double  r,
double  g,
double  b 
)

Definition at line 87 of file PlaneDirectionManagerData.cxx.

References _arrowActor, and _colour.

Referenced by PlaneDirectionManager::changeColor().

00087                                                                       {
00088         _colour[0] = r;
00089         _colour[1] = g;
00090         _colour[2] = b;
00091         if(_arrowActor!=NULL){
00092                 _arrowActor->GetProperty()->SetColor( r,g,b );
00093         }       
00094 }

Here is the caller graph for this function:

vtkProp3D * PlaneDirectionManagerData::GetActor (  ) 

Definition at line 53 of file PlaneDirectionManagerData.cxx.

References _arrowActor.

00053                                               { 
00054         return _arrowActor;
00055 }

double * PlanesOperations::getCrossProduct ( double *  vect0,
double *  vect1 
) [inherited]

Definition at line 19 of file PlanesOperations.cxx.

Referenced by UpdateActor().

00020 {
00021         double* vectCross;
00022         vectCross = new double[3];
00023         vectCross[0] = vect0[1]*vect1[2]-(vect0[2]*vect1[1]);
00024         vectCross[1] = -(vect0[0]*vect1[2]-(vect0[2]*vect1[0]));
00025         vectCross[2] = vect0[0]*vect1[1]-(vect0[1]*vect1[0]);
00026 
00027         return vectCross;
00028 }

Here is the caller graph for this function:

double* PlaneDirectionManagerData::GetDirection (  )  [inline]

Definition at line 55 of file PlaneDirectionManagerData.h.

References _dir.

Referenced by PlaneDirectionViewerPanel::PlaneDirectionViewerPanel().

00055                               {
00056                 return _dir;
00057         }

Here is the caller graph for this function:

double PlanesOperations::getMagnitud ( double *  vect  )  [inherited]

Returns the magnitud of the given vector

Definition at line 32 of file PlanesOperations.cxx.

Referenced by PlanesOperations::getNormal().

00033 {
00034         double mag;
00035 
00036         mag = sqrt(pow(vect[0],2) + pow(vect[1],2) + pow(vect[2],2));
00037 
00038         std::cout<<"mag "<<mag <<std::endl;
00039 
00040         return mag;
00041 }

Here is the caller graph for this function:

double * PlaneDirectionManagerData::GetMidPoint (  )  [private]

Definition at line 96 of file PlaneDirectionManagerData.cxx.

References p0, p1, and p2.

Referenced by UpdateActor().

00096                                               {
00097         if(p0 != NULL && p1 != NULL && p2 != NULL){
00098                 double* ret = new double[3];
00099                 ret[0] = (p0[0] + p1[0] +p2[0])/3;
00100                 ret[1] = (p0[1] + p1[1] +p2[1])/3;
00101                 ret[2] = (p0[2] + p1[2] +p2[2])/3;
00102                 return ret;
00103         }
00104         return NULL;
00105 }

Here is the caller graph for this function:

double * PlanesOperations::getNormal ( double *  vect  )  [inherited]

returns the unitary vector of the given vector u = 1/|vect| . vect

Definition at line 46 of file PlanesOperations.cxx.

References PlanesOperations::getMagnitud().

Referenced by UpdateActor().

00047 {
00048 
00049         double* vectnorm;
00050         double mag = getMagnitud(vect);
00051 
00052         vectnorm = new double[3];
00053         
00054         if(mag!=0){
00055                 vectnorm[0] = vect[0]/mag;
00056                 vectnorm[1] = vect[1]/mag;
00057                 vectnorm[2] = vect[2]/mag;
00058         }else{
00059                 vectnorm[0] = 0;
00060                 vectnorm[1] = 0;
00061                 vectnorm[2] = 0;
00062         }
00063         return vectnorm;
00064 }

Here is the call graph for this function:

Here is the caller graph for this function:

double PlanesOperations::getPodoubleProduct ( double *  vect0,
double *  vect1 
) [inherited]
double* PlaneDirectionManagerData::getPoint0 (  )  [inline]

Definition at line 41 of file PlaneDirectionManagerData.h.

References p0.

Referenced by PlaneDirectionViewerPanel::PlaneDirectionViewerPanel().

00041                            {
00042                 return p0;              
00043         }

Here is the caller graph for this function:

double* PlaneDirectionManagerData::getPoint1 (  )  [inline]

Definition at line 44 of file PlaneDirectionManagerData.h.

References p1.

Referenced by PlaneDirectionViewerPanel::PlaneDirectionViewerPanel().

00044                            {
00045                 return p1;              
00046         }

Here is the caller graph for this function:

double* PlaneDirectionManagerData::getPoint2 (  )  [inline]

Definition at line 47 of file PlaneDirectionManagerData.h.

References p2.

Referenced by PlaneDirectionViewerPanel::PlaneDirectionViewerPanel().

00047                            {
00048                 return p2;              
00049         }

Here is the caller graph for this function:

double * PlanesOperations::makeVector ( double  podouble0[3],
double  podouble1[3] 
) [inherited]

Definition at line 66 of file PlanesOperations.cxx.

Referenced by UpdateActor().

00067 {
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 }

Here is the caller graph for this function:

void PlaneDirectionManagerData::setPoint0 ( double  x,
double  y,
double  z 
) [inline]

Definition at line 26 of file PlaneDirectionManagerData.h.

References p0.

Referenced by PlaneDirectionManager::UpdateVectors().

00026                                                   {             
00027                 p0[0] = x;
00028                 p0[1] = y;
00029                 p0[2] = z;
00030         }

Here is the caller graph for this function:

void PlaneDirectionManagerData::setPoint1 ( double  x,
double  y,
double  z 
) [inline]

Definition at line 31 of file PlaneDirectionManagerData.h.

References p1.

Referenced by PlaneDirectionManager::UpdateVectors().

00031                                                   {             
00032                 p1[0] = x;
00033                 p1[1] = y;
00034                 p1[2] = z;
00035         }

Here is the caller graph for this function:

void PlaneDirectionManagerData::setPoint2 ( double  x,
double  y,
double  z 
) [inline]

Definition at line 36 of file PlaneDirectionManagerData.h.

References p2.

Referenced by PlaneDirectionManager::UpdateVectors().

00036                                                   {             
00037                 p2[0] = x;
00038                 p2[1] = y;
00039                 p2[2] = z;
00040         }

Here is the caller graph for this function:

void PlaneDirectionManagerData::UpdateActor (  ) 

Definition at line 57 of file PlaneDirectionManagerData.cxx.

References _arrowActor, _colour, _dir, _opacity, _radio, PlanesOperations::getCrossProduct(), GetMidPoint(), PlanesOperations::getNormal(), PlanesOperations::makeVector(), p0, p1, and p2.

00057                                            {    
00058 
00059         _arrowActor->GetProperty()->SetColor( _colour[0] , _colour[1] , _colour[2] );
00060         _arrowActor->GetProperty()->SetOpacity( _opacity );
00061         
00062         
00063         double* vect1= getNormal(makeVector(p0, p1));
00064         double* vect2= getNormal(makeVector(p0, p2));   
00065         _dir = getNormal(getCrossProduct(vect1, vect2));
00066         double *newvectnorm = getNormal(getCrossProduct(_dir, vect2));
00067         double *midp = GetMidPoint();
00068 
00069         vtkMatrix4x4* _matrix = vtkMatrix4x4::New();  
00070         _matrix->Identity();    
00071         _matrix->SetElement(0,0,_dir[0]*_radio);
00072         _matrix->SetElement(1,0,_dir[1]*_radio);
00073         _matrix->SetElement(2,0,_dir[2]*_radio);
00074         _matrix->SetElement(0,1,vect2[0]*_radio);
00075         _matrix->SetElement(1,1,vect2[1]*_radio);
00076         _matrix->SetElement(2,1,vect2[2]*_radio);
00077         _matrix->SetElement(0,2,newvectnorm[0]*_radio);
00078         _matrix->SetElement(1,2,newvectnorm[1]*_radio);
00079         _matrix->SetElement(2,2,newvectnorm[2]*_radio);         
00080         _matrix->SetElement(0,3,midp[0]);
00081         _matrix->SetElement(1,3,midp[1]);
00082         _matrix->SetElement(2,3,midp[2]);
00083         _arrowActor->SetUserMatrix(_matrix);    
00084 
00085 }

Here is the call graph for this function:


Member Data Documentation

vtkPolyDataMapper* PlaneDirectionManagerData::_arrowMapper [private]

Definition at line 67 of file PlaneDirectionManagerData.h.

Referenced by PlaneDirectionManagerData(), and UpdateActor().

Definition at line 65 of file PlaneDirectionManagerData.h.

Referenced by PlaneDirectionManagerData(), and UpdateActor().

vtkArrowSource* PlaneDirectionManagerData::_vtkarrow [private]
double* PlaneDirectionManagerData::p0 [private]
double* PlaneDirectionManagerData::p1 [private]
double* PlaneDirectionManagerData::p2 [private]

The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1