Triangular Mesh w/ Known Vertices

4 ビュー (過去 30 日間)
Andy
Andy 2011 年 11 月 10 日
I'm working on an image warping project. I need to take a list of vertices, then a list of which vertices belong to which triangle and create a triangular with them. I've been trying to code it but am unable to do it. I've tried using trimesh with node arrays but I can't get it to work. Can anybody point me in the right direction?

回答 (1 件)

Patrick Kalita
Patrick Kalita 2011 年 11 月 11 日
If I understand you correctly, you have a list of vertices and an array that specifies how to connect them into triangles. If you want to visualize this, you can supply this information to the patch command. That information can be used to set the patch object's Vertices and Faces properties.
Here's a simple example -- four vertices are being used to construct 2 triangles:
% vertex locations -- each row is an (x,y) pair. It can also
% be an (x,y,z) triple, but I'll do 2D here for simplicity.
vertices = [ 1 1; 2 2; 1 3; 2 4 ]
% This describes how the vertices connected.
tris = [ 1 2 3; 2 4 3 ]
% Make a patch
patch( 'Vertices', vertices, 'Faces', tris, 'FaceColor', 'r' );

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by