題目描述
明訂單次Catmull-Clark subdivision,輸connected orientable polygon mesh(V3..12,F1..8,每face3..5頂點,不重複,consistent orientation),每edge屬1或2face,每boundary vertex恰2條boundary edges;interior vertex valence>=3,manifold無孤立點。原座標3D整數-5..5。face point為原頂點平均;interior edge point為兩端點及兩adjacent face points平均,boundary edge point為端點midpoint。更新old vertex:boundary用(6P+boundaryNeighbor1+boundaryNeighbor2)/8;interior令n=incident edge數,Favg=adjacent face points平均,Ravg=incident原edge midpoints平均,P'=(Favg+2Ravg+(n-3)P)/n。同步計算不可用已更新old points。新vertex IDs依updated old IDs、lex sorted undirected edges的edgepoints、原face順序facepoints;每原face按每corner生成quad [oldVertex, edgeToNext, facePoint, edgeFromPrev]。輸全部精確有理座標與quads。
輸入格式與限制
第一行V F;接V行x y z;接F行k及k個vertex IDs。ID1起,各face頂點依一致方向給;保證題定manifold incidence條件,每edge兩face時方向相反。V3..12,F1..8,k3..5,座標整數−5..5。幾何可非平面或自交,本題僅按拓樸及公式,不額外修復。
輸出格式
VERTICES N;接N行ID x y z,座標最簡n/d;再QUADS Q,接Q行各四個vertexIDs,不加開頭4。四邊形按原face順序、face內corner順序輸出。edge排序用(minID,maxID)。
範例說明
第一例單一2×2正方形,四舊角沿boundary stencil移為(1/4,1/4)、(7/4,1/4)、(7/4,7/4)、(1/4,7/4),edgepoints為各邊midpoint,facepoint(1,1)。第二例封閉四面體無boundary,四舊點都用valence3的interior公式。
範例測資
範例輸入 1
4 1 0 0 0 2 0 0 2 2 0 0 2 0 4 1 2 3 4
範例輸出 1
VERTICES 9 1 1/4 1/4 0/1 2 7/4 1/4 0/1 3 7/4 7/4 0/1 4 1/4 7/4 0/1 5 1/1 0/1 0/1 6 0/1 1/1 0/1 7 2/1 1/1 0/1 8 1/1 2/1 0/1 9 1/1 1/1 0/1 QUADS 4 1 5 9 6 2 7 9 5 3 8 9 7 4 6 9 8
範例輸入 2
4 4 0 0 0 1 0 0 0 1 0 0 0 1 3 1 3 2 3 1 2 4 3 2 3 4 3 3 1 4
範例輸出 2
VERTICES 14 1 5/27 5/27 5/27 2 4/9 5/27 5/27 3 5/27 4/9 5/27 4 5/27 5/27 4/9 5 5/12 1/12 1/12 6 1/12 5/12 1/12 7 1/12 1/12 5/12 8 5/12 5/12 1/12 9 5/12 1/12 5/12 10 1/12 5/12 5/12 11 1/3 1/3 0/1 12 1/3 0/1 1/3 13 1/3 1/3 1/3 14 0/1 1/3 1/3 QUADS 12 1 6 11 5 3 8 11 6 2 5 11 8 1 5 12 7 2 9 12 5 4 7 12 9 2 8 13 9 3 10 13 8 4 9 13 10 3 6 14 10 1 7 14 6 4 10 14 7
討論與題解
載入討論區…