VTK 建模方法:Extrusion

pcl+vtk(三)QT中使用QVTKOpenGLNativeWidget的简单教程以及案例,利用PCLVisualizer显示点云 先添加一个带有ui的QT应用程序。然后将QOpenGLWidget控件提升为QVTKOpenGLNativeWidget控件,步骤如下: 阅读详情

VTK 建模方法:Extrusion

vtkImplicitModeller 建模的局限性

前一篇文章 《VTK 建模方法:建模基础》 介绍了如何使用 vtkImplicitModeller 类进行建模。它的局限性体现在以下 3 个方面:

  1. 场景的局限性:vtkImplicitModeller 建模生成的模型比较光滑,工业场景中经常存在有棱有角的模型,使用 vtkImplicitModeller 就不能很好完成建模。
  2. 精度的局限性:无论采样的精度有多高,vtkImplicitModeller 建模终究不是精准的表述。
  3. 性能的局限性:如果把采样精度设置得很高,vtkImplicitModeller 建模就会消耗大量的计算资源,性能表现不好。

什么是 Extrusion?

Extrusion 在塑料加工中又称挤出成型或挤塑,在橡胶加工中又称压出。是指物料通过挤出机料筒和螺杆间的作用,边受热塑化,边被螺杆向前推送,连续通过机头而制成各种截面制品或半制品的一种加工方法。

VTK 中提供了 2 个过滤器来实现 Extrusion 这种建模效果:vtkLinearExtrusionFilter 和 vtkRotationalExtrusionFilter。前者进行线性拉伸或挤压,后者进行旋转拉伸或挤压。

实例 1:圆柱

我们分别使用 vtkLinearExtrusionFilter 和 vtkRotationalExtrusionFilter 完成一个圆柱的建模。

方法一:生成一个圆面,使用 vtkLinearExtrusionFilter 对圆面进行线性拉伸成一个圆柱。

方法二:生成一个矩形,使用 vtkRotationalExtrusionFilter 对矩形进行旋转拉伸成一个圆柱。

代码:

#include "VTKExtrusion.h"

#include <vtkRegularPolygonSource.h>
#include <vtkPoints.h>
#include <vtkCellArray.h>
#include <vtkPolyData.h>
#include <vtkLinearExtrusionFilter.h>
#include <vtkRotationalExtrusionFilter.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>

VTKExtrusion::VTKExtrusion(QWidget* parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	_pVTKWidget = new QVTKOpenGLNativeWidget();
	this->setCentralWidget(_pVTKWidget);

	vtkNew<vtkRenderer> renderer;
	this->_pVTKWidget->renderWindow()->AddRenderer(renderer);
	this->_pVTKWidget->renderWindow()->Render();

	// LinearExtrusion
	vtkNew<vtkRegularPolygonSource> circle;
	circle->GeneratePolygonOn(); // 生成一个多边形,不设置的话只会生成一个边界
	circle->SetNumberOfSides(360);
	circle->SetRadius(2);
	circle->SetCenter(0, 0, 0);

	vtkNew<vtkLinearExtrusionFilter> linearExtrusion;
	linearExtrusion->SetInputConnection(circle->GetOutputPort());

	// RotationalExtrusion
	vtkNew<vtkPoints> points;
	points->InsertNextPoint(0, 0, 0);
	points->InsertNextPoint(2, 0, 0);
	points->InsertNextPoint(2, 0, 1);
	points->InsertNextPoint(0, 0, 1);

	vtkNew<vtkCellArray> lines;
	lines->InsertNextCell(4);
	lines->InsertCellPoint(0);
	lines->InsertCellPoint(1);
	lines->InsertCellPoint(2);
	lines->InsertCellPoint(3);

	vtkNew<vtkPolyData> profile;
	profile->SetPoints(points);
	profile->SetLines(lines);

	vtkNew<vtkRotationalExtrusionFilter> rotationalExtrusion;
	rotationalExtrusion->SetInputData(profile);
	rotationalExtrusion->SetAngle(360); // 旋转角度
	rotationalExtrusion->SetResolution(90); // 旋转面数(精度)

	// mapper
	vtkNew<vtkPolyDataMapper> lxMapper;
	lxMapper->SetInputConnection(linearExtrusion->GetOutputPort());
	vtkNew<vtkPolyDataMapper> rxMapper;
	rxMapper->SetInputConnection(rotationalExtrusion->GetOutputPort());

	vtkNew<vtkActor> lxActor;
	lxActor->SetMapper(lxMapper);
	vtkNew<vtkActor> rxActor;
	rxActor->SetMapper(rxMapper);
	rxActor->SetPosition(5, 0, 0);

	renderer->AddActor(lxActor);
	renderer->AddActor(rxActor);
}

