--- /dev/null
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+#include "bbcreaVtkApplyTransformToPoint3D.h"
+#include "bbcreaVtkPackage.h"
+#include "vtkTransform.h"
+
+namespace bbcreaVtk
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ApplyTransformToPoint3D)
+BBTK_BLACK_BOX_IMPLEMENTATION(ApplyTransformToPoint3D,bbtk::AtomicBlackBox);
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void ApplyTransformToPoint3D::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+// Here we simply set the input 'In' value to the output 'Out'
+// And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+// void bbSet{Input|Output}NAME(const TYPE&)
+// const TYPE& bbGet{Input|Output}NAME() const
+// Where :
+// * NAME is the name of the input/output
+// (the one provided in the attribute 'name' of the tag 'input')
+// * TYPE is the C++ type of the input/output
+// (the one provided in the attribute 'type' of the tag 'input')
+// bbSetOutputOut( bbGetInputIn() );
+// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+
+
+ printf("EED ApplyTransformToPoint3D::Process Start\n ");
+
+ if ((bbGetInputPoint().size()==3) && (bbGetInputDirectionInPoint().size()==3) )
+ {
+ double point[3] , newPoint[3];
+ point[0] = bbGetInputPoint()[0];
+ point[1] = bbGetInputPoint()[1];
+ point[2] = bbGetInputPoint()[2];
+ bbGetInputTransform()->TransformPoint( point,newPoint );
+ std::vector<double> out;
+ out.push_back( newPoint[0] );
+ out.push_back( newPoint[1] );
+ out.push_back( newPoint[2] );
+ bbSetOutputOut( out );
+
+ double pointDir[3] , newPointDir[3];
+ pointDir[0] = bbGetInputPoint()[0]+bbGetInputDirectionInPoint()[0];
+ pointDir[1] = bbGetInputPoint()[1]+bbGetInputDirectionInPoint()[1];
+ pointDir[2] = bbGetInputPoint()[2]+bbGetInputDirectionInPoint()[2];
+ bbGetInputTransform()->TransformPoint( pointDir,newPointDir );
+ std::vector<double> outDir;
+ outDir.push_back( newPointDir[0]-newPoint[0] );
+ outDir.push_back( newPointDir[1]-newPoint[1] );
+ outDir.push_back( newPointDir[2]-newPoint[2] );
+ bbSetOutputOutDirection( outDir );
+ } else {
+ printf("EED Warning! ApplyTransformToPoint3D::Process Incoherent sizes Point(3)=%d DirectionInPoint(3)=%d\n", bbGetInputPoint().size(),bbGetInputDirectionInPoint().size() );
+ }// if Point size
+ printf("EED ApplyTransformToPoint3D::Process End\n ");
+
+}
+
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void ApplyTransformToPoint3D::bbUserSetDefaultValues()
+{
+// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
+// Here we initialize the input 'In' to 0
+
+ std::vector<double> point;
+ point.push_back(0);
+ point.push_back(0);
+ point.push_back(0);
+ bbSetInputPoint( point );
+ std::vector<double> dir;
+ dir.push_back(0);
+ dir.push_back(0);
+ dir.push_back(1);
+ bbSetInputDirectionInPoint( dir );
+ bbSetInputTransform(NULL);
+}
+
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void ApplyTransformToPoint3D::bbUserInitializeProcessing()
+{
+// THE INITIALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should allocate the internal/output pointers
+// if any
+}
+
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void ApplyTransformToPoint3D::bbUserFinalizeProcessing()
+{
+// THE FINALIZATION METHOD BODY :
+// Here does nothing
+// but this is where you should desallocate the internal/output pointers
+// if any
+}
+
+} // EO namespace bbcreaVtk
+
+
--- /dev/null
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+#ifndef __bbcreaVtkApplyTransformToPoint3D_h_INCLUDED__
+#define __bbcreaVtkApplyTransformToPoint3D_h_INCLUDED__
+
+#include "bbcreaVtk_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+#include "vtkLinearTransform.h"
+
+namespace bbcreaVtk
+{
+
+class bbcreaVtk_EXPORT ApplyTransformToPoint3D
+ :
+ public bbtk::AtomicBlackBox
+{
+ BBTK_BLACK_BOX_INTERFACE(ApplyTransformToPoint3D,bbtk::AtomicBlackBox);
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+ BBTK_DECLARE_INPUT(Point,std::vector<double>);
+ BBTK_DECLARE_INPUT(DirectionInPoint,std::vector<double>);
+ BBTK_DECLARE_INPUT(Transform,vtkLinearTransform*);
+ BBTK_DECLARE_OUTPUT(Out,std::vector<double>);
+ BBTK_DECLARE_OUTPUT(OutDirection,std::vector<double>);
+ BBTK_PROCESS(Process);
+ void Process();
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+};
+
+BBTK_BEGIN_DESCRIBE_BLACK_BOX(ApplyTransformToPoint3D,bbtk::AtomicBlackBox);
+ BBTK_NAME("ApplyTransformToPoint3D");
+ BBTK_AUTHOR("InfoDev");
+ BBTK_DESCRIPTION("No Description.");
+ BBTK_CATEGORY("empty");
+
+ BBTK_INPUT(ApplyTransformToPoint3D,Point,"(default [0,0,0]) Point 3D [x,y,z]",std::vector<double>,"");
+ BBTK_INPUT(ApplyTransformToPoint3D,DirectionInPoint,"(default [0,0,1]) Direction from point [x,y,z]",std::vector<double>,"");
+ BBTK_INPUT(ApplyTransformToPoint3D,Transform,"vtkLinearTransform",vtkLinearTransform*,"");
+
+ BBTK_OUTPUT(ApplyTransformToPoint3D,Out,"Point 3D [x,y,z] after Transform ",std::vector<double>,"");
+ BBTK_OUTPUT(ApplyTransformToPoint3D,OutDirection,"Direction 3D [x,y,z] after Transform",std::vector<double>,"");
+
+BBTK_END_DESCRIBE_BLACK_BOX(ApplyTransformToPoint3D);
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+}
+// EO namespace bbcreaVtk
+
+#endif // __bbcreaVtkApplyTransformToPoint3D_h_INCLUDED__
+
// bbSetOutputOut( bbGetInputIn() );
// std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+ printf("EED Plane::Process Start\n ");
vtkPlane *plane = NULL;
-
if ( (bbGetInputOrigin().size()==3) && (bbGetInputNormal().size()==3) )
{
plane = vtkPlane::New();
plane->SetOrigin( bbGetInputOrigin()[0],bbGetInputOrigin()[1],bbGetInputOrigin()[2] );
plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
+ printf("EED Plane::Process Origin = %f %f %f\n",bbGetInputOrigin()[0],bbGetInputOrigin()[1],bbGetInputOrigin()[2] );
+ printf("EED Plane::Process Normal = %f %f %f\n",bbGetInputNormal()[0],bbGetInputNormal()[1],bbGetInputNormal()[2] );
}
-
bbSetOutputOut( plane );
-
+ printf("EED Plane::Process End\n ");
}
//=====
p0[1] = 0;
p0[2] = 0;
+
+ bool byNormal=true;
double size=350;
// xy
if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==1) )
{
+ byNormal= false;
p1[0] = size;
p1[1] = 0;
p1[2] = 0;
// xz
if ((bbGetInputNormal()[0]==0) && (bbGetInputNormal()[1]==1) && (bbGetInputNormal()[2]==0) )
{
+ byNormal= false;
p1[0] = size;
p1[1] = 0;
p1[2] = 0;
// yz
if ((bbGetInputNormal()[0]==1) && (bbGetInputNormal()[1]==0) && (bbGetInputNormal()[2]==0) )
{
+ byNormal= false;
p1[0] = 0;
p1[1] = size;
p1[2] = 0;
p2[2] = size;
}
-
-
-/*
- p1[0] = 100;
- p1[1] = 0;
- p1[2] = 0;
- p2[0] = 0;
- p2[1] = 100;
- p2[2] = 0;
-*/
plane->SetResolution( bbGetInputXResolution(), bbGetInputYResolution() );
- plane->SetOrigin( p0 );
- plane->SetPoint1( p1 );
- plane->SetPoint2( p2 );
-// plane->Update( );
- plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
-// plane->Update( );
- plane->SetCenter( c );
+ if (byNormal==false)
+ {
+ plane->SetOrigin( p0 );
+ plane->SetPoint1( p1 );
+ plane->SetPoint2( p2 );
+ } else {
+ plane->SetNormal( bbGetInputNormal()[0], bbGetInputNormal()[1], bbGetInputNormal()[2] );
+ printf("EED PlaneSource. Missing mechanism to define the size of the plane\n");
+ }
+ plane->SetCenter( c );
+
plane->Update( );
bbSetOutputPlane( (vtkDataSet*)plane );
bbSetOutputPolyData( plane->GetOutput() );