]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModel2FigureSphere.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / kernel / CutModel2FigureSphere.cxx
1 #include "CutModel2FigureSphere.h"
2
3 //----------------------------------------------------------------------------
4 //----------------------------------------------------------------------------
5 //----------------------------------------------------------------------------
6 CutModel2FigureSphere::CutModel2FigureSphere()
7 {
8         _vtksphere              = vtkSphereSource::New();
9         _vtksphere->SetThetaResolution (20);
10         _vtksphere->SetPhiResolution (20);
11 }
12 //----------------------------------------------------------------------------
13 CutModel2FigureSphere::~CutModel2FigureSphere() // virtual
14 {
15         _vtksphere->Delete();
16 }
17 //----------------------------------------------------------------------------
18 bool CutModel2FigureSphere::IfPointInside(double x, double y, double z) // virtual
19 {
20         double in[4],out[4];
21         in[0]=x;
22         in[1]=y;
23         in[2]=z;
24         in[3]=1;
25         _inversModel->MultiplyPoint (in, out);
26
27         bool result=false;
28         if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 )
29         {
30                 result=true;
31         }
32         return result;
33 }
34 //----------------------------------------------------------------------------
35 double CutModel2FigureSphere::GetTheoricVolume() // virtual
36 {
37         double piTMP=3.14159265;
38         return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2);
39 }
40 //----------------------------------------------------------------------------
41 char *CutModel2FigureSphere::GetName() // virtual
42 {
43         return "Sphere";
44 }
45
46 vtkPolyData* CutModel2FigureSphere::getPolyData(){
47         return _vtksphere->GetOutput();
48 }
49