VTKExtrusion::~VTKExtrusion()
{}

运行结果:

在这里插入图片描述

切换成线框模式,就可以看出两种建模的区别:

在这里插入图片描述

实例 1 修改:以一个点为参照做线性拉伸

vtkLinearExtrusionFilter 和 vtkRotationalExtrusionFilter 都默认使用 VTK_VECTOR_EXTRUSION 作矢量拉伸,我们可以设置成以一个点为参照做拉伸,通过设置参照点的坐标和拉伸系数,来达到想要的拉伸效果。

	// 以一个点为参照做线性拉伸
	linearExtrusion->SetExtrusionTypeToPointExtrusion();
	// linearExtrusion->SetExtrusionType(VTK_POINT_EXTRUSION);
	linearExtrusion->SetExtrusionPoint(0, 0, 5);
	linearExtrusion->SetScaleFactor(0.2);

运行结果:

在这里插入图片描述

实例 2:文字线性拉伸

使用 vtkLinearExtrusionFilter 对文字做线性拉伸,是 vtkLinearExtrusionFilter 的一个常用场景。

在这里插入图片描述

线框模式:

在这里插入图片描述

实例 3:圆面旋转拉伸成弹簧

将圆面的中心点设置在圆面以外,使用 vtkRotationalExtrusionFilter 类进行旋转拉伸,设置旋转角度为2160度,旋转面数为360,拉伸长度为6,就可以得到一个弹簧。

#include "VTKRotationalExtrusionSpring.h"

#include <vtkRegularPolygonSource.h>
#include <vtkNamedColors.h>
#include <vtkProperty.h>
#include <vtkRotationalExtrusionFilter.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>

VTKRotationalExtrusionSpring::VTKRotationalExtrusionSpring(QWidget* parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	_pVTKWidget = new QVTKOpenGLNativeWidget();
	this->setCentralWidget(_pVTKWidget);

	vtkNew<vtkRenderer> renderer;
	this->_pVTKWidget->renderWindow()->AddRenderer(renderer);
	this->_pVTKWidget->renderWindow()->Render();

	vtkNew<vtkNamedColors> colors;

	// Circle
	vtkNew<vtkRegularPolygonSource> circle;
	circle->GeneratePolygonOn(); // 生成一个多边形,不设置的话只会生成一个边界
	circle->SetNumberOfSides(360);
	circle->SetRadius(0.2);
	circle->SetCenter(1, 0, 0); // 中心
	circle->SetNormal(0, 1, 0); // 法向量

	// Spring
	vtkNew<vtkRotationalExtrusionFilter> rotationalExtrusion;
	rotationalExtrusion->SetInputConnection(circle->GetOutputPort());
	rotationalExtrusion->SetAngle(2160); // 旋转角度
	rotationalExtrusion->SetResolution(360); // 旋转面数(精度)
	rotationalExtrusion->SetTranslation(6); // 拉伸长度,拉伸方向垂直于旋转

	// mapper
	vtkNew<vtkPolyDataMapper> mapper;
	mapper->SetInputConnection(rotationalExtrusion->GetOutputPort());

	// actor
	vtkNew<vtkActor> actor;
	actor->SetMapper(mapper);
	actor->GetProperty()->SetColor(colors->GetColor3d("Gold").GetData());

	renderer->AddActor(actor);
}

VTKRotationalExtrusionSpring::~VTKRotationalExtrusionSpring()
{}

运行效果:

在这里插入图片描述

实例 4:自定义 vtkRotationalExtrusionFilter

在实例3的弹簧建模中,新增一行代码:

rotationalExtrusion->SetDeltaRadius(1);

运行结果:

在这里插入图片描述

可以看到在旋转的过程中,弹簧的截面由圆变成了椭圆。

