|
2 | 2 |
|
3 | 3 | using PointCloudConverter.Logger;
|
4 | 4 | using System;
|
| 5 | +using System.Collections; |
5 | 6 | using System.Diagnostics;
|
6 | 7 | using System.IO;
|
7 | 8 | using System.Runtime.CompilerServices;
|
@@ -537,71 +538,26 @@ void IWriter.Save(int fileIndex)
|
537 | 538 | // randomize points in this node
|
538 | 539 | if (importSettings.randomize)
|
539 | 540 | {
|
540 |
| - //ShuffleFlags flags = ShuffleFlags.None; |
541 |
| - //int rand = Tools.frnd.Next(0, index--); |
| 541 | + var listsToShuffle = new List<IList> { nodeTempX, nodeTempY, nodeTempZ }; |
542 | 542 |
|
543 |
| - Tools.Shuffle(ref nodeTempX); |
544 |
| - Tools.Shuffle(ref nodeTempY); |
545 |
| - Tools.Shuffle(ref nodeTempZ); |
546 |
| - |
547 |
| - // NOTE now we shuffle all arrays, even if not all are used? |
548 |
| - if (importSettings.importRGB == true || (importSettings.importIntensity == true || importSettings.importClassification == true)) |
| 543 | + if (importSettings.importRGB) |
549 | 544 | {
|
550 |
| - Tools.Shuffle(ref nodeTempR); |
551 |
| - Tools.Shuffle(ref nodeTempG); |
552 |
| - Tools.Shuffle(ref nodeTempB); |
| 545 | + listsToShuffle.Add(nodeTempR); |
| 546 | + listsToShuffle.Add(nodeTempG); |
| 547 | + listsToShuffle.Add(nodeTempB); |
553 | 548 | }
|
554 | 549 |
|
555 |
| - if (importSettings.importIntensity == true) Tools.Shuffle(ref nodeTempIntensity); |
556 |
| - if (importSettings.importClassification == true) Tools.Shuffle(ref nodeTempClassification); |
| 550 | + if (importSettings.importIntensity) |
| 551 | + listsToShuffle.Add(nodeTempIntensity); |
557 | 552 |
|
558 |
| - //if (importSettings.importRGB == true) |
559 |
| - //{ |
560 |
| - // if (importSettings.packColors == true) |
561 |
| - // { |
562 |
| - |
563 |
| - // } |
564 |
| - // else // not packed |
565 |
| - // { |
566 |
| - // //// intensity or classification are saved into rgb field if not packed |
567 |
| - // //if (importSettings.importIntensity || importSettings.importClassification) |
568 |
| - // //{ |
569 |
| - // // Tools.Shuffle(ref nodeTempR); |
570 |
| - // // Tools.Shuffle(ref nodeTempG); |
571 |
| - // // Tools.Shuffle(ref nodeTempB); |
572 |
| - // //} |
573 |
| - |
574 |
| - // // if separate intensity |
575 |
| - // if (importSettings.importIntensity) |
576 |
| - // { |
577 |
| - // Tools.Shuffle(ref nodeTempIntensity); |
578 |
| - // } |
579 |
| - |
580 |
| - // // if separate classification |
581 |
| - // if (importSettings.importClassification) |
582 |
| - // { |
583 |
| - // Tools.Shuffle(ref nodeTempClassification); |
584 |
| - // } |
585 |
| - // } |
586 |
| - //} |
587 |
| - //else // no rgb |
588 |
| - //{ |
589 |
| - // if (importSettings.importIntensity) |
590 |
| - // { |
591 |
| - // Tools.Shuffle(ref nodeTempIntensity); |
592 |
| - // } |
593 |
| - |
594 |
| - // // if separate classification |
595 |
| - // if (importSettings.importClassification) |
596 |
| - // { |
597 |
| - // Tools.Shuffle(ref nodeTempClassification); |
598 |
| - // } |
599 |
| - //} |
| 553 | + if (importSettings.importClassification) |
| 554 | + listsToShuffle.Add(nodeTempClassification); |
600 | 555 |
|
601 | 556 | if (importSettings.averageTimestamp)
|
602 |
| - { |
603 |
| - Tools.Shuffle(ref nodeTempTime); |
604 |
| - } |
| 557 | + listsToShuffle.Add(nodeTempTime); |
| 558 | + |
| 559 | + Tools.ShuffleInPlace(listsToShuffle.ToArray()); |
| 560 | + |
605 | 561 | }
|
606 | 562 |
|
607 | 563 |
|
|
0 commit comments