2017-02-02 35 views
0

我試圖使用Triangle library鑲嵌帶孔的多邊形。鑲嵌三角形將由OpenGL渲染。 我的多邊形有一個外部環和多個內部環。我所擁有的是所有環的x,y座標。爲了與三角LIB棋盤格狀,我要通過孔列表和空穴三角的數目lib添加到其triangulateio結構構件:holelistnumberofholes指定三角形庫中的孔

struct triangulateio { 
    REAL *pointlist;            /* In/out */ 
    REAL *pointattributelist;          /* In/out */ 
    int *pointmarkerlist;           /* In/out */ 
    int numberofpoints;           /* In/out */ 
    int numberofpointattributes;         /* In/out */ 

    int *trianglelist;            /* In/out */ 
    REAL *triangleattributelist;         /* In/out */ 
    REAL *trianglearealist;           /* In only */ 
    int *neighborlist;            /* Out only */ 
    int numberoftriangles;           /* In/out */ 
    int numberofcorners;           /* In/out */ 
    int numberoftriangleattributes;        /* In/out */ 

    int *segmentlist;            /* In/out */ 
    int *segmentmarkerlist;          /* In/out */ 
    int numberofsegments;           /* In/out */ 

    REAL *holelist;      /* In/pointer to array copied out */ 
    int numberofholes;          /* In/copied out */ 

    REAL *regionlist;      /* In/pointer to array copied out */ 
    int numberofregions;         /* In/copied out */ 

    int *edgelist;             /* Out only */ 
    int *edgemarkerlist;   /* Not used with Voronoi diagram; out only */ 
    REAL *normlist;    /* Used only with Voronoi diagram; out only */ 
    int numberofedges;            /* Out only */ 
}; 

這些孔由內孔的一個點的座標表示。我的問題是:我可以在沒有指定孔的情況下進行曲面細分(只使用內部環)?或者如果我必須列出這些洞,我如何能夠快速找到洞內的一個點?這個過程對時間至關重要。

回答

0

如果不指定孔,則不能進行曲面細分。 找到一個孔內的一個點的一種可能的方法是將其作爲一個簡單的環(它沒有孔)進行三角測量,輸出三角形之一的質量中心。我希望它有幫助。