要想实现保持基础图形半径不变的旋转拉伸,我们可以自定义 vtkRotationalExtrusionFilter。下面是一个 myRotationalExtrusionFilter 类的实现,修改了 RequestData 函数,最后通过 vtkStandardNewMacro(myRotationalExtrusionFilter) 完成了该类的注册。

namespace
{
	class myRotationalExtrusionFilter : public vtkRotationalExtrusionFilter
	{
	public:
		static myRotationalExtrusionFilter* New();
	protected:
		int RequestData(vtkInformation* vtkNotUsed(request),
			vtkInformationVector** inputVector, vtkInformationVector* outputVector)
		{
			// get the info objects
			vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
			vtkInformation* outInfo = outputVector->GetInformationObject(0);

			// get the input and output
			vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
			vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));

			vtkIdType numPts, numCells;
			vtkPointData* pd = input->GetPointData();
			vtkCellData* cd = input->GetCellData();
			vtkPolyData* mesh;
			vtkPoints* inPts;
			vtkCellArray* inVerts, * inLines, * inPolys, * inStrips;
			int numEdges;
			const vtkIdType* pts = nullptr;
			vtkIdType npts = 0;
			vtkIdType cellId, ptId, ncells;
			double x[3], newX[3], angleIncr, radIncr, transIncr;
			vtkPoints* newPts;
			vtkCellArray* newLines = nullptr, * newPolys = nullptr, * newStrips;
			vtkCell* edge;
			vtkIdList* cellIds;
			int i, j, k;
			vtkIdType p1, p2;
			vtkPointData* outPD = output->GetPointData();
			vtkCellData* outCD = output->GetCellData();
			bool abort = false;

			// Initialize / check input
			//
			vtkDebugMacro(<< "Rotationally extruding data");

			numPts = input->GetNumberOfPoints();
			numCells = input->GetNumberOfCells();
			if (numPts < 1 || numCells < 1)
			{
				vtkErrorMacro(<< "No data to extrude!");
				return 1;
			}

			double normalizedRotationAxis[3] = { this->RotationAxis[0], this->RotationAxis[1],
			  this->RotationAxis[2] };
			double norm = vtkMath::Normalize(normalizedRotationAxis);

			// if norm is equal to zero, the extrusion cannot be done
			if (norm == 0.0)
			{
				vtkErrorMacro(<< "Cannot perform extrusion around an axis with a norm of 0.");
				return 0;
			}

			// Build cell data structure.
			//
			mesh = vtkPolyData::New();
			inPts = input->GetPoints();
			inVerts = input->GetVerts();
			inLines = input->GetLines();
			inPolys = input->GetPolys();
			inStrips = input->GetStrips();
			mesh->SetPoints(inPts);
			mesh->SetVerts(inVerts);
			mesh->SetLines(inLines);
			mesh->SetPolys(inPolys);
			mesh->SetStrips(inStrips);
			if (inPolys || inStrips)
			{
				mesh->BuildLinks();
			}

			// Allocate memory for output. We don't copy normals because surface geometry
			// is modified.
			//
			outPD->CopyNormalsOff();
			outPD->CopyAllocate(pd, (this->Resolution + 1) * numPts);
			newPts = vtkPoints::New();
			newPts->Allocate((this->Resolution + 1) * numPts);
			if ((ncells = inVerts->GetNumberOfCells()) > 0)
			{
				newLines = vtkCellArray::New();
				newLines->AllocateEstimate(ncells, this->Resolution + 1);
			}
			// arbitrary initial allocation size
			ncells = inLines->GetNumberOfCells() + inPolys->GetNumberOfCells() / 10 +
				inStrips->GetNumberOfCells() / 10;
			ncells = (ncells < 100 ? 100 : ncells);
			newStrips = vtkCellArray::New();
			newStrips->AllocateEstimate(ncells, 2 * (this->Resolution + 1));
			outCD->CopyNormalsOff();
			outCD->CopyAllocate(cd, ncells);

			// copy points
			for (ptId = 0; ptId < numPts; ptId++) // base level
			{
				newPts->InsertPoint(ptId, inPts->GetPoint(ptId));
				outPD->CopyData(pd, ptId, ptId);
			}
			this->UpdateProgress(0.1);

