#include "CutModel2FigureSphere.h" //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- CutModel2FigureSphere::CutModel2FigureSphere() { _vtksphere = vtkSphereSource::New(); _vtksphere->SetThetaResolution (20); _vtksphere->SetPhiResolution (20); } //---------------------------------------------------------------------------- CutModel2FigureSphere::~CutModel2FigureSphere() // virtual { _vtksphere->Delete(); } //---------------------------------------------------------------------------- bool CutModel2FigureSphere::IfPointInside(double x, double y, double z) // virtual { double in[4],out[4]; in[0]=x; in[1]=y; in[2]=z; in[3]=1; _inversModel->MultiplyPoint (in, out); bool result=false; if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 ) { result=true; } return result; } //---------------------------------------------------------------------------- double CutModel2FigureSphere::GetTheoricVolume() // virtual { double piTMP=3.14159265; return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2); } //---------------------------------------------------------------------------- char *CutModel2FigureSphere::GetName() // virtual { return "Sphere"; } vtkPolyData* CutModel2FigureSphere::getPolyData(){ return _vtksphere->GetOutput(); }