[vtkusers] How to rotate and transform object imported using vtkOBJImporter class?
Bill Lorensen
bill.lorensen at gmail.com
Fri Aug 4 22:01:35 EDT 2017
This may help...
https://lorensen.github.io/VTKExamples/site/Cxx/IO/OBJImporter/
On Fri, Aug 4, 2017 at 9:52 PM, vinmean <iamdpak at gmail.com> wrote:
> I am new to vtk. I am using it along with pcl (point cloud library). I have
> been trying to import an .obj file along with texture information. I was
> able to do that using the below code. But I want to rotate and transform
> this object that I imported. How do I do it in vtk? I know to rotate and
> transform an mesh in pcl. Should I convert this object into pcl data type
> (pcl::TextureMesh) ? If so how do I do it?
>
>
> #include <pcl/common/common.h>
> #include <pcl/io/obj_io.h>
> #include <pcl/io/vtk_lib_io.h>
> #include <pcl/visualization/pcl_visualizer.h>
> #include <pcl/common/transforms.h>
> #include <vtkOBJImporter.h>
> #include <vtkRenderWindow.h>
> #include <vtkCamera.h>
> #include <vtkNew.h>
> #include "vtksys/SystemTools.hxx"
> #include <vtkOBJImporterInternals.h>
>
> int main(int argc, char** argv)
> {
> vtkNew<vtkOBJImporter> importer;
> std::string filenameOBJ("mesh.obj");
> std::string filenameMTL("mesh.mtl");
> std::string texfile1;
> std::string texture_path1 =
> vtksys::SystemTools::GetFilenamePath("mesh_material0000_map_Kd.png");
>
> importer->SetFileName(filenameOBJ.data());
> importer->SetFileNameMTL(filenameMTL.data());
> importer->SetTexturePath(texture_path1.data());
>
> boost::shared_ptr<pcl::visualization::PCLVisualizer>
> result_view(new pcl::visualization::PCLVisualizer("Viewer"));
>
> importer->SetRenderWindow(result_view->getRenderWindow());
> importer->Update();
>
> vtkSmartPointer<vtkRenderer> renderer
> =result_view->getRenderWindow()->GetRenderers()->GetFirstRenderer();
> renderer->ResetCamera();
>
> result_view->spin();
>
> return 0;
> }
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/How-to-rotate-and-transform-object-imported-using-vtkOBJImporter-class-tp5744300.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
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtkusers
mailing list