00001 #include "CutModelFigureSphere.h" 00002 00003 //---------------------------------------------------------------------------- 00004 //---------------------------------------------------------------------------- 00005 //---------------------------------------------------------------------------- 00006 CutModelFigureSphere::CutModelFigureSphere() 00007 { 00008 _vtksphere = vtkSphereSource::New(); 00009 _vtksphere->SetThetaResolution (20); 00010 _vtksphere->SetPhiResolution (20); 00011 } 00012 //---------------------------------------------------------------------------- 00013 CutModelFigureSphere::~CutModelFigureSphere() // virtual 00014 { 00015 _vtksphere->Delete(); 00016 } 00017 //---------------------------------------------------------------------------- 00018 bool CutModelFigureSphere::IfPointInside(double x, double y, double z) // virtual 00019 { 00020 double in[4],out[4]; 00021 in[0]=x; 00022 in[1]=y; 00023 in[2]=z; 00024 in[3]=1; 00025 _inversModel->MultiplyPoint (in, out); 00026 00027 bool result=false; 00028 if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 ) 00029 { 00030 result=true; 00031 } 00032 return result; 00033 } 00034 //---------------------------------------------------------------------------- 00035 double CutModelFigureSphere::GetTheoricVolume() // virtual 00036 { 00037 double piTMP=3.14159265; 00038 return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2); 00039 } 00040 //---------------------------------------------------------------------------- 00041 char *CutModelFigureSphere::GetName() // virtual 00042 { 00043 return "Sphere"; 00044 } 00045 00046 vtkPolyData* CutModelFigureSphere::getPolyData(){ 00047 return _vtksphere->GetOutput(); 00048 } 00049