//===== // 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 "bbcreaVtkDelaunay3D.h" #include "bbcreaVtkPackage.h" #include "vtkPoints.h" #include "vtkDelaunay2D.h" #include "vtkDelaunay3D.h" #include "vtkShrinkFilter.h" #include "vtkGeometryFilter.h" #include #include #include #include #include #include #include #include #include namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,Delaunay3D) BBTK_BLACK_BOX_IMPLEMENTATION(Delaunay3D,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 Delaunay3D::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 = " < lstX=bbGetInputLstPointsX(); std::vector lstY=bbGetInputLstPointsY(); std::vector lstZ=bbGetInputLstPointsZ(); if (lstX.size()!=0) { vtkPoints *points = vtkPoints::New(); int i,size=lstX.size(); for (i=0;iInsertNextPoint( lstX[i], lstY[i], lstZ[i] ); } // for i vtkPolyData *inputpolydata = vtkPolyData::New(); inputpolydata->SetPoints( points ); /* Delaunay */ vtkDelaunay3D* delaunay = vtkDelaunay3D::New(); delaunay->SetInputData( inputpolydata ); delaunay->SetTolerance( bbGetInputTolerance() ); //0.01 delaunay->SetAlpha( bbGetInputAlpha() ); //0.2 delaunay->BoundingTriangulationOff(); delaunay->Update(); vtkGeometryFilter *geometry = vtkGeometryFilter::New(); geometry->SetInputData( delaunay->GetOutput() ); geometry->Update(); bbSetOutputOut( geometry->GetOutput() ); } else { printf("Warnning! Delaunay3D::Process: list of points empty. \n"); } // if lstX.size } //===== // 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 Delaunay3D::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputTolerance( 0 ); bbSetInputAlpha( 0 ); } //===== // 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 Delaunay3D::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 Delaunay3D::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk