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