			radIncr = this->DeltaRadius / this->Resolution;
			transIncr = this->Translation / this->Resolution;
			angleIncr = vtkMath::RadiansFromDegrees(this->Angle) / this->Resolution;

			double rotationAngleAndAxis[4] = { 0, this->RotationAxis[0], this->RotationAxis[1],
			  this->RotationAxis[2] };

			double c[3];
			input->GetCenter(c);
			double newC[3];

			for (i = 1; i <= this->Resolution; i++)
			{
				this->UpdateProgress(0.1 + 0.5 * (i - 1) / this->Resolution);
				for (ptId = 0; ptId < numPts; ptId++)
				{
					inPts->GetPoint(ptId, x);

					rotationAngleAndAxis[0] = i * angleIncr;
					vtkMath::RotateVectorByWXYZ(c, rotationAngleAndAxis, newC);
					vtkMath::RotateVectorByWXYZ(x, rotationAngleAndAxis, newX);

					newC[0] += normalizedRotationAxis[0] * i * transIncr;
					newC[1] += normalizedRotationAxis[1] * i * transIncr;
					newC[2] += normalizedRotationAxis[2] * i * transIncr;
					newX[0] += normalizedRotationAxis[0] * i * transIncr;
					newX[1] += normalizedRotationAxis[1] * i * transIncr;
					newX[2] += normalizedRotationAxis[2] * i * transIncr;

					double projection[3];
					double radialVector[3];
					vtkMath::ProjectVector(newC, normalizedRotationAxis, projection);
					vtkMath::Subtract(newC, projection, radialVector);

					newC[0] += radialVector[0] * i * radIncr;
					newC[1] += radialVector[1] * i * radIncr;
					newC[2] += radialVector[2] * i * radIncr;

					vtkMath::ProjectVector(newX, normalizedRotationAxis, projection);
					vtkMath::Subtract(newX, projection, radialVector);

					newX[0] += radialVector[0] * i * radIncr;
					newX[1] += radialVector[1] * i * radIncr;
					newX[2] += radialVector[2] * i * radIncr;

					double d0 = c[0] - x[0];
					double d1 = c[1] - x[1];
					double d2 = c[2] - x[2];
					double r = sqrt(d0 * d0 + d1 * d1 + d2 * d2);

					double newD0 = newC[0] - newX[0];
					double newD1 = newC[1] - newX[1];
					double newD2 = newC[2] - newX[2];
					double newR = sqrt(newD0 * newD0 + newD1 * newD1 + newD2 * newD2);

					double dbScale = r / newR;

					newX[0] = newC[0] + (newX[0] - newC[0]) * dbScale;
					newX[1] = newC[1] + (newX[1] - newC[1]) * dbScale;
					newX[2] = newC[2] + (newX[2] - newC[2]) * dbScale;

					newPts->InsertPoint(ptId + i * numPts, newX);
					outPD->CopyData(pd, ptId, ptId + i * numPts);
				}
			}

			// To ensure that cell attributes are in consistent order with the
			// cellId's, we process the verts, lines, polys and strips in order.
			vtkIdType newCellId = 0;
			int type;
			if (newLines) // there are verts which produce lines
			{
				for (cellId = 0; cellId < numCells && !abort; cellId++)
				{
					type = mesh->GetCellType(cellId);
					if (type == VTK_VERTEX || type == VTK_POLY_VERTEX)
					{
						mesh->GetCellPoints(cellId, npts, pts);
						for (i = 0; i < npts; i++)
						{
							ptId = pts[i];
							newLines->InsertNextCell(this->Resolution + 1);
							for (j = 0; j <= this->Resolution; j++)
							{
								newLines->InsertCellPoint(ptId + j * numPts);
							}
							outCD->CopyData(cd, cellId, newCellId++);
						}
					} // if a vertex or polyVertex
				}   // for all cells
			}     // if there are verts generating lines
			this->UpdateProgress(0.25);
			abort = this->CheckAbort();

