• <noscript id="ecgc0"><kbd id="ecgc0"></kbd></noscript>
    <menu id="ecgc0"></menu>
  • <tt id="ecgc0"></tt>

    Matlab之創建和編輯Delaunay三角剖分

    創建和編輯Delaunay三角剖分。此示例演示如何使用delaunayTriangulation類創建、編輯和查詢Delaunay三角剖分。Delaunay三角網是科學計算中應用最廣泛的三角網。與三角剖分相關的特性為解決各種幾何問題提供了基礎。還示出了約束Delaunay三角剖分的構造,以及覆蓋中軸線計算和網格變形的應用。

    東西/原料

    • 電腦
    • Matlab軟件

    方式/步調

    1. 1

      示例一:建立并繪制2D Delaunay三角剖分

      本示例申明若何計較2D Delaunay三角剖分以及若何將三角剖分與極點和三角形標簽一路繪制。

      在號令行窗口,輸入號令:

      x = rand(10,1);

      y = rand(10,1);

      dt = delaunayTriangulation(x,y)

      按“Enter鍵”。

      如圖1所示。

    2. 2

      在號令行窗口,輸入號令:

      triplot(dt);

      %

      % Display the Vertex and Triangle labels on the plot

      hold on

      vxlabels = arrayfun(@(n) {sprintf('P%d', n)}, (1:10)');

      Hpl = text(x, y, vxlabels, 'FontWeight', 'bold', 'HorizontalAlignment',...

         'center', 'BackgroundColor', 'none');

      ic = incenter(dt);

      numtri = size(dt,1);

      trilabels = arrayfun(@(x) {sprintf('T%d', x)}, (1:numtri)');

      Htl = text(ic(:,1), ic(:,2), trilabels, 'FontWeight', 'bold', ...

         'HorizontalAlignment', 'center', 'Color', 'blue');

      hold off

      按“Enter鍵”。

      如圖2所示。

    3. 3

      示例二:建立并繪制3D Delaunay三角剖分

      本示例標的目的您展示若何計較3D Delaunay三角剖分以及若何繪制三角剖分。

      在號令行窗口,輸入號令:

      X = rand(10,3)

      按“Enter鍵”。

      如圖3所示。

    4. 4

      在號令行窗口,輸入號令:

      dt = delaunayTriangulation(X)

      按“Enter鍵”。

      如圖4所示。

    5. 5

      在號令行窗口,輸入號令:

      tetramesh(dt, 'FaceColor', 'cyan');

      % To display large tetrahedral meshes use the convexHull method to

      % compute the boundary triangulation and plot it using trisurf.

      % For example;

      % triboundary = convexHull(dt)

      % trisurf(triboundary, X(:,1), X(:,2), X(:,3), 'FaceColor', 'cyan')

      按“Enter鍵”。

      如圖5所示。

    6. 6

      示例三:拜候三角剖分數據布局

      有兩種方式可以拜候三角測量數據布局。 一種方式是經由過程Triangulation屬性,另一種方式是利用索引。

      從10個隨機點建立2D Delaunay三角剖分。

      在號令行窗口,輸入號令:

      X = rand(10,2)

      按“Enter鍵”。

      如圖6所示。

    7. 7

      在號令行窗口,輸入號令:

      dt = delaunayTriangulation(X)

      按“Enter鍵”。

      如圖7所示。

    8. 8

      在號令行窗口,輸入號令:

      % The triangulation datastructure is;

      dt.ConnectivityList

      按“Enter鍵”。

      如圖8所示。

    9. 9

      在號令行窗口,輸入號令:

      % Indexing is a shorthand way to query the triangulation. The format is

      % dt(i, j) where j is the j'th vertex of the i'th triangle, standard

      % indexing rules apply.

      % The triangulation datastructure is

      dt(:,:)

      按“Enter鍵”。

      如圖9所示。

    10. 10

      第二個三角形是;

      在號令行窗口,輸入號令:

      dt(2,:)

      按“Enter鍵”。

      如圖10所示。

    11. 11

      第二個三角形的第三個極點是;

      在號令行窗口,輸入號令:

      dt(2,3)

      按“Enter鍵”。

      如圖11所示。

    12. 12

      前三個三角形;

      在號令行窗口,輸入號令:

      dt(1:3,:)

      按“Enter鍵”。

      如圖12所示。

    原作者:Matlab教程舉報
    • 發表于 2020-02-11 20:00
    • 閱讀 ( 947 )
    • 分類:其他類型

    你可能感興趣的文章

    相關問題

    0 條評論

    請先 登錄 后評論
    聯系我們:uytrv@hotmail.com 問答工具
  • <noscript id="ecgc0"><kbd id="ecgc0"></kbd></noscript>
    <menu id="ecgc0"></menu>
  • <tt id="ecgc0"></tt>
    久久久久精品国产麻豆