| 437 | //--------------------------------------------------------------------------- |
| 438 | |
| 439 | static void write_points_seek(LASzipper* zipper, PointData& data) |
| 440 | { |
| 441 | if (zipper==NULL) |
| 442 | return; |
| 443 | |
| 444 | double start_time, end_time; |
| 445 | unsigned char c; |
| 446 | unsigned int i,j; |
| 447 | |
| 448 | start_time = taketime(); |
| 449 | |
| 450 | // the two branches of this IF are the same, except for the use of a random number; |
| 451 | // we keep the random case separate, so that we can get fastest timing tests w/o random data |
| 452 | if (settings->use_random) |
| 453 | { |
| 454 | for (i = 0; i < settings->num_points; i++) |
| 455 | { |
| 456 | srand(i); |
| 457 | c = rand() % 256; |
| 458 | for (j = 0; j < data.point_size; j++) |
| 459 | { |
| 460 | data.point_data[j] = c; |
| 461 | c = rand() % 256; |
| 462 | } |
| 463 | zipper->write(data.point); |
| 464 | } |
| 465 | } |
| 466 | else |
| 467 | { |
| 468 | for (i = 0; i < settings->num_points; i++) |
| 469 | { |
| 470 | c = (unsigned char)i; |
| 471 | for (j = 0; j < data.point_size; j++) |
| 472 | { |
| 473 | data.point_data[j] = c; |
| 474 | c++; |
| 475 | } |
| 476 | zipper->write(data.point); |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | if (!zipper->close()) |
| 481 | { |
| 482 | log("ERROR on zipper->close(): %s\n", zipper->get_error()); |
| 483 | } |
| 484 | end_time = taketime(); |
| 485 | |
| 486 | log("laszipper wrote %u points in %g seconds\n", settings->num_points, end_time-start_time); |
| 487 | |
| 488 | return; |
| 489 | } |
| 490 | |
| 491 | //--------------------------------------------------------------------------- |
| 492 | |