			// If capping is on, copy 2D cells to output (plus create cap). Notice
			// that polygons are done first, then strips.
			//
			if (this->Capping &&
				(this->Angle != 360.0 || this->DeltaRadius != 0.0 || this->Translation != 0.0))
			{
				if (inPolys->GetNumberOfCells() > 0)
				{
					newPolys = vtkCellArray::New();
					newPolys->AllocateCopy(inPolys);

					for (cellId = 0; cellId < numCells && !abort; cellId++)
					{
						type = mesh->GetCellType(cellId);
						if (type == VTK_TRIANGLE || type == VTK_QUAD || type == VTK_POLYGON)
						{
							mesh->GetCellPoints(cellId, npts, pts);
							newPolys->InsertNextCell(npts, pts);
							outCD->CopyData(cd, cellId, newCellId++);
							newPolys->InsertNextCell(npts);
							for (i = 0; i < npts; i++)
							{
								newPolys->InsertCellPoint(pts[i] + this->Resolution * numPts);
							}
							outCD->CopyData(cd, cellId, newCellId++);
						}
					}
				}

				for (cellId = 0; cellId < numCells && !abort; cellId++)
				{
					type = mesh->GetCellType(cellId);
					if (type == VTK_TRIANGLE_STRIP)
					{
						mesh->GetCellPoints(cellId, npts, pts);
						newStrips->InsertNextCell(npts, pts);
						outCD->CopyData(cd, cellId, newCellId++);
						newStrips->InsertNextCell(npts);
						for (i = 0; i < npts; i++)
						{
							newStrips->InsertCellPoint(pts[i] + this->Resolution * numPts);
						}
						outCD->CopyData(cd, cellId, newCellId++);
					}
				}
			} // if capping
			this->UpdateProgress(0.5);
			abort = this->CheckAbort();

			// Now process lines, polys and/or strips to produce strips
			//
			if (inLines->GetNumberOfCells() || inPolys->GetNumberOfCells() || inStrips->GetNumberOfCells())
			{
				cellIds = vtkIdList::New();
				cellIds->Allocate(VTK_CELL_SIZE);
				vtkGenericCell* cell = vtkGenericCell::New();

				for (cellId = 0; cellId < numCells && !abort; cellId++)
				{
					type = mesh->GetCellType(cellId);
					if (type == VTK_LINE || type == VTK_POLY_LINE)
					{
						mesh->GetCellPoints(cellId, npts, pts);
						for (i = 0; i < (npts - 1); i++)
						{
							p1 = pts[i];
							p2 = pts[i + 1];
							newStrips->InsertNextCell(2 * (this->Resolution + 1));
							for (j = 0; j <= this->Resolution; j++)
							{
								newStrips->InsertCellPoint(p2 + j * numPts);
								newStrips->InsertCellPoint(p1 + j * numPts);
							}
							outCD->CopyData(cd, cellId, newCellId++);
						}
					} // if a line

					else if (type == VTK_TRIANGLE || type == VTK_QUAD || type == VTK_POLYGON ||
						type == VTK_TRIANGLE_STRIP)
					{ // create strips from boundary edges
						mesh->GetCell(cellId, cell);
						numEdges = cell->GetNumberOfEdges();
						for (i = 0; i < numEdges; i++)
						{
							edge = cell->GetEdge(i);
							for (j = 0; j < (edge->GetNumberOfPoints() - 1); j++)
							{
								p1 = edge->PointIds->GetId(j);
								p2 = edge->PointIds->GetId(j + 1);
								mesh->GetCellEdgeNeighbors(cellId, p1, p2, cellIds);

								if (cellIds->GetNumberOfIds() < 1) // generate strip
								{
									newStrips->InsertNextCell(2 * (this->Resolution + 1));
									for (k = 0; k <= this->Resolution; k++)
									{
										newStrips->InsertCellPoint(p2 + k * numPts);
										newStrips->InsertCellPoint(p1 + k * numPts);
									}
									outCD->CopyData(cd, cellId, newCellId++);
								} // if boundary edge
							}   // for each sub-edge
						}     // for each edge
					}       // for each polygon or triangle strip
				}         // for all cells

				cellIds->Delete();
				cell->Delete();
			} // if strips are being generated
			this->UpdateProgress(1.00);

			// Update ourselves and release memory
			//
			output->SetPoints(newPts);
			newPts->Delete();
			mesh->Delete();

			if (newLines)
			{
				output->SetLines(newLines);
				newLines->Delete();
			}

			if (newPolys)
			{
				output->SetPolys(newPolys);
				newPolys->Delete();
			}

