Use vtkAxesActor To Show Three Axes In The World Coordinate System

I wanted to explore vtkPlaneSource’s interfaces SetPoint1 and SetPoint2 with visible 3D Axes. It’s awkward to find that it’s difficult to control plane’s shape by interfaces SetPoint1 and SetPoint2 directly. So I used vtkAxesActor to show three axes in the world coordinate system. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include Read more…

CPP – copy_if

The algorithm copy_if is useful, it can help us to get all elements that meet special conditions. C++ template OutputIt copy_if( InputIt first, InputIt last, OutputIt d_first, UnaryPredicate pred ); Possible implement: C++ template OutputIt copy_if(InputIt first, InputIt last, OutputIt d_first, UnaryPredicate pred) { while (first != last) { if Read more…

VTK – Debug And Print VTK Object

Print debug info by vtk macro How to show vtk object’s debug information? I introduce how to show vtk object’s debug information by the custom class which inherits vtkPolyDataAlgorithm, relevant article: 【VTK】Create source class which is derived from vtkPolyDataAlgorithm We just need to Star->DebugOn() and use vtkDebugMacro as std::cout. vtkDebugMacro( Read more…

VTK – Decimate Polydata With Scalar

How to decimate a PolyData without changing pointData’s scalar’s position? Two classes vtkQuadricDecimation and vtkDecimatePro are worth discussing. vtkQuadricDecimation can decimate pointdata’s scalar. We have to set AttributeErrorMetric true to handle it. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> Read more…

vtkCutter Find The Intersections Between Bounding Box Plane And Polydata

Create a simple cone and plane. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkRenderWindowInteractor.h> #include <vtkLight.h> #include <vtkCamera.h> #include <vtkOBBTree.h> #include <vtkActor2D.h> #include <vtkMath.h> #include <vtkTransform.h> #include <vtkTransformFilter.h> #include <vtkMatrix4x4.h> #include <vtkInteractorObserver.h> #include <vtkPolyDataNormals.h> #include <vtkOutlineFilter.h> #include <vtkPlaneSource.h> Read more…

VTK – Use vtkOBBTree To Find Axes Of 3D Model

I will show how to use vtkOBBTree to calculate X, Y and Z axis of the 3D model in the article. Create a simple cone. #include <iostream> #include <vtkSmartPointer.h> #include <vtkSphereSource.h> #include <vtkActor.h> #include <vtkConeSource.h> #include <vtkRenderer.h> #include <vtkRenderWindow.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkRenderWindowInteractor.h> #include <vtkLight.h> #include <vtkCamera.h> #include Read more…

CPP – Ignore Case To Compare String

STL Algorithm std::lexicographical_compare is an algorithm which can be used to compare string lexicographically.We can give our comparing function to make it work without pay attention to capital and small letter. C++ template constexpr bool lexicographical_compare( InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp ); Example: C++ #include Read more…

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X