template <> inline std::string HumanTypeName< TYPE >(const TYPE&) \
{ return NAME; }
+ typedef std::vector< double > typeVectorDbl;
+
BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(std::string,"String");
BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed char,"Char");
BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(signed short,"Short");
BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(double,"Double");
BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(bool,"Bool");
BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME(long,"Long");
+// BBTK_DEFINE_HUMAN_READABLE_TYPE_NAME( typeVectorDbl ,"vecDbl");
// Human readable strings for std::vector
#define BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(TYPE) \
BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(uint32_t);
BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(long);
BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(float);
+
+
+
BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(double);
BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME(std::string);
+ BBTK_DEFINE_HUMAN_READABLE_VECTOR_TYPE_NAME( typeVectorDbl );
/// The bbtk::TypeInfo type is a const ref on std::type_info (which can only be manipulated as such (because typeid returns const std::type_info& and type_info has all constructors private))
typedef const std::type_info& TypeInfo;
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,double);
typedef std::string string;
BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement,string);
+
+typedef std::vector<double> vecDouble;
+
+BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,GetVectorElement, vecDouble );
+
//====================================================================
} // namespace bbstd
bbSetOutputOut( bbGetInputErrorValue() );
}
}
- //=================================================================
//=================================================================
template <class T>
{
bbSetInputI(0);
}
- //=================================================================
- //=================================================================
+
+//=================================================================
template <class T>
void GetVectorElement<T>::bbUserInitializeProcessing()
{
-
}
+
//=================================================================
- //=================================================================
template <class T>
void GetVectorElement<T>::bbUserFinalizeProcessing()
{
-
}
- //=================================================================
} // namespace bbstd
bbSetOutputOut(true);
}
- printf("EED StringTo 5\n");
+
}
// Template specialization of DoIt
//=====
// 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 "bbvtkPlaneClipPolyData.h"
#include "bbvtkPackage.h"
+
+#include <vtkClipPolyData.h>
+#include <vtkClipClosedSurface.h>
+#include <vtkPlaneCollection.h>
+
namespace bbvtk
{
plane->SetOrigin(origin[0],origin[1],origin[2]);
plane->SetNormal(normal[0],normal[1],normal[2]);
- vtkClipPolyData* clipper = vtkClipPolyData::New();
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- clipper->SetInputConnection(inPolyData->GetProducerPort());
-#else
- clipper->SetInputData(inPolyData);
-#endif
-
- clipper->SetClipFunction(plane);
- clipper->Update();
-
- vtkPolyData* outPolydata = clipper->GetOutput();
- bbSetOutputClippedPolyData(outPolydata);
-
- // std::cout << "RaC PlaneClipPolyData::Process END "<<polydataCopy<< std::endl;
+ if (bbGetInputCloseSurface()==false) // with holes
+ {
+ vtkClipPolyData* clipper = vtkClipPolyData::New();
+ clipper->SetClipFunction(plane);
+ clipper->Update();
+ bbSetOutputClippedPolyData( clipper->GetOutput() );
+ } else { // true with out holes
+ vtkClipClosedSurface* clipper = vtkClipClosedSurface::New();
+ clipper->SetInputData(inPolyData);
+ vtkPlaneCollection *planes = vtkPlaneCollection::New();
+ planes->AddItem(plane);
+ clipper->SetClippingPlanes(planes);
+ clipper->Update();
+ bbSetOutputClippedPolyData( clipper->GetOutput() );
+ }
}
//=====
//=====
void PlaneClipPolyData::bbUserSetDefaultValues()
{
+ bbSetInputCloseSurface(false);
}
//=====
#include "bbtkAtomicBlackBox.h"
#include "iostream"
-#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
-#include <vtkClipPolyData.h>
-#include <vtkPlane.h>
-
-#include <vtkDataSetMapper.h>
-#include <vtkActor.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderWindowInteractor.h>
-
-#include <vtkCamera.h>
-#include <vtkPolyDataMapper.h>
-#include <vtkActor.h>
-#include <vtkProperty.h>
-#include <vtkSphereSource.h>
namespace bbvtk
{
BBTK_DECLARE_INPUT(PlaneOrigin,std::vector<double>);
BBTK_DECLARE_INPUT(PlaneNormal,std::vector<double>);
BBTK_DECLARE_INPUT(PolyData,vtkPolyData*);
+ BBTK_DECLARE_INPUT(CloseSurface,bool);
BBTK_DECLARE_OUTPUT(ClippedPolyData,vtkPolyData*);
BBTK_PROCESS(Process);
void Process();
BBTK_BEGIN_DESCRIBE_BLACK_BOX(PlaneClipPolyData,bbtk::AtomicBlackBox);
BBTK_NAME("PlaneClipPolyData");
-BBTK_AUTHOR("Ricardo A Corredor");
+BBTK_AUTHOR("Ricardo A COREDOR /Eduardo DAVILA");
BBTK_DESCRIPTION("Clips a polydata with a plane determined by the origin and normal given");
BBTK_CATEGORY("");
+BBTK_INPUT(PlaneClipPolyData,CloseSurface,"(default false) false : hole in the clip plane; true : with out hole in the clip plane",bool,"");
BBTK_INPUT(PlaneClipPolyData,PlaneOrigin,"Cutting plane origin",std::vector<double>,"");
BBTK_INPUT(PlaneClipPolyData,PlaneNormal,"Cutting plane normal",std::vector<double>,"");
BBTK_INPUT(PlaneClipPolyData,PolyData,"PolyData to be clipped",vtkPolyData*,"");
} // for j
m->Modified();
result->Update();
- } // ManualMatrix
-
+ } // ManualMatrix4x4
+
+ if (bbGetInputManualMatrix3x3In().size()==9)
+ {
+ std::vector<double> manaulMatrixIn = bbGetInputManualMatrix3x3In();
+ vtkMatrix4x4* m = result->GetMatrix();
+ int i,j,ii=0;
+ for (j=0;j<3;j++)
+ {
+ for (i=0;i<3;i++)
+ {
+ // m->SetElement(j,i,manaulMatrixIn[ii]);
+ m->SetElement(j,i,manaulMatrixIn[ii]);
+ ii++;
+ }// for i
+ } // for j
+ m->SetElement(3,0,0);
+ m->SetElement(3,1,0);
+ m->SetElement(3,2,0);
+ m->SetElement(3,3,1);
+ m->SetElement(0,3,0);
+ m->SetElement(1,3,0);
+ m->SetElement(2,3,0);
+
+ m->Modified();
+ result->Update();
+ } // ManualMatrix3x3
+
vtkTransform * finalTransform;
if (bbGetInputInverse()==false)
{
finalTransform = result;
} else {
- vtkMatrix4x4 *matrix;
- matrix=vtkMatrix4x4::New();
- result->GetInverse(matrix);
- resultInverse->SetMatrix( matrix );
- finalTransform = resultInverse;
+ vtkMatrix4x4 *matrix;
+ matrix = vtkMatrix4x4::New();
+ result -> GetInverse(matrix);
+ resultInverse -> SetMatrix( matrix );
+ finalTransform = resultInverse;
} // if Inverse
bbSetOutputOut(finalTransform);
BBTK_DECLARE_INPUT(Translate,std::vector<double>);
BBTK_DECLARE_INPUT(Spacing,std::vector<double>);
BBTK_DECLARE_INPUT(RotateToNormal,std::vector<double>);
- BBTK_DECLARE_INPUT(ManualMatrixIn,std::vector<double>);
+ BBTK_DECLARE_INPUT(ManualMatrixIn,std::vector<double>);
+ BBTK_DECLARE_INPUT(ManualMatrix3x3In,std::vector<double>);
BBTK_DECLARE_OUTPUT(Out,vtkLinearTransform *);
BBTK_DECLARE_OUTPUT(ManualMatrixOut,std::vector<double>);
BBTK_PROCESS(Process);
BBTK_INPUT(Transform,RotateWXYZ,"vector with Angle Vx Vy Vz",std::vector<double>,"");
BBTK_INPUT(Transform,RotateToNormal,"(default is EMPTY) Normal vector [nx,ny,nz]",std::vector<double>,"");
BBTK_INPUT(Transform,ManualMatrixIn,"(default EMPTY) The 16 elements of a 4x4 matrix",std::vector<double>,"");
+ BBTK_INPUT(Transform,ManualMatrix3x3In,"(default EMPTY) The 9 elements of a 3x3 matrix",std::vector<double>,"");
BBTK_OUTPUT(Transform,Out,"vtkTransform result",vtkLinearTransform *,"");
BBTK_OUTPUT(Transform,ManualMatrixOut,"The 16 elements of the 4x4 matrix",std::vector<double>,"");