給定網格在有線表示中的最終Delaunay三角剖分,我想 喜歡顯示沒有對角線的曲面,我只是想象一個整齊的正方形。 有沒有任何選擇來完成這個,也許是一個過濾器?網格隱藏對角線的Delaunay三角剖分或
像
delaunay->BoundingTriangulationOff();
delaunay->SetBoundingTriangulation(0);
但可以適用於所有對角線...
其他的想法也許是所有triangules轉化爲正方形,你知道在C++ñ算法或C#,做這個?
我使用例如here
#include <vtkVersion.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkTriangle.h>
#include <vtkPolyData.h>
#include <vtkPointData.h>
#include <vtkLine.h>
#include <vtkCellLocator.h>
#include <vtkSmartPointer.h>
#include <vtkDelaunay2D.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkProperty.h>
#include <vtkVertexGlyphFilter.h>
int main(int, char *[])
{
// Create a set of heighs on a grid.
// This is often called a "terrain map".
vtkSmartPointer<vtkPoints> points =
vtkSmartPointer<vtkPoints>::New();
unsigned int GridSize = 10;
for(unsigned int x = 0; x < GridSize; x++)
{
for(unsigned int y = 0; y < GridSize; y++)
{
points->InsertNextPoint(x, y, (x+y)/(y+1));
}
}
// Add the grid points to a polydata object
vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(points);
// Triangulate the grid points
vtkSmartPointer<vtkDelaunay2D> delaunay =
vtkSmartPointer<vtkDelaunay2D>::New();
#if VTK_MAJOR_VERSION <= 5
delaunay->SetInput(polydata);
#else
delaunay->SetInputData(polydata);
#endif
delaunay->Update();
// Visualize
vtkSmartPointer<vtkPolyDataMapper> meshMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
meshMapper->SetInputConnection(delaunay->GetOutputPort());
vtkSmartPointer<vtkActor> meshActor =
vtkSmartPointer<vtkActor>::New();
meshActor->SetMapper(meshMapper);
vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter =
vtkSmartPointer<vtkVertexGlyphFilter>::New();
#if VTK_MAJOR_VERSION <= 5
glyphFilter->SetInputConnection(polydata->GetProducerPort());
#else
glyphFilter->SetInputData(polydata);
#endif
glyphFilter->Update();
vtkSmartPointer<vtkPolyDataMapper> pointMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
pointMapper->SetInputConnection(glyphFilter->GetOutputPort());
vtkSmartPointer<vtkActor> pointActor =
vtkSmartPointer<vtkActor>::New();
pointActor->GetProperty()->SetColor(1,0,0);
pointActor->GetProperty()->SetPointSize(3);
pointActor->SetMapper(pointMapper);
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(meshActor);
renderer->AddActor(pointActor);
renderer->SetBackground(.3, .6, .3); // Background color green
renderWindow->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
我在C#中找到了這個,並沒有找到任何東西。當我到了必須使用它的地步時,我希望我將不得不實施我自己的。與此同時,關於Delauney tesselations的維基百科文章有點密集(很難理解),但它是我能找到的最好的起點。 – philologon