27 template<
typename INT_TYPE,
typename FUNCTOR>
33 if (nedgerows < 0 || nedgecols < 0)
37 INT_TYPE prev_pt = INT_TYPE(-1);
41 for (
exint col = 0; col < nedgecols; ++col)
44 if (col == 0 || point != prev_pt)
46 functor(point,
row, col);
51 if (nedgecols == 0 || (!grid.
doesRowWrap(
row) && point != prev_pt))
53 functor(point,
row, nedgecols);
57 for (
exint col = 0; col < nedgecols; ++col)
59 INT_TYPE point = grid.
getPoint(nedgerows, col);
60 if (nedgerows == 0 || (!grid.
doesColWrap(col) && (col == 0 || point != prev_pt)))
62 functor(point, nedgerows, col);
66 INT_TYPE point = grid.
getPoint(nedgerows, nedgecols);
67 if ((nedgecols == 0 || !grid.
doesRowWrap(nedgerows)) && (nedgerows == 0 || !grid.
doesColWrap(nedgecols)) && point != prev_pt)
69 functor(point, nedgerows, nedgecols);
76 template<
typename INT_TYPE,
typename FUNCTOR>
88 if (nedgerows < 0 || nedgecols < 0)
115 nvertices = nedgecols +
exint(!closed);
117 functor(primnum, 0, 0, nvertices, closed);
129 npoints = nedgecols +
exint(!closed_curve);
131 for (
exint col = 0; col < npoints; ++col)
133 functor(primnum, 0, col, 1,
false);
146 exint npoints = nedgerows +
exint(!closed_curve);
148 for (exint
row = 0;
row < npoints; ++
row)
150 functor(primnum,
row, 0, 1,
false);
161 functor(primnum, 0, 0, nvertices, closed);
177 for (exint
row = first_row;
row < nedgerows; ++
row, ++primnum)
179 if (different_nvertices)
182 nvertices = nedgecols +
exint(!closed);
184 functor(primnum,
row, 0, nvertices, closed);
191 if (different_nvertices)
194 nvertices = nedgecols +
exint(!closed);
196 functor(primnum, nedgerows, 0, nvertices, closed);
205 for (exint col = 0; col < nedgecols; ++col, col_wraps = next_col_wraps)
208 bool currently_in_a_curve = (primvtx != 0);
209 if (!currently_in_a_curve)
211 if (col_wraps && next_col_wraps)
230 else if (col_wraps && next_col_wraps)
235 functor(primnum, nedgerows, primstartcol, col+1-primstartcol,
false);
264 functor(primnum, nedgerows, primstartcol, nedgecols+1-primstartcol,
false);
282 for (exint col = first_col; col < nedgecols; ++col, ++primnum)
284 if (different_nvertices)
287 nvertices = nedgerows +
exint(!closed);
289 functor(primnum, 0, col, nvertices, closed);
296 if (different_nvertices)
299 nvertices = nedgerows +
exint(!closed);
301 functor(primnum, 0, nedgecols, nvertices, closed);
310 for (exint
row = 0;
row < nedgerows; ++
row, row_wraps = next_row_wraps)
313 bool currently_in_a_curve = (primvtx != 0);
314 if (!currently_in_a_curve)
316 if (row_wraps && next_row_wraps)
335 else if (row_wraps && next_row_wraps)
340 functor(primnum, primstartrow, nedgecols,
row+1-primstartrow,
false);
369 functor(primnum, primstartrow, nedgecols, nedgerows+1-primstartrow,
false);
378 UT_ASSERT_MSG(nedgerows >= 1 && nedgecols >= 1,
"Caller should have switched quads to rows or cols");
387 for (
exint col = 0; col < nedgecols; ++col, ++primnum)
389 functor(primnum,
row, col, 4,
true);
398 for (
exint col = 0; col < nedgecols; ++col, primnum+=2)
400 functor(primnum,
row, col, 3,
true);
401 functor(primnum+1,
row, col, 3,
true);
415 auto &&boundary_quad = [&grid,surface_type,&functor](
exint row,
exint col,
exint &primnum)
420 points[0] = grid.
getPoint(row, col );
421 points[1] = grid.
getPoint(row, col+1);
422 points[2] = grid.
getPoint(row+1, col );
423 points[3] = grid.
getPoint(row+1, col+1);
426 if (points[0] == points[2] || points[1] == points[3])
429 const bool row0_equal = (points[0] == points[1]);
430 const bool row1_equal = (points[2] == points[3]);
431 const bool col0_equal = (points[0] == points[2]);
432 const bool col1_equal = (points[1] == points[3]);
434 if ((row0_equal && row1_equal) || (col0_equal && col1_equal))
437 if (!row0_equal && !row1_equal && !col0_equal && !col1_equal)
442 functor(primnum, row, col, 4,
true);
447 functor(primnum, row, col, 3,
true);
448 functor(primnum+1, row, col, 3,
true);
455 functor(primnum, row, col, 3,
true);
460 for (
exint col = 0; col < nedgecols; ++col)
462 boundary_quad(row, col, primnum);
464 for (row = 1; row < nedgerows-1; ++
row)
467 boundary_quad(row, col, primnum);
472 for (col = 1; col < nedgecols-1; ++col, ++primnum)
474 functor(primnum, row, col, 4,
true);
479 for (col = 1; col < nedgecols-1; ++col, primnum+=2)
481 functor(primnum, row, col, 3,
true);
482 functor(primnum+1, row, col, 3,
true);
486 boundary_quad(row, col, primnum);
488 for (
exint col = 0; col < nedgecols; ++col)
490 boundary_quad(row, col, primnum);
496 template<
typename INT_TYPE,
typename FUNCTOR>
508 if (nedgerows < 0 || nedgecols < 0)
529 for (
exint col = 0; col < nedgecols; ++col)
531 functor(vtxnum,
row, col,
false,
false, primnum, vtxnum);
537 functor(vtxnum,
row, nedgecols-1,
false,
true, primnum, vtxnum);
544 for (
exint col = 0; col < nedgecols; ++col)
546 functor(vtxnum, nedgerows-1, col,
true,
false, primnum, vtxnum);
552 functor(vtxnum, nedgerows-1, nedgecols-1,
true,
true, primnum, vtxnum);
568 functor(vtxnum, 0, 0,
false,
false, primnum, 0);
575 for (
exint col = 0; col < nedgecols; ++col, ++vtxnum)
576 functor(vtxnum, 0, col,
false,
false, primnum, col);
581 functor(vtxnum, 0, nedgecols-1,
false,
true, primnum, nedgecols);
594 functor(vtxnum, 0, 0,
false,
false, primnum, 0);
601 for (
exint col = 0; col < nedgecols; ++col, ++vtxnum, ++primnum)
602 functor(vtxnum, 0, col,
false,
false, primnum, 0);
607 functor(vtxnum, 0, nedgecols-1,
false,
true, primnum, 0);
623 functor(vtxnum,
row, 0,
false,
false, primnum, 0);
628 functor(vtxnum, nedgerows-1, 0,
true,
false, primnum, 0);
639 functor(vtxnum,
row, 0,
false,
false, primnum,
row);
644 functor(vtxnum, nedgerows-1, 0,
true,
false, primnum, nedgerows);
659 for (
exint col = 0; col < nedgecols; ++col, ++vtxnum)
660 functor(vtxnum,
row, col,
false,
false, primnum, col);
665 functor(vtxnum,
row, nedgecols-1,
false,
true, primnum, nedgecols);
675 for (
exint col = 0; col < nedgecols; ++col, col_wraps = next_col_wraps)
678 bool currently_in_a_curve = (primvtx != 0);
679 if (!currently_in_a_curve)
681 if (col_wraps && next_col_wraps)
697 functor(vtxnum, nedgerows-1, col,
true,
false, primnum, 0);
701 else if (col_wraps && next_col_wraps)
705 functor(vtxnum, nedgerows-1, col,
true,
false, primnum, primvtx);
720 functor(vtxnum, nedgerows-1, col,
true,
false, primnum, primvtx);
735 functor(vtxnum, nedgerows-1, nedgecols-1,
true,
true, primnum, primvtx);
749 for (
exint col = first_col; col < nedgecols; ++col, ++primnum)
752 functor(vtxnum,
row, col,
false,
false, primnum,
row);
757 functor(vtxnum, nedgerows-1, col,
true,
false, primnum, nedgerows);
767 for (
exint row = 0;
row < nedgerows; ++
row, row_wraps = next_row_wraps)
770 bool currently_in_a_curve = (primvtx != 0);
771 if (!currently_in_a_curve)
773 if (row_wraps && next_row_wraps)
789 functor(vtxnum,
row, nedgecols-1,
false,
true, primnum, 0);
793 else if (row_wraps && next_row_wraps)
797 functor(vtxnum,
row, nedgecols-1,
false,
true, primnum, primvtx);
812 functor(vtxnum,
row, nedgecols-1,
false,
true, primnum, primvtx);
827 functor(vtxnum, nedgerows-1, nedgecols-1,
true,
true, primnum, primvtx);
839 UT_ASSERT_MSG(nedgerows >= 1 && nedgecols >= 1,
"Caller should have switched quads to rows or cols");
847 for (
exint col = 0; col < nedgecols; ++col, ++primnum, vtxnum+=4)
849 functor(vtxnum ,
row, col,
false,
false, primnum, 0);
850 functor(vtxnum+1,
row, col,
false,
true, primnum, 1);
851 functor(vtxnum+2,
row, col,
true,
true, primnum, 2);
852 functor(vtxnum+3,
row, col,
true,
false, primnum, 3);
861 for (
exint col = 0; col < nedgecols; ++col, primnum+=2, vtxnum+=6)
864 const bool switched = (rev || (alt && ((
row^col)&1)));
866 functor(vtxnum ,
row, col,
false,
false, primnum , 0);
867 functor(vtxnum+1,
row, col,
false,
true, primnum , 1);
868 functor(vtxnum+2,
row, col,
true, !switched, primnum , 2);
870 functor(vtxnum+3,
row, col,
false, switched, primnum+1, 0);
871 functor(vtxnum+4,
row, col,
true,
true, primnum+1, 1);
872 functor(vtxnum+5,
row, col,
true,
false, primnum+1, 2);
886 auto &&boundary_quad = [&grid,surface_type,&functor,rev,alt](
exint &vtxnum,
exint row,
exint col,
exint &primnum)
891 points[0] = grid.
getPoint(row, col );
892 points[1] = grid.
getPoint(row, col+1);
893 points[2] = grid.
getPoint(row+1, col );
894 points[3] = grid.
getPoint(row+1, col+1);
897 if (points[0] == points[2] || points[1] == points[3])
900 const bool row0_equal = (points[0] == points[1]);
901 const bool row1_equal = (points[2] == points[3]);
902 const bool col0_equal = (points[0] == points[2]);
903 const bool col1_equal = (points[1] == points[3]);
905 if ((row0_equal && row1_equal) || (col0_equal && col1_equal))
908 if (!row0_equal && !row1_equal && !col0_equal && !col1_equal)
913 functor(vtxnum , row, col,
false,
false, primnum, 0);
914 functor(vtxnum+1, row, col,
false,
true, primnum, 1);
915 functor(vtxnum+2, row, col,
true,
true, primnum, 2);
916 functor(vtxnum+3, row, col,
true,
false, primnum, 3);
923 const bool switched = (rev || (alt && ((row^col)&1)));
925 functor(vtxnum , row, col,
false,
false, primnum , 0);
926 functor(vtxnum+1, row, col,
false,
true, primnum , 1);
927 functor(vtxnum+2, row, col,
true, !switched, primnum , 2);
929 functor(vtxnum+3, row, col,
false, switched, primnum+1, 0);
930 functor(vtxnum+4, row, col,
true,
true, primnum+1, 1);
931 functor(vtxnum+5, row, col,
true,
false, primnum+1, 2);
939 functor(vtxnum, row, col,
false,
false, primnum, vtxnum);
943 functor(vtxnum, row, col,
false,
true, primnum, vtxnum);
946 if (!row1_equal && !col1_equal)
948 functor(vtxnum, row, col,
true,
true, primnum, vtxnum);
953 functor(vtxnum, row, col,
true,
false, primnum, vtxnum);
960 for (
exint col = 0; col < nedgecols; ++col)
962 boundary_quad(vtxnum, row, col, primnum);
964 for (row = 1; row < nedgerows-1; ++
row)
967 boundary_quad(vtxnum, row, col, primnum);
972 for (col = 1; col < nedgecols-1; ++col, ++primnum, vtxnum+=4)
974 functor(vtxnum , row, col,
false,
false, primnum, 0);
975 functor(vtxnum+1, row, col,
false,
true, primnum, 1);
976 functor(vtxnum+2, row, col,
true,
true, primnum, 2);
977 functor(vtxnum+3, row, col,
true,
false, primnum, 3);
982 for (col = 1; col < nedgecols-1; ++col, primnum+=2, vtxnum+=6)
985 const bool switched = (rev || (alt && ((row^col)&1)));
987 functor(vtxnum , row, col,
false,
false, primnum , 0);
988 functor(vtxnum+1, row, col,
false,
true, primnum , 1);
989 functor(vtxnum+2, row, col,
true, !switched, primnum , 2);
991 functor(vtxnum+3, row, col,
false, switched, primnum+1, 0);
992 functor(vtxnum+4, row, col,
true,
true, primnum+1, 1);
993 functor(vtxnum+5, row, col,
true,
false, primnum+1, 2);
997 boundary_quad(vtxnum, row, col, primnum);
999 for (
exint col = 0; col < nedgecols; ++col)
1001 boundary_quad(vtxnum, row, col, primnum);
1005 template<
typename INT_TYPE>
1008 const exint nedgerows = myNumEdgeRows;
1009 const exint nedgecols = myNumEdgeCols;
1010 if (nedgerows < 0 || nedgecols < 0 || (nedgerows == 0 && nedgecols == 0))
1020 const bool wrapu = (myCorners[0] == myCorners[1]);
1029 const bool wrapv = (myCorners[0] == myCorners[2]);
1037 bool wrapu0 = (myCorners[0] == myCorners[1]);
1038 bool wrapu1 = (myCorners[2] == myCorners[3]);
1039 bool has_wrapu = wrapu0 || wrapu1;
1040 bool has_notwrapu = !wrapu0 || !wrapu1;
1042 bool wrapv0 = (myCorners[0] == myCorners[2]);
1043 bool wrapv1 = (myCorners[1] == myCorners[3]);
1044 bool has_wrapv = wrapv0 || wrapv1;
1045 bool has_notwrapv = !wrapv0 || !wrapv1;
1047 if ((myCol0Start < INT_TYPE(0)) || (myCol1Start < INT_TYPE(0)) || (myCol0Step != myCol1Step))
1050 for (
exint rowm1 = 0; rowm1 < nedgerows-1; ++rowm1)
1052 INT_TYPE pt0 = (myCol0Start < INT_TYPE(0)) ? myCol0Array[rowm1] : (myCol0Start + myCol0Step*rowm1);
1053 INT_TYPE pt1 = (myCol1Start < INT_TYPE(0)) ? myCol1Array[rowm1] : (myCol1Start + myCol1Step*rowm1);
1054 bool wrapu = (pt0 == pt1);
1056 has_notwrapu |= !wrapu;
1062 bool wrapu = (myCol0Start == myCol1Start);
1064 has_notwrapu |= !wrapu;
1067 if ((myRow0Start < INT_TYPE(0)) || (myRow1Start < INT_TYPE(0)) || (myRow0Step != myRow1Step))
1070 for (
exint colm1 = 0; colm1 < nedgecols-1; ++colm1)
1072 INT_TYPE pt0 = (myRow0Start < INT_TYPE(0)) ? myRow0Array[colm1] : (myRow0Start + myRow0Step*colm1);
1073 INT_TYPE pt1 = (myRow1Start < INT_TYPE(0)) ? myRow1Array[colm1] : (myRow1Start + myRow1Step*colm1);
1074 bool wrapv = (pt0 == pt1);
1076 has_notwrapv |= !wrapv;
1082 bool wrapv = (myRow0Start == myRow1Start);
1084 has_notwrapv |= !wrapv;
1087 myAllWrapU = !has_notwrapu;
1088 myAllWrapV = !has_notwrapv;
1089 myNoWrapU = !has_wrapu;
1090 myNoWrapV = !has_wrapv;
1093 template<
typename INT_TYPE>
1095 exint nedgerows,
exint nedgecols, INT_TYPE start_pt)
1099 myNumEdgeRows = nedgerows;
1100 myNumEdgeCols = nedgecols;
1109 myCorners[0] = start_pt;
1110 myCorners[1] = start_pt + nedgecols;
1111 myCorners[2] = start_pt + nedgerows*(nedgecols+1);
1112 myCorners[3] = start_pt + nedgerows*(nedgecols+1) + nedgecols;
1114 myRow0Step = INT_TYPE(1);
1115 myRow0Start = myCorners[0]+myRow0Step;
1116 myRow1Step = INT_TYPE(1);
1117 myRow1Start = myCorners[2]+myRow1Step;
1119 myCol0Step = INT_TYPE(nedgecols+1);
1120 myCol0Start = myCorners[0]+myCol0Step;
1121 myCol1Step = INT_TYPE(nedgecols+1);
1122 myCol1Start = myCorners[1]+myCol1Step;
1124 myMiddleStart = myCol0Start+1;
1125 myMiddleColStep = myRow0Step;
1126 myMiddleRowStep = myCol0Step;
1130 myNumPrimitives = 0;
1138 myNumPrimitives = 1;
1145 const bool has_endrow = myNoWrapV || myUnrollCurves;
1146 const bool has_endcol = myNoWrapU || myUnrollCurves;
1147 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1148 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1149 myNumVertices = nvtxrows*nvtxcols;
1155 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1156 myNumVertices = 4*myNumPrimitives;
1161 myNumPrimitives = 0;
1165 myNumPrimitives = myNumEdgeRows-1 +
exint(myFirstRowIfNotWrapped) +
exint(myLastRowIfNotWrapped);
1166 myNumVertices = myNumPrimitives*(myNumEdgeCols+1);
1172 exint col_polys = myNumEdgeCols-1 +
exint(myFirstColIfNotWrapped) +
exint(myLastColIfNotWrapped);
1173 myNumPrimitives += col_polys;
1174 myNumVertices += col_polys*(myNumEdgeRows+1);
1179 myNumPrimitives = 2*myNumEdgeRows*myNumEdgeCols;
1180 myNumVertices = 3*myNumPrimitives;
1183 template<
typename INT_TYPE>
1185 exint nedgerows,
exint nedgecols, INT_TYPE start_pt)
1189 myNumEdgeRows = nedgerows;
1190 myNumEdgeCols = nedgecols;
1199 myCorners[0] = start_pt;
1200 myCorners[1] = myCorners[0];
1201 myCorners[2] = start_pt + nedgerows*nedgecols;
1202 myCorners[3] = myCorners[2];
1204 myRow0Step = INT_TYPE(1);
1205 myRow0Start = myCorners[0]+myRow0Step;
1206 myRow1Step = INT_TYPE(1);
1207 myRow1Start = myCorners[2]+myRow1Step;
1209 myCol0Step = INT_TYPE(nedgecols);
1210 myCol0Start = myCorners[0]+myCol0Step;
1211 myCol1Step = INT_TYPE(nedgecols);
1212 myCol1Start = myCorners[1]+myCol1Step;
1214 myMiddleStart = myCol0Start+1;
1215 myMiddleColStep = myRow0Step;
1216 myMiddleRowStep = myCol0Step;
1220 myNumPrimitives = 0;
1228 myNumPrimitives = 1;
1235 const bool has_endrow = myNoWrapV || myUnrollCurves;
1236 const bool has_endcol = myNoWrapU || myUnrollCurves;
1237 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1238 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1239 myNumVertices = nvtxrows*nvtxcols;
1245 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1246 myNumVertices = 4*myNumPrimitives;
1251 myNumPrimitives = 0;
1255 myNumPrimitives = myNumEdgeRows-1 +
exint(myFirstRowIfNotWrapped) +
exint(myLastRowIfNotWrapped);
1256 myNumVertices = myNumPrimitives*(myNumEdgeCols+myUnrollCurves);
1262 myNumPrimitives += myNumEdgeCols;
1263 myNumVertices += myNumEdgeCols*(myNumEdgeRows+1);
1268 myNumPrimitives = 2*myNumEdgeRows*myNumEdgeCols;
1269 myNumVertices = 3*myNumPrimitives;
1272 template<
typename INT_TYPE>
1274 exint nedgerows,
exint nedgecols, INT_TYPE start_pt)
1278 myNumEdgeRows = nedgerows;
1279 myNumEdgeCols = nedgecols;
1288 myCorners[0] = start_pt;
1289 myCorners[1] = start_pt + nedgecols;
1290 myCorners[2] = myCorners[0];
1291 myCorners[3] = myCorners[1];
1293 myRow0Step = INT_TYPE(1);
1294 myRow0Start = myCorners[0]+myRow0Step;
1295 myRow1Step = INT_TYPE(1);
1296 myRow1Start = myCorners[2]+myRow1Step;
1298 myCol0Step = INT_TYPE(nedgecols+1);
1299 myCol0Start = myCorners[0]+myCol0Step;
1300 myCol1Step = INT_TYPE(nedgecols+1);
1301 myCol1Start = myCorners[1]+myCol1Step;
1303 myMiddleStart = myCol0Start+1;
1304 myMiddleColStep = myRow0Step;
1305 myMiddleRowStep = myCol0Step;
1309 myNumPrimitives = 0;
1317 myNumPrimitives = 1;
1324 const bool has_endrow = myNoWrapV || myUnrollCurves;
1325 const bool has_endcol = myNoWrapU || myUnrollCurves;
1326 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1327 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1328 myNumVertices = nvtxrows*nvtxcols;
1334 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1335 myNumVertices = 4*myNumPrimitives;
1340 myNumPrimitives = 0;
1344 myNumPrimitives = myNumEdgeRows;
1345 myNumVertices = myNumPrimitives*(myNumEdgeCols+1);
1351 exint col_polys = myNumEdgeCols-1 +
exint(myFirstColIfNotWrapped) +
exint(myLastColIfNotWrapped);
1352 myNumPrimitives += col_polys;
1353 myNumVertices += col_polys*(myNumEdgeRows+myUnrollCurves);
1358 myNumPrimitives = 2*myNumEdgeRows*myNumEdgeCols;
1359 myNumVertices = 3*myNumPrimitives;
1362 template<
typename INT_TYPE>
1365 INT_TYPE start_pt, INT_TYPE end_pt, INT_TYPE start_mid_pt)
1369 myNumEdgeRows = nedgerows;
1370 myNumEdgeCols = nedgecols;
1379 myCorners[0] = start_pt;
1380 myCorners[1] = myCorners[0];
1381 myCorners[2] = end_pt;
1382 myCorners[3] = myCorners[2];
1384 myRow0Step = INT_TYPE(0);
1385 myRow0Start = start_pt;
1386 myRow1Step = INT_TYPE(0);
1387 myRow1Start = end_pt;
1389 myCol0Step = INT_TYPE(nedgecols);
1390 myCol0Start = start_mid_pt;
1391 myCol1Step = INT_TYPE(nedgecols);
1392 myCol1Start = start_mid_pt;
1394 myMiddleStart = myCol0Start+1;
1395 myMiddleColStep = INT_TYPE(1);
1396 myMiddleRowStep = INT_TYPE(nedgecols);
1400 myNumPrimitives = 0;
1408 myNumPrimitives = 1;
1415 const bool has_endrow = myNoWrapV || myUnrollCurves;
1416 const bool has_endcol = myNoWrapU || myUnrollCurves;
1417 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1418 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1419 myNumVertices = nvtxrows*nvtxcols;
1425 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1426 myNumVertices = 4*myNumPrimitives - (myTriangularPoles ? 2*myNumEdgeCols : 0);
1431 myNumPrimitives = 0;
1435 const exint rowprims = myNumEdgeRows-1 +
exint(myFirstRowIfNotWrapped) +
exint(myLastRowIfNotWrapped);
1436 myNumPrimitives = rowprims;
1437 myNumVertices = rowprims*(myNumEdgeCols+myUnrollCurves);
1443 myNumPrimitives += myNumEdgeCols;
1444 myNumVertices += myNumEdgeCols*(myNumEdgeRows+1);
1449 myNumPrimitives = (myNumEdgeRows -
exint(myTriangularPoles))*2*myNumEdgeCols;
1450 myNumVertices = 3*myNumPrimitives;
1453 template<
typename INT_TYPE>
1456 INT_TYPE start_pt, INT_TYPE end_pt, INT_TYPE start_mid_pt)
1460 myNumEdgeRows = nedgerows;
1461 myNumEdgeCols = nedgecols;
1470 myCorners[0] = start_pt;
1471 myCorners[1] = end_pt;
1472 myCorners[2] = start_pt;
1473 myCorners[3] = end_pt;
1475 myRow0Step = INT_TYPE(1);
1476 myRow0Start = start_mid_pt;
1477 myRow1Step = INT_TYPE(1);
1478 myRow1Start = start_mid_pt;
1480 myCol0Step = INT_TYPE(0);
1481 myCol0Start = start_pt;
1482 myCol1Step = INT_TYPE(0);
1483 myCol1Start = end_pt;
1485 myMiddleStart = myRow0Start+nedgecols-1;
1486 myMiddleColStep = INT_TYPE(1);
1487 myMiddleRowStep = INT_TYPE(nedgecols-1);
1491 myNumPrimitives = 0;
1499 myNumPrimitives = 1;
1506 const bool has_endrow = myNoWrapV || myUnrollCurves;
1507 const bool has_endcol = myNoWrapU || myUnrollCurves;
1508 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1509 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1510 myNumVertices = nvtxrows*nvtxcols;
1516 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1517 myNumVertices = 4*myNumPrimitives - (myTriangularPoles ? 2*myNumEdgeRows : 0);
1522 myNumPrimitives = 0;
1526 myNumPrimitives = myNumEdgeRows;
1527 myNumVertices = myNumEdgeRows*(myNumEdgeCols+1);
1533 const exint colprims = myNumEdgeCols-1 +
exint(myFirstColIfNotWrapped) +
exint(myLastColIfNotWrapped);
1534 myNumPrimitives += colprims;
1535 myNumVertices += colprims*(myNumEdgeRows+myUnrollCurves);
1540 myNumPrimitives = myNumEdgeRows*2*(myNumEdgeCols -
exint(myTriangularPoles));
1541 myNumVertices = 3*myNumPrimitives;
1544 template<
typename INT_TYPE>
1547 INT_TYPE start_pt, INT_TYPE end_pt, INT_TYPE start_mid_pt)
1551 myNumEdgeRows = nedgerows;
1552 myNumEdgeCols = nedgecols;
1563 myCorners[0] = start_pt;
1564 myCorners[1] = end_pt;
1565 myCorners[2] = start_pt;
1566 myCorners[3] = end_pt;
1572 myRow0Step = INT_TYPE(1);
1573 myRow0Start = start_mid_pt;
1574 myRow1Step = INT_TYPE(1);
1575 myRow1Start = end_pt - nedgecols + 1;
1581 myCol0Step = INT_TYPE(0);
1582 myCol0Start = start_pt;
1583 myCol1Step = INT_TYPE(0);
1584 myCol1Start = end_pt;
1590 myMiddleStart = INT_TYPE(start_mid_pt + nedgecols - 1);
1591 myMiddleColStep = INT_TYPE(1);
1592 myMiddleRowStep = INT_TYPE(nedgecols - 1);
1596 myNumPrimitives = 0;
1605 myNumPrimitives = 1;
1611 const bool has_endrow = myNoWrapV || myUnrollCurves;
1612 const bool has_endcol = myNoWrapU || myUnrollCurves;
1613 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1614 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1615 myNumVertices = nvtxrows * nvtxcols;
1621 myNumPrimitives = myNumEdgeRows * myNumEdgeCols;
1622 myNumVertices = 4 * myNumPrimitives - (myTriangularPoles ? 2 * myNumEdgeRows : 0);
1627 myNumPrimitives = 0;
1632 myNumPrimitives = myNumEdgeRows - 1 +
exint(myFirstRowIfNotWrapped) +
exint(myLastRowIfNotWrapped);
1633 myNumVertices = (myNumEdgeCols + 1) * (myNumEdgeRows + 1);
1641 const exint colprims = myNumEdgeCols - 1 +
exint(myFirstColIfNotWrapped) +
exint(myLastColIfNotWrapped);
1642 myNumPrimitives += colprims;
1643 myNumVertices += colprims * (myNumEdgeRows + 1);
1648 myNumPrimitives = myNumEdgeRows * 2 * (myNumEdgeCols -
exint(myTriangularPoles));
1649 myNumVertices = 3 * myNumPrimitives;
1652 template<
typename INT_TYPE>
1655 INT_TYPE start_pt, INT_TYPE end_pt, INT_TYPE start_mid_pt)
1659 myNumEdgeRows = nedgerows;
1660 myNumEdgeCols = nedgecols;
1669 myCorners[0] = start_pt;
1670 myCorners[1] = myCorners[0];
1671 myCorners[2] = end_pt;
1672 myCorners[3] = myCorners[2];
1674 myRow0Step = INT_TYPE(0);
1675 myRow0Start = start_pt;
1676 myRow1Step = INT_TYPE(0);
1677 myRow1Start = end_pt;
1679 myCol0Step = INT_TYPE(nedgecols+1);
1680 myCol0Start = start_mid_pt;
1681 myCol1Step = INT_TYPE(nedgecols+1);
1682 myCol1Start = start_mid_pt+nedgecols;
1684 myMiddleStart = myCol0Start+1;
1685 myMiddleColStep = INT_TYPE(1);
1686 myMiddleRowStep = INT_TYPE(nedgecols+1);
1690 myNumPrimitives = 0;
1698 myNumPrimitives = 1;
1705 const bool has_endrow = myNoWrapV || myUnrollCurves;
1706 const bool has_endcol = myNoWrapU || myUnrollCurves;
1707 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1708 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1709 myNumVertices = nvtxrows*nvtxcols;
1715 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1716 myNumVertices = 4*myNumPrimitives - (myTriangularPoles ? 2*myNumEdgeCols : 0);
1721 myNumPrimitives = 0;
1725 const exint rowprims = myNumEdgeRows-1 +
exint(myFirstRowIfNotWrapped) +
exint(myLastRowIfNotWrapped);
1726 myNumPrimitives = rowprims;
1727 myNumVertices = rowprims*(myNumEdgeCols+1);
1733 myNumPrimitives += myNumEdgeCols-1 +
exint(myFirstColIfNotWrapped) +
exint(myLastColIfNotWrapped);
1734 myNumVertices += (myNumEdgeCols+1)*(myNumEdgeRows+1);
1739 myNumPrimitives = (myNumEdgeRows -
exint(myTriangularPoles))*2*myNumEdgeCols;
1740 myNumVertices = 3*myNumPrimitives;
1743 template<
typename INT_TYPE>
1745 exint nedgerows,
exint nedgecols, INT_TYPE start_pt)
1749 myNumEdgeRows = nedgerows;
1750 myNumEdgeCols = nedgecols;
1759 myCorners[0] = start_pt;
1760 myCorners[1] = start_pt;
1761 myCorners[2] = start_pt;
1762 myCorners[3] = start_pt;
1764 myRow0Step = INT_TYPE(1);
1765 myRow0Start = myCorners[0]+myRow0Step;
1766 myRow1Step = INT_TYPE(1);
1767 myRow1Start = myCorners[2]+myRow1Step;
1769 myCol0Step = INT_TYPE(nedgecols);
1770 myCol0Start = myCorners[0]+myCol0Step;
1771 myCol1Step = INT_TYPE(nedgecols);
1772 myCol1Start = myCorners[1]+myCol1Step;
1774 myMiddleStart = myCol0Start+1;
1775 myMiddleColStep = myRow0Step;
1776 myMiddleRowStep = myCol0Step;
1780 myNumPrimitives = 0;
1788 myNumPrimitives = 1;
1795 const bool has_endrow = myNoWrapV || myUnrollCurves;
1796 const bool has_endcol = myNoWrapU || myUnrollCurves;
1797 const exint nvtxrows = myNumEdgeRows +
exint(has_endrow);
1798 const exint nvtxcols = myNumEdgeCols +
exint(has_endcol);
1799 myNumVertices = nvtxrows*nvtxcols;
1805 myNumPrimitives = myNumEdgeRows*myNumEdgeCols;
1806 myNumVertices = 4*myNumPrimitives;
1811 myNumPrimitives = 0;
1815 myNumPrimitives = myNumEdgeRows;
1816 myNumVertices = myNumPrimitives*(myNumEdgeCols+myUnrollCurves);
1822 myNumPrimitives += myNumEdgeCols;
1823 myNumVertices += myNumEdgeCols*(myNumEdgeRows+myUnrollCurves);
1828 myNumPrimitives = 2*myNumEdgeRows*myNumEdgeCols;
1829 myNumVertices = 3*myNumPrimitives;
void initColTube(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0))
GLdouble GLdouble GLint GLint const GLdouble * points
bool myFirstRowIfNotWrapped
bool myFirstColIfNotWrapped
#define UT_ASSERT_MSG(ZZ,...)
void GUiterateGridPrimitives(const GU_GridT< INT_TYPE > &grid, FUNCTOR &&functor)
void GUiterateGridVertices(const GU_GridT< INT_TYPE > &grid, FUNCTOR &&functor)
bool isInvalidTPSurf() const
void GUiterateGridPoints(const GU_GridT< INT_TYPE > &grid, FUNCTOR &&functor)
void initColSphere(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0), INT_TYPE end_pt=INT_TYPE(1), INT_TYPE start_mid_pt=INT_TYPE(2))
GEO_SurfaceType mySurfaceType
bool myLastRowIfNotWrapped
INT_TYPE getPoint(exint row, exint col) const
bool myLastColIfNotWrapped
PrimitiveType myPrimitiveType
void initSplitRowSphere(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0), INT_TYPE end_pt=INT_TYPE(1), INT_TYPE start_mid_pt=INT_TYPE(2))
bool doesRowWrap(exint row) const
GLenum GLenum GLsizei void * row
bool doesColWrap(exint col) const
void initRowSphere(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0), INT_TYPE end_pt=INT_TYPE(1), INT_TYPE start_mid_pt=INT_TYPE(2))
PrimitiveType myPrimitiveType
void initRowTube(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0))
void initTorus(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0))
void initSingleGrid(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0))
void initSplitColSphere(exint nedgerows, exint nedgecols, INT_TYPE start_pt=INT_TYPE(0), INT_TYPE end_pt=INT_TYPE(1), INT_TYPE start_mid_pt=INT_TYPE(2))