			output->SetStrips(newStrips);
			newStrips->Delete();

			output->Squeeze();

			return 1;
		}
	};

	vtkStandardNewMacro(myRotationalExtrusionFilter);
}

最后在建模代码中把 vtkRotationalExtrusionFilter 换成自定义的 myRotationalExtrusionFilter,运行结果:

在这里插入图片描述

PCL1.11.0+VTK8.2.0+QT5.14.2+VS2019在Win10环境下的配置(小白必看!)QVTKOpenGLNativeWidget 文章目录前期准备PCL安装说明QT安装说明VS2019安装说明VTK编译说明1.新建三个目录2.以管理员身份运行Cmake3.部署Cmake环境4.以管理员身份运行Visual Studio 2019 编译VTK5.给Qt添加QVTKOpenGLNativeWidget新建工程测试VTK 前期准备 PCL源码 (PCL-1.11.0-AllInOne-msvc2019-win64) https://github.com/PointCloudLibrary/pcl/releases VTK源码 阅读详情

相关推荐

【VTKExamples::PolyData】第二十期 ImplicitModeller

本文分享VTK样例ImplicitModeller技术,并解析接口vtkImplicitModeller,希望对各位小伙伴有所帮助!

qq_40041064的博客 736

VTK-三维交互窗口-QVTKOpenGLNativeWidget

主要介绍VTK中常用的三维交互窗口QVTKOpenGLNativeWidget在Qt中的应用方式,以及如何自定义三维交互窗口

qq_40041064的博客 3870

VTK:创建字母频率的条形图用法实战

VTK:创建字母频率的条形图 用法实战程序输出程序完整源代码 程序输出 AlphaFrequency 程序完整源代码 #include <vtkActor.h> #include <vtkCamera.h> #include <vtkLinearExtrusionFilter.h> #include <vtkNamedColors.h> #include <vtkNew.h> #include <vtkPolyDataMapper.h>

希望我的博客,能帮上你解决学习中工作中所遇到的问题 348

VTK 建模方法:建模基础

VTK 建模方法:建模基础

ProgramNovice的博客 1911

【VTKExamples::Modelling】第三期 Spring

本文分享VTK-Modelling模块的样例Spring,并解析接口vtkRotationalExtrusionFilter,希望对各位小伙伴有所帮助!

qq_40041064的博客 743

VTK实战:构建金字塔模型

本文介绍如何使用VTK(Visualization Toolkit)构建金字塔模型,并提供相关源代码。最终,我们将会看到一个三维的金字塔模型。VTK实战:构建金字塔模型。

CyberLynxO的博客 157

VTK核心建模工具:vtkLinearExtrusionFilter

VTK的vtkLinearExtrusionFilter是一个高效的多边形数据挤压工具,可将2D图形转换为3D结构。它支持三种挤压模式:向量挤压(固定方向)、法向挤压(沿顶点法线)和点挤压(向目标点聚拢)。该工具提供简洁API,支持封口、缩放等参数设置,适用于快速3D建模、数据可视化增强等场景。示例代码展示了如何将2D矩形通过向量挤压生成长方体,输出结果包含6个面单元。该过滤器在机械零件原型、建筑构件和2.5D场景构建中具有广泛应用价值。

dengbiwei的博客 1670

网格处理实战:使用VTK库进行三维建模

VTK(Visualization Toolkit)是一个开源的跨平台的图形图像处理工具库,主要用于科学和医学的可视化数据处理。其中,网格数据是VTK重要的数据类型之一,广泛应用于三维建模和渲染。调用Update()方法来计算网格数据,并使用GetOutput()方法获取网格数据。我们将以一个简单的立方体为例,演示如何进行网格创建、变换、裁剪、选择和导出等操作。以上就是使用VTK库进行三维建模的简单示例代码,通过这些代码我们可以对三维网格进行创建、变换、裁剪、选择和导出等操作。

Meta_C的博客 566

VTK stl模型上绘制点

1,因为VTK中的点 在场景中是一个正方形,无法特和到模型表面,所以不能直接使用vtkPoint绘制,这里采用vtkRegularPolygonSource 这个类,并将点的法向量设置给他,这样就是一个比较贴合的点了。3,因为 向量 可能不在一个方向因此绘制出来的点 可能看不见,因此需要 使用vtkLinearExtrusionFilter 进行两次计算。需求:导入多个stl模型 ,并提供已知点,将点会知道模型上的对应位置。100个点 大概1.48s。

