From a6ba2b5ce12aba5be6c78e6007db1b780858eeaf Mon Sep 17 00:00:00 2001 From: trillos Date: Mon, 16 Nov 2009 08:52:08 +0000 Subject: [PATCH] Added Transform3D Boxes --- .../src/bbPackRecalageTransform3DBox.cxx | 44 +++++++++++++++++++ .../src/bbPackRecalageTransform3DBox.h | 43 ++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 PackRecalage/src/bbPackRecalageTransform3DBox.cxx create mode 100644 PackRecalage/src/bbPackRecalageTransform3DBox.h diff --git a/PackRecalage/src/bbPackRecalageTransform3DBox.cxx b/PackRecalage/src/bbPackRecalageTransform3DBox.cxx new file mode 100644 index 0000000..3c1517a --- /dev/null +++ b/PackRecalage/src/bbPackRecalageTransform3DBox.cxx @@ -0,0 +1,44 @@ +#include "bbPackRecalageTransform3DBox.h" +#include "bbPackRecalagePackage.h" +namespace bbPackRecalage +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,Transform3DBox) +BBTK_BLACK_BOX_IMPLEMENTATION(Transform3DBox,bbtk::AtomicBlackBox); +void Transform3DBox::Process() +{ + if(!bbGetInputCenterPoint().empty()) + { + // The inputs are set in the library transformer 3D + transformer->SetCenterPoint( bbGetInputCenterPoint() ); + + // The calculation of the transformations are made + transformer->Run(); + // We get the results of transformer and set it as result of this box + bbSetOutputOut( transformer->GetResult() ); + } + else + { + bbSetOutputOut( NULL ); + } +} +void Transform3DBox::bbUserSetDefaultValues() +{ + //We initialize the points with an empty vector + std::vector nuevo(3,0); + nuevo.push_back(0); + bbSetInputCenterPoint(nuevo); + bbSetOutputOut(NULL); +} +void Transform3DBox::bbUserInitializeProcessing() +{ + //We initialize the transformer + transformer=new Transformer3D(); +} +void Transform3DBox::bbUserFinalizeProcessing() +{ + //We delete the transformer + delete transformer; +} +} +// EO namespace bbPackRecalage \ No newline at end of file diff --git a/PackRecalage/src/bbPackRecalageTransform3DBox.h b/PackRecalage/src/bbPackRecalageTransform3DBox.h new file mode 100644 index 0000000..98a54e3 --- /dev/null +++ b/PackRecalage/src/bbPackRecalageTransform3DBox.h @@ -0,0 +1,43 @@ +#ifndef __bbPackRecalageTransform3DBox_h_INCLUDED__ +#define __bbPackRecalageTransform3DBox_h_INCLUDED__ +#include "bbPackRecalage_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" +#include "Transformer3D.h" +#include "vtkLinearTransform.h" + +namespace bbPackRecalage +{ + +class bbPackRecalage_EXPORT Transform3DBox + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(Transform3DBox,bbtk::AtomicBlackBox); + + /*Point(x,y) -> Rotation Center*/ + BBTK_DECLARE_INPUT(CenterPoint,std::vector); + + /*Resultant vtkTransform*/ + BBTK_DECLARE_OUTPUT(Out, vtkLinearTransform*); + + BBTK_PROCESS(Process); + void Process(); + + /*Class in charge of making the transformations*/ + Transformer3D *transformer; +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(Transform3DBox,bbtk::AtomicBlackBox); +BBTK_NAME("Transform3DBox"); +BBTK_AUTHOR("jn.trillos44@uniandes.edu.co"); +BBTK_DESCRIPTION("Box useful for creating matrixes for 3D transformations"); +BBTK_CATEGORY("__CATEGORY__"); +BBTK_INPUT(Transform3DBox,CenterPoint,"",std::vector,""); +BBTK_OUTPUT(Transform3DBox,Out,"First output",vtkLinearTransform*,""); +BBTK_END_DESCRIBE_BLACK_BOX(Transform3DBox); +} +// EO namespace bbPackRecalage + +#endif // __bbPackRecalageTransform3DBox_h_INCLUDED__ + -- 2.47.1