added test

This commit is contained in:
Sven Oesau 2024-11-28 15:06:18 +01:00
parent 52c166871e
commit 7533828c78
5 changed files with 860 additions and 6 deletions

View File

@ -436,7 +436,6 @@ private:
eminp = intersection;
emin = eproj;
minp = from_exact(intersection);
//min = proj;
FT p = dir * edge_dir;
min_speed = CGAL::approximate_sqrt(edge_dir * edge_dir) / p;
}
@ -444,9 +443,7 @@ private:
emaxp = intersection;
emax = eproj;
maxp = from_exact(intersection);
//max = proj;
typename Intersection_kernel::FT p = dir * edge_dir;
CGAL_assertion(p != 0);
max_speed = CGAL::approximate_sqrt(edge_dir * edge_dir) / from_exact(p);
}
}

View File

@ -1267,12 +1267,12 @@ private:
if (pos && neg) {
std::cout << "face is not convex" << std::endl;
exit(1);
CGAL_assertion(false);
}
if (!pos && !neg) {
std::cout << "face is degenerated" << std::endl;
exit(1);
CGAL_assertion(false);
}
if (neg) {

View File

@ -19,7 +19,7 @@ if(Boost_FOUND)
message(STATUS "Found Eigen")
include(CGAL_Eigen_support)
set(targets kinetic_3d_test_all)
set(targets kinetic_3d_test_all issue_8624)
set(project_linked_libraries)
set(project_compilation_definitions)

View File

@ -0,0 +1,777 @@
OFF
620 155 0
868.585 442.974 10
871.72 445.821 10
871.72 445.821 -10
868.585 442.974 -10
871.138 444.964 10
879.142 451.345 10
879.142 451.345 -10
871.138 444.964 -10
878.286 450.795 10
881.048 454.343 10
881.048 454.343 -10
878.286 450.795 -10
880.519 454.396 10
882.228 450.947 10
882.228 450.947 -10
880.519 454.396 -10
886.03 449.396 10
890.121 458.086 10
890.121 458.086 -10
886.03 449.396 -10
887.322 458.699 10
881.556 460.73 10
881.556 460.73 -10
887.322 458.699 -10
882.339 460.955 10
878.71 456.409 10
878.71 456.409 -10
882.339 460.955 -10
879.495 456.639 10
873.633 458.623 10
873.633 458.623 -10
879.495 456.639 -10
872.369 457.733 10
873.136 456.477 10
873.136 456.477 -10
872.369 457.733 -10
873.329 457.114 10
869.874 455.517 10
869.874 455.517 -10
873.329 457.114 -10
867.498 452.88 10
864.051 451.791 10
864.051 451.791 -10
867.498 452.88 -10
864.938 452.277 10
861.298 450.817 10
861.298 450.817 -10
864.938 452.277 -10
852.179 454.854 10
851.232 458.959 10
851.232 458.959 -10
852.179 454.854 -10
851.176 463.954 10
841.842 461.31 10
841.842 461.31 -10
851.176 463.954 -10
842.736 456.409 10
844.684 455.598 10
844.684 455.598 -10
842.736 456.409 -10
844.552 456.166 10
841.806 453.036 10
841.806 453.036 -10
844.552 456.166 -10
840.485 445.346 10
842.819 442.364 10
842.819 442.364 -10
840.485 445.346 -10
846.529 445.694 10
847.927 447.809 10
847.927 447.809 -10
846.529 445.694 -10
847.187 447.578 10
861.395 441.911 10
861.395 441.911 -10
847.187 447.578 -10
861.718 435.388 10
862.046 431.559 10
862.046 431.559 -10
861.718 435.388 -10
861.51 431.979 10
872.554 433.721 10
872.554 433.721 -10
861.51 431.979 -10
872.226 433.171 10
870.515 438.04 10
870.515 438.04 -10
872.226 433.171 -10
871.166 437.689 10
869.365 437.241 10
869.365 437.241 -10
871.166 437.689 -10
869.925 436.867 10
868.881 443.805 10
868.881 443.805 -10
869.925 436.867 -10
897.095 457.032 10
897.879 452.662 10
897.879 452.662 -10
897.095 457.032 -10
897.997 453.609 10
897.26 451.982 10
897.26 451.982 -10
897.997 453.609 -10
897.829 452.782 10
893.076 448.257 10
893.076 448.257 -10
897.829 452.782 -10
893.505 449.097 10
892.824 444.106 10
892.824 444.106 -10
893.505 449.097 -10
892.549 444.966 10
893.782 443.654 10
893.782 443.654 -10
892.549 444.966 -10
893.088 443.663 10
896.956 447.574 10
896.956 447.574 -10
893.088 443.663 -10
896.113 447.126 10
898.564 447.591 10
898.564 447.591 -10
896.113 447.126 -10
897.956 447.984 10
898.281 446.621 10
898.281 446.621 -10
897.956 447.984 -10
897.685 446.969 10
901.213 447.988 10
901.213 447.988 -10
897.685 446.969 -10
900.108 448.061 10
904.091 450.431 10
904.091 450.431 -10
900.108 448.061 -10
874.111 467.179 10
873.942 457.959 10
873.942 457.959 -10
874.111 467.179 -10
873.484 458.637 10
880.013 456.15 10
880.013 456.15 -10
873.484 458.637 -10
879.279 455.905 10
882.992 461.795 10
882.992 461.795 -10
879.279 455.905 -10
882.783 460.876 10
881.895 468.477 10
881.895 468.477 -10
882.783 460.876 -10
882.446 468.062 10
873.609 466.597 10
873.609 466.597 -10
882.446 468.062 -10
902.925 438.952 10
901.118 449.001 10
901.118 449.001 -10
902.925 438.952 -10
901.699 448.6 10
892.423 446.892 10
892.423 446.892 -10
901.699 448.6 -10
894.032 443.388 10
892.896 443.195 10
892.896 443.195 -10
894.032 443.388 -10
893.305 443.772 10
894.364 437.533 10
894.364 437.533 -10
893.305 443.772 -10
887.964 452.307 10
886.501 450.39 10
886.501 450.39 -10
887.964 452.307 -10
886.372 451.038 10
889.325 449.332 10
889.325 449.332 -10
886.372 451.038 -10
888.416 449.736 10
893.486 448.093 10
893.486 448.093 -10
888.416 449.736 -10
892.565 448.021 10
895.803 449.666 10
895.803 449.666 -10
892.565 448.021 -10
895.528 448.97 10
895.012 450.389 10
895.012 450.389 -10
895.528 448.97 -10
894.696 449.806 10
898.725 450.742 10
898.725 450.742 -10
894.696 449.806 -10
898.318 450.135 10
897.114 457.602 10
897.114 457.602 -10
898.318 450.135 -10
897.676 457.242 10
893.714 456.145 10
893.714 456.145 -10
897.676 457.242 -10
889.625 458.651 10
887.521 451.429 10
887.521 451.429 -10
889.625 458.651 -10
842.941 456.869 10
840.675 453.689 10
840.675 453.689 -10
842.941 456.869 -10
840.505 454.293 10
848.102 451.048 10
848.102 451.048 -10
840.505 454.293 -10
847.483 450.77 10
848.797 454.684 10
848.797 454.684 -10
847.483 450.77 -10
849.106 454.034 10
842.183 456.638 10
842.183 456.638 -10
849.106 454.034 -10
880.808 468.873 10
882.269 462.532 10
882.269 462.532 -10
880.808 468.873 -10
891.45 449.017 10
886.364 450.967 10
886.364 450.967 -10
891.45 449.017 -10
845.731 452.492 10
846.332 455.986 10
846.332 455.986 -10
845.731 452.492 -10
846.745 455.535 10
843.652 455.275 10
843.652 455.275 -10
846.745 455.535 -10
844.311 455.79 10
843.256 452.688 10
843.256 452.688 -10
844.311 455.79 -10
842.919 453.198 10
846.314 452.948 10
846.314 452.948 -10
842.919 453.198 -10
901.523 459.934 10
906.476 453.647 10
906.476 453.647 -10
901.523 459.934 -10
869.438 440.281 10
870.133 435.658 10
870.133 435.658 -10
869.438 440.281 -10
870.133 435.658 10
871.019 435.806 10
871.019 435.806 -10
870.133 435.658 -10
871.019 435.806 10
871.265 433.517 10
871.265 433.517 -10
871.019 435.806 -10
871.265 433.517 10
862.057 432.051 10
862.057 432.051 -10
871.265 433.517 -10
862.057 432.051 10
861.741 434.244 10
861.741 434.244 -10
862.057 432.051 -10
861.741 434.244 10
862.598 434.384 10
862.598 434.384 -10
861.741 434.244 -10
862.598 434.384 10
861.231 443.29 10
861.231 443.29 -10
862.598 434.384 -10
861.231 443.29 10
858.98 444.392 10
858.98 444.392 -10
861.231 443.29 -10
858.98 444.392 10
858.507 443.132 10
858.507 443.132 -10
858.98 444.392 -10
858.507 443.132 10
854.315 444.757 10
854.315 444.757 -10
858.507 443.132 -10
854.315 444.757 10
854.713 445.837 10
854.713 445.837 -10
854.315 444.757 -10
854.713 445.837 10
854.289 446.01 10
854.289 446.01 -10
854.713 445.837 -10
854.289 446.01 10
853.889 444.922 10
853.889 444.922 -10
854.289 446.01 -10
853.889 444.922 10
849.736 446.532 10
849.736 446.532 -10
853.889 444.922 -10
849.736 446.532 10
850.139 447.714 10
850.139 447.714 -10
849.736 446.532 -10
850.139 447.714 10
847.908 448.63 10
847.908 448.63 -10
850.139 447.714 -10
847.908 448.63 10
845.946 447.151 10
845.946 447.151 -10
847.908 448.63 -10
845.946 447.151 10
846.766 446.064 10
846.766 446.064 -10
845.946 447.151 -10
846.766 446.064 10
842.506 442.73 10
842.506 442.73 -10
846.766 446.064 -10
842.506 442.73 10
841.171 444.471 10
841.171 444.471 -10
842.506 442.73 -10
841.171 444.471 10
841.864 444.992 10
841.864 444.992 -10
841.171 444.471 -10
841.864 444.992 10
837.66 450.279 10
837.66 450.279 -10
841.864 444.992 -10
837.66 450.279 10
841.787 453.697 10
841.787 453.697 -10
837.66 450.279 -10
841.787 453.697 10
842.252 455.222 10
842.252 455.222 -10
841.787 453.697 -10
842.252 455.222 10
842.038 455.287 10
842.038 455.287 -10
842.252 455.222 -10
842.038 455.287 10
842.378 456.299 10
842.378 456.299 -10
842.038 455.287 -10
842.378 456.299 10
842.853 456.136 10
842.853 456.136 -10
842.378 456.299 -10
842.853 456.136 10
842.071 461.494 10
842.071 461.494 -10
842.853 456.136 -10
842.071 461.494 10
848.285 462.661 10
848.285 462.661 -10
842.071 461.494 -10
848.285 462.661 10
848.196 463.135 10
848.196 463.135 -10
848.285 462.661 -10
848.196 463.135 10
850.743 463.613 10
850.743 463.613 -10
848.196 463.135 -10
850.743 463.613 10
851.562 458.36 10
851.562 458.36 -10
850.743 463.613 -10
851.562 458.36 10
850.212 458.143 10
850.212 458.143 -10
851.562 458.36 -10
850.212 458.143 10
850.628 455.916 10
850.628 455.916 -10
850.212 458.143 -10
850.628 455.916 10
862.426 451.139 10
862.426 451.139 -10
850.628 455.916 -10
862.426 451.139 10
862.436 451.286 10
862.436 451.286 -10
862.426 451.139 -10
862.436 451.286 10
864.092 451.433 10
864.092 451.433 -10
862.436 451.286 -10
864.092 451.433 10
864.001 452.143 10
864.001 452.143 -10
864.092 451.433 -10
864.001 452.143 10
865.049 452.275 10
865.049 452.275 -10
864.001 452.143 -10
865.049 452.275 10
865.148 451.49 10
865.148 451.49 -10
865.049 452.275 -10
865.148 451.49 10
871.873 457.056 10
871.873 457.056 -10
865.148 451.49 -10
871.873 457.056 10
873.835 458.548 10
873.835 458.548 -10
871.873 457.056 -10
873.835 458.548 10
874.247 460.088 10
874.247 460.088 -10
873.835 458.548 -10
874.247 460.088 10
873.75 460.267 10
873.75 460.267 -10
874.247 460.088 -10
873.75 460.267 10
874.083 461.293 10
874.083 461.293 -10
873.75 460.267 -10
874.083 461.293 10
874.475 461.16 10
874.475 461.16 -10
874.083 461.293 -10
874.475 461.16 10
874.191 466.565 10
874.191 466.565 -10
874.475 461.16 -10
874.191 466.565 10
880.947 467.519 10
880.947 467.519 -10
874.191 466.565 -10
880.947 467.519 10
880.801 468.386 10
880.801 468.386 -10
880.947 467.519 -10
880.801 468.386 10
882.894 468.654 10
882.894 468.654 -10
880.801 468.386 -10
882.894 468.654 10
883.766 463.197 10
883.766 463.197 -10
882.894 468.654 -10
883.766 463.197 10
882.319 462.953 10
882.319 462.953 -10
883.766 463.197 -10
882.319 462.953 10
882.725 460.694 10
882.725 460.694 -10
882.319 462.953 -10
882.725 460.694 10
894.534 456.209 10
894.534 456.209 -10
882.725 460.694 -10
894.534 456.209 10
894.525 456.384 10
894.525 456.384 -10
894.534 456.209 -10
894.525 456.384 10
896.128 456.578 10
896.128 456.578 -10
894.525 456.384 -10
896.128 456.578 10
896.091 456.885 10
896.091 456.885 -10
896.128 456.578 -10
896.091 456.885 10
897.169 457.035 10
897.169 457.035 -10
896.091 456.885 -10
897.169 457.035 10
897.241 456.619 10
897.241 456.619 -10
897.169 457.035 -10
897.241 456.619 10
901.566 459.979 10
901.566 459.979 -10
897.241 456.619 -10
901.566 459.979 10
905.82 454.744 10
905.82 454.744 -10
901.566 459.979 -10
905.82 454.744 10
906.374 455.235 10
906.374 455.235 -10
905.82 454.744 -10
906.374 455.235 10
907.888 453.524 10
907.888 453.524 -10
906.374 455.235 -10
907.888 453.524 10
903.631 450.089 10
903.631 450.089 -10
907.888 453.524 -10
903.631 450.089 10
902.81 451.122 10
902.81 451.122 -10
903.631 450.089 -10
902.81 451.122 10
900.909 449.502 10
900.909 449.502 -10
902.81 451.122 -10
900.909 449.502 10
902.231 440.596 10
902.231 440.596 -10
900.909 449.502 -10
902.231 440.596 10
903.107 440.726 10
903.107 440.726 -10
902.231 440.596 -10
903.107 440.726 10
903.439 438.561 10
903.439 438.561 -10
903.107 440.726 -10
903.439 438.561 10
894.229 437.091 10
894.229 437.091 -10
903.439 438.561 -10
894.229 437.091 10
893.897 439.256 10
893.897 439.256 -10
894.229 437.091 -10
893.897 439.256 10
894.766 439.395 10
894.766 439.395 -10
893.897 439.256 -10
894.766 439.395 10
893.095 448.477 10
893.095 448.477 -10
894.766 439.395 -10
893.095 448.477 10
891.024 449.302 10
891.024 449.302 -10
893.095 448.477 -10
891.024 449.302 10
890.547 448.022 10
890.547 448.022 -10
891.024 449.302 -10
890.547 448.022 10
886.357 449.641 10
886.357 449.641 -10
890.547 448.022 -10
886.357 449.641 10
886.919 451.003 10
886.919 451.003 -10
886.357 449.641 -10
886.919 451.003 10
886.529 451.164 10
886.529 451.164 -10
886.919 451.003 -10
886.529 451.164 10
886.017 449.926 10
886.017 449.926 -10
886.529 451.164 -10
886.017 449.926 10
881.895 451.431 10
881.895 451.431 -10
886.017 449.926 -10
881.895 451.431 10
882.338 452.688 10
882.338 452.688 -10
881.895 451.431 -10
882.338 452.688 10
879.892 453.549 10
879.892 453.549 -10
882.338 452.688 -10
879.892 453.549 10
877.953 452.092 10
877.953 452.092 -10
879.892 453.549 -10
877.953 452.092 10
878.727 451.063 10
878.727 451.063 -10
877.953 452.092 -10
878.727 451.063 10
875.334 448.269 10
875.334 448.269 -10
878.727 451.063 -10
875.334 448.269 10
874.474 449.339 10
874.474 449.339 -10
875.334 448.269 -10
874.474 449.339 10
874.085 449.038 10
874.085 449.038 -10
874.474 449.339 -10
874.085 449.038 10
874.945 447.968 10
874.945 447.968 -10
874.085 449.038 -10
874.945 447.968 10
871.482 445.258 10
871.482 445.258 -10
874.945 447.968 -10
871.482 445.258 10
870.634 446.255 10
870.634 446.255 -10
871.482 445.258 -10
870.634 446.255 10
868.777 444.675 10
868.777 444.675 -10
870.634 446.255 -10
868.777 444.675 10
869.438 440.281 10
869.438 440.281 -10
868.777 444.675 -10
4 0 1 2 3
4 4 5 6 7
4 8 9 10 11
4 12 13 14 15
4 16 17 18 19
4 20 21 22 23
4 24 25 26 27
4 28 29 30 31
4 32 33 34 35
4 36 37 38 39
4 40 41 42 43
4 44 45 46 47
4 48 49 50 51
4 52 53 54 55
4 56 57 58 59
4 60 61 62 63
4 64 65 66 67
4 68 69 70 71
4 72 73 74 75
4 76 77 78 79
4 80 81 82 83
4 84 85 86 87
4 88 89 90 91
4 92 93 94 95
4 96 97 98 99
4 100 101 102 103
4 104 105 106 107
4 108 109 110 111
4 112 113 114 115
4 116 117 118 119
4 120 121 122 123
4 124 125 126 127
4 128 129 130 131
4 132 133 134 135
4 136 137 138 139
4 140 141 142 143
4 144 145 146 147
4 148 149 150 151
4 152 153 154 155
4 156 157 158 159
4 160 161 162 163
4 164 165 166 167
4 168 169 170 171
4 172 173 174 175
4 176 177 178 179
4 180 181 182 183
4 184 185 186 187
4 188 189 190 191
4 192 193 194 195
4 196 197 198 199
4 200 201 202 203
4 204 205 206 207
4 208 209 210 211
4 212 213 214 215
4 216 217 218 219
4 220 221 222 223
4 224 225 226 227
4 228 229 230 231
4 232 233 234 235
4 236 237 238 239
4 240 241 242 243
4 244 245 246 247
4 248 249 250 251
4 252 253 254 255
4 256 257 258 259
4 260 261 262 263
4 264 265 266 267
4 268 269 270 271
4 272 273 274 275
4 276 277 278 279
4 280 281 282 283
4 284 285 286 287
4 288 289 290 291
4 292 293 294 295
4 296 297 298 299
4 300 301 302 303
4 304 305 306 307
4 308 309 310 311
4 312 313 314 315
4 316 317 318 319
4 320 321 322 323
4 324 325 326 327
4 328 329 330 331
4 332 333 334 335
4 336 337 338 339
4 340 341 342 343
4 344 345 346 347
4 348 349 350 351
4 352 353 354 355
4 356 357 358 359
4 360 361 362 363
4 364 365 366 367
4 368 369 370 371
4 372 373 374 375
4 376 377 378 379
4 380 381 382 383
4 384 385 386 387
4 388 389 390 391
4 392 393 394 395
4 396 397 398 399
4 400 401 402 403
4 404 405 406 407
4 408 409 410 411
4 412 413 414 415
4 416 417 418 419
4 420 421 422 423
4 424 425 426 427
4 428 429 430 431
4 432 433 434 435
4 436 437 438 439
4 440 441 442 443
4 444 445 446 447
4 448 449 450 451
4 452 453 454 455
4 456 457 458 459
4 460 461 462 463
4 464 465 466 467
4 468 469 470 471
4 472 473 474 475
4 476 477 478 479
4 480 481 482 483
4 484 485 486 487
4 488 489 490 491
4 492 493 494 495
4 496 497 498 499
4 500 501 502 503
4 504 505 506 507
4 508 509 510 511
4 512 513 514 515
4 516 517 518 519
4 520 521 522 523
4 524 525 526 527
4 528 529 530 531
4 532 533 534 535
4 536 537 538 539
4 540 541 542 543
4 544 545 546 547
4 548 549 550 551
4 552 553 554 555
4 556 557 558 559
4 560 561 562 563
4 564 565 566 567
4 568 569 570 571
4 572 573 574 575
4 576 577 578 579
4 580 581 582 583
4 584 585 586 587
4 588 589 590 591
4 592 593 594 595
4 596 597 598 599
4 600 601 602 603
4 604 605 606 607
4 608 609 610 611
4 612 613 614 615
4 616 617 618 619

View File

@ -0,0 +1,80 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Kinetic_space_partition_3.h>
#include <CGAL/Real_timer.h>
#include <CGAL/IO/polygon_soup_io.h>
using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel;
using EPECK = CGAL::Exact_predicates_exact_constructions_kernel;
using Kernel = EPICK;
using FT = typename Kernel::FT;
using Point_3 = typename Kernel::Point_3;
using Surface_mesh = CGAL::Surface_mesh<Point_3>;
using KSP = CGAL::Kinetic_space_partition_3<EPICK>;
using Timer = CGAL::Real_timer;
int main(int argc, char** argv)
{
// Reading polygons from file
std::string input_filename = (argc > 1 ? argv[1] : "data/issue_8624.off");
std::ifstream input_file(input_filename);
std::vector<Point_3> input_vertices;
std::vector<std::vector<std::size_t> > input_faces;
if (CGAL::IO::read_polygon_soup(input_filename, input_vertices, input_faces)) {
std::cout << "* reading the file: " << input_filename << "!" << std::endl;
input_file.close();
} else {
std::cerr << "ERROR: can't read the file " << input_filename << "!" << std::endl;
return EXIT_FAILURE;
}
std::cout << "--- INPUT STATS: \n* number of polygons: " << input_faces.size() << std::endl;
// Parameters.
const unsigned int k = (argc > 2 ? std::atoi(argv[2]) : 1);
// Initialization of Kinetic_space_partition_3 object.
// 'debug' set to true exports intermediate results into files in the working directory.
// The resulting volumes are exported into a volumes folder, if the folder already exists.
KSP ksp(CGAL::parameters::verbose(true).debug(false));
// Providing input polygons.
ksp.insert(input_vertices, input_faces);
Timer timer;
timer.start();
// 'initialize' creates the intersection graph that is used for the partition.
ksp.initialize(CGAL::parameters::bbox_dilation_ratio(1.1).reorient_bbox(false));
// Creating the partition with allowing up to 'k' intersections for each kinetic polygon.
ksp.partition(k);
timer.stop();
const FT time = static_cast<FT>(timer.time());
// Access the kinetic partition via linear cell complex.
typedef CGAL::Linear_cell_complex_traits<3, EPECK> LCC_Traits;
CGAL::Linear_cell_complex_for_combinatorial_map<3, 3, LCC_Traits, typename KSP::Linear_cell_complex_min_items> lcc;
ksp.get_linear_cell_complex(lcc);
std::vector<unsigned int> cells = { 0, 2, 3 }, count;
count = lcc.count_cells(cells);
assert(count[0] != 0);
assert(count[2] != 0);
assert(count[3] != 0);
if (count[0] == 0 || count[2] == 0 || count[3] == 0)
return EXIT_FAILURE;
std::cout << "For k = " << k << ":\n" << " vertices: " << count[0] << "\n faces: " << count[2] << "\n volumes: " << count[3] << std::endl;
std::cout << "\n3D kinetic partition created in " << time << " seconds!" << std::endl;
return EXIT_SUCCESS;
}