qthello 556

ESP32 CAM使用教程(入门级)

串口被占用,可以关闭其他使用到串口的界面;先将手机也连上wifi,然后使用手机浏览器打开这个IP地址,注意手机连接的wifi需要和开发板的wifi一致,也就是程序里自己修改的那个wifi,否则无法打开IP地址;将开发板连接到电脑,点击点击工具→端口,然后选择自己实际接的COM口,不清楚COM口的可以打开电脑设备管理器查看一下,插拔设备看看哪个COM口会刷新就是哪个COM口;安装好esp32库之后,点击工具→开发板→esp32→AI Thinker ESP32-CAM,型号要仔细找找,不要选错了;

qq_34426854的博客 2万+

OCEAN 电路仿真

介绍利用 Cadence OCEAN 进行电路脚本仿真的方法

weixin_43249158的博客 4409

3D可视化字母出现频率_vtkLinearExtrusionFilter

统计输入文本中字母出现的频率,不区分大小写,使用3D可是化方式进行显示,频率高的字母z方向同比例进行拉伸;运行需要跟一个参数:文本文件路径。VTK_VECTOR_EXTRUSION 、VTK_NORMAL_EXTRUSION 设置效果。

Lee notes 720

[全解] 刷机, BL 锁, Bootloader, Recovery, Magisk, Root, ADB, 线刷, 卡刷, 9008, 绕过 FRP

刷机, BL 锁, Bootloader, Recovery, Magisk, Root, ADB, 线刷, 卡刷, 9008, 绕过 FRP 全解

诺尔的博客 3万+

vtkPolygon转vtkImageData

vtkPolygon转vtkImageData。

ID5418的杂货铺 241

Python+OpenCV实战:5分钟搞定机械臂手眼标定(眼在手上模式)

本文详细介绍了使用Python和OpenCV在5分钟内完成机械臂手眼标定(眼在手上模式)的实战教程。通过解析相机坐标系与机械臂基坐标系的转换关系,提供从数据采集到标定矩阵计算的全流程代码实现,帮助开发者快速解决AX=XB问题,提升机械臂视觉引导精度。

weixin_33670786的博客 507

使用verilog实现基于FPGA的TDC设计

