]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModelFigureSphere.cxx
48e4c5360cbb23f1b466d456d058e132277e2970
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / kernel / CutModelFigureSphere.cxx
1 #include "CutModelFigureSphere.h"
2
3 //----------------------------------------------------------------------------
4 //----------------------------------------------------------------------------
5 //----------------------------------------------------------------------------
6 CutModelFigureSphere::CutModelFigureSphere()
7 {
8         _vtksphere              = vtkSphereSource::New();
9         _vtksphere->SetThetaResolution (20);
10         _vtksphere->SetPhiResolution (20);
11 }
12 //----------------------------------------------------------------------------
13 CutModelFigureSphere::~CutModelFigureSphere() // virtual
14 {
15         _vtksphere->Delete();
16 }
17 //----------------------------------------------------------------------------
18 bool CutModelFigureSphere::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 CutModelFigureSphere::GetTheoricVolume() // virtual
36 {
37         double piTMP=3.14159265;
38         return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2);
39 }
40 //----------------------------------------------------------------------------
41 const char *CutModelFigureSphere::GetName() // virtual
42 {
43         return "Sphere";
44 }
45
46 vtkPolyData* CutModelFigureSphere::getPolyData(){
47         return _vtksphere->GetOutput();
48 }
49