-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rmucci
committed
Jan 21, 2011
1 parent
752d2cc
commit 3bfdf1d
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* mafVTKParametricSurfaceSphere.cpp | ||
* mafPluginVTK | ||
* | ||
* Created by Roberto Mucci on 19/11/11. | ||
* Copyright 2009 B3C.s All rights reserved. | ||
* | ||
* See Licence at: http://tiny.cc/QXJ4D | ||
* | ||
*/ | ||
|
||
#include "mafVTKParametricSurfaceSphere.h" | ||
#include <vtkSmartPointer.h> | ||
#include <vtkSphereSource.h> | ||
#include <vtkAlgorithmOutput.h> | ||
#include <vtkPointData.h> | ||
#include <vtkDoubleArray.h> | ||
|
||
|
||
using namespace mafCore; | ||
using namespace mafPluginVTK; | ||
|
||
|
||
mafVTKParametricSurfaceSphere::mafVTKParametricSurfaceSphere(const mafString code_location) : mafPluginVTK::mafVTKParametricSurface(code_location), m_SphereSource(NULL) { | ||
m_SphereRadius = 1.0; | ||
m_SpherePhiRes = 10; | ||
m_SphereTheRes = 10; | ||
|
||
m_SphereSource = vtkSphereSource::New(); | ||
m_Output = m_SphereSource->GetOutputPort(); | ||
} | ||
|
||
mafVTKParametricSurfaceSphere::~mafVTKParametricSurfaceSphere(){ | ||
m_SphereSource->Delete(); | ||
} | ||
|
||
void mafVTKParametricSurfaceSphere::updateSurface(){ | ||
//Set parameters to surface. | ||
m_SphereSource->SetCenter(m_Center); | ||
m_SphereSource->SetPhiResolution(m_SpherePhiRes); | ||
m_SphereSource->SetThetaResolution(m_SphereTheRes); | ||
m_SphereSource->SetRadius(m_SphereRadius); | ||
m_SphereSource->Update(); | ||
} | ||
|
||
void mafVTKParametricSurfaceSphere::setSphereRadius(double sphereRadius){ | ||
m_SphereRadius = sphereRadius; | ||
} | ||
|
||
void mafVTKParametricSurfaceSphere::setSpherePhiResolution(double spherePhiRes){ | ||
m_SpherePhiRes = spherePhiRes; | ||
} | ||
|
||
void mafVTKParametricSurfaceSphere::setThetaResolution(double sphereTheRes){ | ||
m_SphereTheRes = sphereTheRes; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* mafVTKParametricSurfaceSphere.h | ||
* mafPluginVTK | ||
* | ||
* Created by Roberto Mucci on 19/01/11. | ||
* Copyright 2009 B3C.s All rights reserved. | ||
* | ||
* See Licence at: http://tiny.cc/QXJ4D | ||
* | ||
*/ | ||
|
||
#ifndef MAFVTKPARAMETRICSURFACESPHERE_H | ||
#define MAFVTKPARAMETRICSURFACESPHERE_H | ||
|
||
// Includes list | ||
#include "mafPluginVTKDefinitions.h" | ||
#include "mafVTKParametricSurface.h" | ||
|
||
// Foundation Class forwarding list | ||
class vtkAlgorithmOutput; | ||
class vtkSphereSource; | ||
|
||
namespace mafPluginVTK { | ||
|
||
/** | ||
Class name: mafVTKInteractorPicker | ||
This class represent an interactor implementing a picking operation. | ||
*/ | ||
|
||
class MAFPLUGINVTKSHARED_EXPORT mafVTKParametricSurfaceSphere : public mafPluginVTK::mafVTKParametricSurface | ||
{ | ||
Q_OBJECT | ||
/// typedef macro. | ||
mafSuperclassMacro(mafPluginVTK::mafVTKParametricSurface); | ||
|
||
public: | ||
///< Object constructor. | ||
mafVTKParametricSurfaceSphere(const mafString code_location = ""); | ||
|
||
///< Object destructor. | ||
~mafVTKParametricSurfaceSphere(); | ||
|
||
public slots: | ||
/// Set the radius for the parametric sphere. | ||
void setSphereRadius(double radius); | ||
|
||
/// Set the Phi resolution for the parametric sphere. | ||
void setSpherePhiResolution(double spherePhiRes); | ||
|
||
/// Set the Theta resolution for the parametric sphere. | ||
void setThetaResolution(double sphereTheRes); | ||
|
||
/// Update surface with parameters. | ||
/*virtual*/ void updateSurface(); | ||
|
||
private: | ||
vtkSphereSource *m_SphereSource; ///< Polydata representig a sphere. | ||
|
||
double m_SphereRadius; ///< Radius of the sphere; | ||
double m_SpherePhiRes; ///< Sphere Phi resolution; | ||
double m_SphereTheRes; ///< Sphere Phi resolution; | ||
}; | ||
|
||
} | ||
|
||
#endif // MAFVTKPARAMETRICSURFACESPHERE_H |