verilog实现TDC 高精度时间数字转换器概述(TDC) 简介: TDC被用于测量时间间隔,应用在物理研究、飞行时间测量领域等。 本设计使用verilog实现并在xilinx和altera的FPGA上均可实现! 设计中使用到下述几个模块,包括FIFO,COUNT等,在xilinx下也使用到了一些原语等。下面有实现的代码和仿真截图等。 顶层模块设计如下: module top( input wire start, input wire stop, input wire clk, output wire T

QQ_778132974的博客 6258

OpenCASCADE建模内核:工业级三维几何计算原理与实战

三维几何建模是CAD/CAE/CAM系统的核心基础,其本质是用数学方法精确描述物理形状、保障拓扑一致性并实现跨平台数据交换。OpenCASCADE(OCC)作为开源工业级建模内核,通过B-Rep边界表示法、NURBS曲面建模和STEP格式互通等关键技术,支撑高精度布尔运算、参数化建模与制造级数据传递。相比通用图形库,OCC专注‘形状的数学定义与可靠计算’,而非渲染或交互——这使其成为汽车、航天、医疗等领域的关键基础设施。本文深入解析OCC的几何-拓扑双层架构、Handle内存机制及真实项目中STEP单位转换

weixin_34258838的博客 418

Muse Spark:功能、性能测试及使用方法

对于一个仅用九个月时间从零开始重建的团队来说,这样的健康状况和多模态测试结果无疑是迈出了坚实的第一步,并且经受住了独立测试的考验。Muse Spark 为每个产品确定了最重要的主题(A 产品的发布策略、B 产品的定价策略、C 产品的规模化策略),并提出了切实可行的具体行动方案。抽象视觉推理也遵循同样的模式:Muse Spark 的 ARC-AGI-2 得分为 42.5,而 GPT-5.4 和 Gemini 的得分都在 70 分左右。他的离职是由于组织结构的变化限制了他的角色,以及团队转向闭源开发。

xiaoshun007的专栏 132

点信息标注_BillboardTextActor3D

点附近创建左边或其他信息,

Lee notes 589

嵌入式软考必备知识点:嵌入式系统开发中的重要概念和示例代码

在嵌入式软考中,有一些重要的知识点需要掌握,包括嵌入式系统的基本概念、编程语言、实时操作系统和硬件接口等。实时操作系统是一种专门设计用于嵌入式系统的操作系统,可以提供对任务调度、中断处理和资源管理等方面的支持。GPIO(通用输入输出):GPIO是嵌入式系统中常用的硬件接口,用于连接外部设备和嵌入式系统。以上是嵌入式软考中的一些必备知识点,包括嵌入式系统的基本概念、编程语言、实时操作系统和硬件接口。通过配置串口的波特率、数据位数和校验位等参数,可以实现与其他设备的可靠通信。一、嵌入式系统的基本概念。

PixeGO的博客 319

在时间轴上联动多张内表:ABAP 的 PROVIDE ... ENDPROVIDE 区间联动迭代实战

PROVIDE 是 ABAP 中处理有效期区间数据的强大工具,它能自动将多张内表按时间维度切片并联合处理。其核心功能包括:指定区间边界字段(BOUNDS),定义外部总区间(BETWEEN),并通过工作区和标志位(VALID)标识每张表在当前子区间是否生效。该语法特别适合 HR 信息类型等有效期数据,能避免手动处理区间重叠、排序和空档等问题。使用时需注意字段投影(FIELDS)限制、工作区只读原则,以及异常处理(如区间重叠或未排序)。典型应用场景包括员工调岗记录、价格有效期管理等需要时间轴联动的业务逻辑。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1681

Simple Live 跨平台直播聚合上手指南:10 分钟从源码编译到调好弹幕

Simple Live 是一款免费开源的跨平台直播聚合工具,一套 Flutter 代码同时解析虎牙、斗鱼、哔哩哔哩、抖音的直播与弹幕,手机、电视、桌面都能跑。本文带你从克隆仓库到自己设备上跑起来、再调顺观看习惯,控制在 10 分钟内。 ## 先判断它是不是给你的 📺 这一节花 30 秒对号入座,判断它值不值得装。 - 多平台追直播的观众:通勤地铁上主播同时在虎牙和哔哩哔哩开播,你不用再装多

gitblog_00178的博客 388

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

QT5.14.2配置QVTKOpenGLNativeWidget控件并在QT中显示VTK窗口

操作系统:win 10 QT: 5.15.2 VTK : 9.1

weixin_39354845的博客 6446

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

pcl+vtk(九)QVTKOpenGLNativeWidget同时显示点云和模型

【代码】(九)QVTKOpenGLNativeWidget同时显示点云和模型。vtkUnsignedCharArray显示pcd文件中rgb颜色信息。加载obj和stl文件形式模型。

m0_67254672的博客 3212

Qt+PCL手把手教材(第8讲)——QVTKWidget/QVTKOpenGLNativeWidget 部件介绍和基础应用示例

(Visualization Toolkit)是一个用于 3D 图形、图像处理和科学可视化的开源软件库。它提供了大量的工具和算法来处理大规模数据集,并渲染 3D 可视化效果。

qq_36812406的博客 3145

vtk用户指南 第十章 建筑模型

我们已经看到了如何使用源对象(阅读器和过程对象)来创建几何图形。(参见第42页的“创建简单模型”。)VTK提供了其他几种技术来生成更复杂的模型。本章涵盖的三种技术是隐式建模、挤压和从无组织点进行表面重建。 如果你正在处理缺乏拓扑或几何结构的数据,VTK可以将这些信息表示为字段数据(使用类vtkDataObject,参见第249页的“使用字段数据”),可以使用本章中的技术进一步处理以生成可视化数据集。例如,通过选择三个变量作为独立变量,可以将n维财务记录简化为三维。然后,这里描述的技术——德劳内

qq_39966730的博客 709
上一篇: VTK 数据处理:属性操作
下一篇: 设计模式:命令模式(Command)
UestcXiye
博客等级 码龄8年 9047粉丝 1306原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

UestcXiye

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址