说明
使用vtk计算一个物体表面的cell法线,同箭头表示法线方向,要求箭头的位置位于该cell的中心
效果图

源码
#include <vtkSmartPointer.h>
#include <vtkActor.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkPolyDataReader.h>
#include <vtkFloatArray.h>
#include <vtkPointData.h>
#include <vtkPolyDataNormals.h>
#include <vtkGlyph3D.h>
#include <vtkArrowSource.h>
#include <vtkMaskPoints.h>
#include <vtkProperty.h>
#include <vtkCellCenters.h>
#include <vtkSphereSource.h>
#include <vtkDoubleArray.h>
#include <vtkGenericCell.h>
int main(int argc, char* argv[])
{
// Create a sphere
vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New();
sphereSource->

本文介绍了如何使用VTK库在三维图形中计算并显示一个物体表面的cell法线,箭头指向法线方向,箭头位置位于对应cell的中心,提供了完整的C++代码示例。
最低0.47元/天 解锁文章
967

被折叠的 条评论
为什么被折叠?



