[vtkusers] vtk3ddelaunay save in .ply, .stl, .obj or .wrl
Chiranjib Sur
sur.chiranjib at gmail.com
Sat May 6 11:24:27 EDT 2017
Hi,
You can use vtkPLYWriter / vtkSTLWriter to convert you file in the desired
format.
Here is a page with examples:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/WritePLY
Thanks,
Chiranjib
On Wed, May 3, 2017 at 1:30 AM, mozendi <mozendi at gmail.com> wrote:
> Dear VTK users,
>
> I am using VTK to generate a 3D Delaunay triangulation from a list of input
> points that are obtained using terrestrial laser scanner. So far, I
> successfully generated some 3D triangulations and saved them in vtk or vtu
> file formats. However, I need to save them as one of the popular formats
> such as .ply, .stl, .obj or .wrl. Could you please tell me how can I save
> 3d
> triangulation in one of these formats? My other question is about setAlpha
> and setTolerance parameters, could you please explain me these parameters
> in
> detail?
> Thanks in advance
>
> int main( int argc, char* argv[] )
> {
> //load the point cloud
> vtkSmartPointer<vtkSimplePointsReader> reader =
> vtkSmartPointer<vtkSimplePointsReader>::New();
> reader->SetFileName("kucuk50k.xyz");
> reader->Update();
> vtkPolyData* polydata = reader->GetOutput();
> std::cout << "The point cloud is loaded" << std::endl;
> //end of point cloud loading
> std::cout << "----------------------------------------------" <<
> std::endl;
> // Generate a mesh from the input points. If Alpha is non-zero,
> then
> // tetrahedra, triangles, edges and vertices that lie within the
> // alpha radius are output.
> std::cout << "Start delaunay 3d triangulation" << std::endl;
> vtkSmartPointer<vtkDelaunay3D> delaunay3DAlpha =
> vtkSmartPointer<vtkDelaunay3D>::New();
> delaunay3DAlpha->SetInputConnection(reader->GetOutputPort());
> delaunay3DAlpha->SetAlpha(0.01);
> std::cout << "3d Delaunay computed" << std::endl;
> std::cout << "----------------------------------------------" <<
> std::endl;
> std::cout << "Start writing the triangulation" << std::endl;
> vtkSmartPointer<vtkXMLUnstructuredGridWriter> ugWriter =
> vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
> ugWriter->SetInputConnection(delaunay3DAlpha->GetOutputPort());
> ugWriter->SetFileName("delaunayy_50k.vtk");
> ugWriter->Write();
> std::cout << "VTK file created" << std::endl;
> return EXIT_SUCCESS;
> }
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.
> com/vtk3ddelaunay-save-in-ply-stl-obj-or-wrl-tp5743046.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170506/86ca7a75/attachment.html>
More information about the vtkusers
mailing list