diff --git a/src/Aardvark.Algodat.Tests/ChunkTests.cs b/src/Aardvark.Algodat.Tests/ChunkTests.cs index 23547f72..039f8f8c 100644 --- a/src/Aardvark.Algodat.Tests/ChunkTests.cs +++ b/src/Aardvark.Algodat.Tests/ChunkTests.cs @@ -206,7 +206,7 @@ public void Chunk_ImmutableFilterMinDistByCell_Parts() var a = new Chunk( positions: new[] { new V3d(0.4, 0.4, 0.4), new V3d(0.6, 0.6, 0.6), new V3d(1.1, 0.1, 0.1), new V3d(1.2, 0.2, 0.2) }, colors: null, normals: null, intensities: null, classifications: null, - partIndices: new byte[] { 0, 1, 2, 3 }, + parts: new byte[] { 0, 1, 2, 3 }, bbox: null ); diff --git a/src/Aardvark.Data.E57/ImportE57.cs b/src/Aardvark.Data.E57/ImportE57.cs index 58c0ce36..31822162 100644 --- a/src/Aardvark.Data.E57/ImportE57.cs +++ b/src/Aardvark.Data.E57/ImportE57.cs @@ -207,7 +207,7 @@ public static IEnumerable Chunks(this Stream stream, long streamLengthInB normals: e57chunk.Normals, intensities: e57chunk.Intensities, classifications: e57chunk.Classification?.Map(x => (byte)x), - partIndices: config.EnabledProperties.PartIndices ? partIndex : null, + parts: config.EnabledProperties.PartIndices ? partIndex : null, bbox: null ); diff --git a/src/Aardvark.Data.Points.Ascii/LineParsers.cs b/src/Aardvark.Data.Points.Ascii/LineParsers.cs index e3379673..66d012b4 100644 --- a/src/Aardvark.Data.Points.Ascii/LineParsers.cs +++ b/src/Aardvark.Data.Points.Ascii/LineParsers.cs @@ -120,15 +120,15 @@ public static Chunk CustomDurable(byte[] buffer, int count, double filterDist, T // add point to chunk ps.Add(state.Position); - if (hasColor) cs.Add(state.Color); - if (hasNormal) ns.Add(state.Normal); - if (hasIntensity) js.Add(state.Intensity); + cs?.Add(state.Color); + ns?.Add(state.Normal); + js?.Add(state.Intensity); } } } - if (ps.Count == 0) return null; - return new Chunk(ps, cs, ns, js, classifications: null, partIndices: partIndices, bbox: null); + if (ps.Count == 0) return Chunk.Empty; + return new Chunk(ps, cs, ns, js, classifications: null, parts: partIndices, bbox: null); } /// @@ -183,14 +183,14 @@ public static Chunk Custom(byte[] buffer, int count, double filterDist, Token[] // add point to chunk ps.Add(state.Position); - if (hasColor) cs.Add(state.Color); - if (hasNormal) ns.Add(state.Normal); - if (hasIntensity) js.Add(state.Intensity); + cs?.Add(state.Color); + ns?.Add(state.Normal); + js?.Add(state.Intensity); } } } - if (ps.Count == 0) return null; + if (ps.Count == 0) return Chunk.Empty; return new Chunk(ps, cs, ns, js, classifications: null, partIndices, bbox: null); } diff --git a/src/Aardvark.Data.Points.Base/Chunk.cs b/src/Aardvark.Data.Points.Base/Chunk.cs index 9e12ebc7..82545d7b 100644 --- a/src/Aardvark.Data.Points.Base/Chunk.cs +++ b/src/Aardvark.Data.Points.Base/Chunk.cs @@ -196,7 +196,7 @@ public static Chunk ImmutableMerge(params Chunk[] chunks) if (ps == null) throw new Exception("Invariant 4cc7d585-9a46-4ba2-892a-95fce9ed06da."); return new Chunk(ps, cs, ns, js, ks, - partIndices: PartIndexUtils.ConcatIndices(chunks.Select(x => (indices: x.PartIndices, count: x.Count))), + parts: PartIndexUtils.ConcatIndices(chunks.Select(x => (indices: x.PartIndices, count: x.Count))), bbox: new Box3d(chunks.Select(x => x.BoundingBox)) ); } @@ -211,7 +211,7 @@ public static Chunk ImmutableMerge(IEnumerable chunks) /// Optional. Either null or same number of elements as positions. /// Optional. Either null or same number of elements as positions. /// Optional. Either null or same number of elements as positions. - /// Optional. Either (A) null, or (B) single uint value for all points in cell, or (3) array with same number of elements (byte|short|int) as positions. + /// Optional. Either (A) null, or (B) single uint value for all points in cell, or (3) array with same number of elements (byte|short|int) as positions. /// Optional. If null, then bbox will be constructed from positions. public Chunk( IList? positions, @@ -219,7 +219,7 @@ public Chunk( IList? normals, IList? intensities, IList? classifications, - object? partIndices, + object? parts, Box3d? bbox ) { @@ -261,17 +261,17 @@ public Chunk( #region part indices - switch (partIndices) + switch (parts) { case null: break; case uint: break; case IList: break; case IList: break; case IList: break; - default: throw new Exception($"Unexpected part indices type {partIndices.GetType().FullName}. Error fc9d196d-508e-4977-8f04-2167c71e38b0."); + default: throw new Exception($"Unexpected part indices type {parts.GetType().FullName}. Error fc9d196d-508e-4977-8f04-2167c71e38b0."); } IList? qs1b = null; - if (partIndices is IList _qs1b && _qs1b.Count != positions.Count) + if (parts is IList _qs1b && _qs1b.Count != positions.Count) { qs1b = _qs1b; countMismatch = true; @@ -281,7 +281,7 @@ public Chunk( ); } IList? qs1s = null; - if (partIndices is IList _qs1s && _qs1s.Count != positions.Count) + if (parts is IList _qs1s && _qs1s.Count != positions.Count) { qs1s = _qs1s; countMismatch = true; @@ -291,7 +291,7 @@ public Chunk( ); } IList? qs1i = null; - if (partIndices is IList _qs1i && _qs1i.Count != positions.Count) + if (parts is IList _qs1i && _qs1i.Count != positions.Count) { qs1i = _qs1i; countMismatch = true; @@ -319,9 +319,9 @@ public Chunk( if (normals != null && normals .Count != minCount) normals = normals .Take(minCount).ToArray(); if (intensities != null && intensities .Count != minCount) intensities = intensities .Take(minCount).ToArray(); if (classifications != null && classifications.Count != minCount) classifications = classifications.Take(minCount).ToArray(); - if (qs1b != null && qs1b .Count != minCount) partIndices = qs1b .Take(minCount).ToArray(); - if (qs1s != null && qs1s .Count != minCount) partIndices = qs1s .Take(minCount).ToArray(); - if (qs1i != null && qs1i .Count != minCount) partIndices = qs1i .Take(minCount).ToArray(); + if (qs1b != null && qs1b .Count != minCount) parts = qs1b .Take(minCount).ToArray(); + if (qs1s != null && qs1s .Count != minCount) parts = qs1s .Take(minCount).ToArray(); + if (qs1i != null && qs1i .Count != minCount) parts = qs1i .Take(minCount).ToArray(); } Positions = positions; @@ -329,7 +329,7 @@ public Chunk( Normals = normals; Intensities = intensities; Classifications = classifications; - PartIndices = partIndices; + PartIndices = parts; BoundingBox = bbox ?? (positions.Count > 0 ? new Box3d(positions) : Box3d.Invalid); } @@ -353,7 +353,7 @@ public IEnumerable Split(int chunksize) normals: HasNormals ? Normals.Skip(i).Take(chunksize).ToArray() : null, intensities: HasIntensities ? Intensities.Skip(i).Take(chunksize).ToArray() : null, classifications: HasClassifications ? Classifications.Skip(i).Take(chunksize).ToArray() : null, - partIndices: PartIndexUtils.Take(PartIndexUtils.Skip(PartIndices, i), chunksize), + parts: PartIndexUtils.Take(PartIndexUtils.Skip(PartIndices, i), chunksize), bbox: null ); @@ -378,7 +378,7 @@ public Chunk Union(Chunk other) Append(Normals, other.Normals), Append(Intensities, other.Intensities), Append(Classifications, other.Classifications), - partIndices: PartIndexUtils.ConcatIndices(PartIndices, Count, other.PartIndices, other.Count), + parts: PartIndexUtils.ConcatIndices(PartIndices, Count, other.PartIndices, other.Count), Box.Union(BoundingBox, other.BoundingBox) ); } @@ -456,7 +456,7 @@ public Chunk ImmutableDeduplicate(bool verbose) #endif } - return new Chunk(ps, cs, ns, js, ks, partIndices: qs, bbox: null); + return new Chunk(ps, cs, ns, js, ks, parts: qs, bbox: null); } else { @@ -498,7 +498,7 @@ public Dictionary GroupBy(Func keySelector) Normals != null ? ia.Map(i => Normals[i]) : null, Intensities != null ? ia.Map(i => Intensities[i]) : null, Classifications != null ? ia.Map(i => Classifications[i]) : null, - partIndices: PartIndexUtils.Subset(PartIndices, ia), + parts: PartIndexUtils.Subset(PartIndices, ia), bbox: null ); } @@ -524,7 +524,7 @@ public Chunk ImmutableFilter(Func predicate) var ks = Classifications?.Subset(ia); var qs = PartIndexUtils.Subset(PartIndices, ia); - return new Chunk(ps, cs, ns, js, ks, partIndices: qs, bbox: null); + return new Chunk(ps, cs, ns, js, ks, parts: qs, bbox: null); } /// @@ -552,7 +552,7 @@ public Chunk ImmutableFilterSequentialMinDistL2(double minDist) Normals?.Subset(ia), Intensities?.Subset(ia), Classifications?.Subset(ia), - partIndices: PartIndexUtils.Subset(PartIndices, ia), + parts: PartIndexUtils.Subset(PartIndices, ia), bbox: null ); } @@ -581,7 +581,7 @@ public Chunk ImmutableFilterSequentialMinDistL1(double minDist) Normals?.Subset(ia), Intensities?.Subset(ia), Classifications?.Subset(ia), - partIndices: PartIndexUtils.Subset(PartIndices, ia), + parts: PartIndexUtils.Subset(PartIndices, ia), bbox: null ); } diff --git a/src/Aardvark.Data.Points.LasZip/Import.cs b/src/Aardvark.Data.Points.LasZip/Import.cs index a4fdeb06..f591c929 100644 --- a/src/Aardvark.Data.Points.LasZip/Import.cs +++ b/src/Aardvark.Data.Points.LasZip/Import.cs @@ -69,7 +69,7 @@ private static IEnumerable Chunks(this IEnumerable xs, obj normals: null, intensities: x.Intensities != null ? Map(x.Intensities, i => (int)i) : null, classifications: x.Classifications, - partIndices: partIndices, + parts: partIndices, bbox: null ) ); diff --git a/src/Aardvark.Data.Points.Ply/PlyImport.cs b/src/Aardvark.Data.Points.Ply/PlyImport.cs index aa9b6f08..7b7a62ba 100644 --- a/src/Aardvark.Data.Points.Ply/PlyImport.cs +++ b/src/Aardvark.Data.Points.Ply/PlyImport.cs @@ -260,7 +260,7 @@ void rescale(Func toDouble) #endregion - var chunk = new Chunk(ps, cs, ns, js, ks, partIndices: partIndex, bbox: null); + var chunk = new Chunk(ps, cs, ns, js, ks, parts: partIndex, bbox: null); yield return chunk; } diff --git a/src/Aardvark.Geometry.PointSet/Octrees/Merge.cs b/src/Aardvark.Geometry.PointSet/Octrees/Merge.cs index f41f95bc..393fb159 100644 --- a/src/Aardvark.Geometry.PointSet/Octrees/Merge.cs +++ b/src/Aardvark.Geometry.PointSet/Octrees/Merge.cs @@ -300,7 +300,7 @@ public static (IPointCloudNode, bool) Merge(this IPointCloudNode a, IPointCloudN nsla.Count > 0 ? nsla : null, jsla.Count > 0 ? jsla : null, ksla.Count > 0 ? ksla : null, - partIndices: qsla, + parts: qsla, bbox: null ); @@ -801,7 +801,7 @@ private static IPointCloudNode MergeLeafAndLeafWithIdenticalRootCell(IPointCloud var ks = Concat(a.Classifications?.Value, b.Classifications?.Value); var qs = PartIndexUtils.ConcatIndices(a.PartIndices, a.PointCountCell, b.PartIndices, b.PointCountCell); - var chunk = new Chunk(ps, cs, ns, js, ks, partIndices: qs, cell.BoundingBox); + var chunk = new Chunk(ps, cs, ns, js, ks, parts: qs, cell.BoundingBox); if (config.NormalizePointDensityGlobal) { chunk = chunk.ImmutableFilterMinDistByCell(cell, config.ParseConfig); diff --git a/src/Aardvark.Geometry.PointSet/Queries/QueriesRayLine3d.cs b/src/Aardvark.Geometry.PointSet/Queries/QueriesRayLine3d.cs index c2a35b32..e772e8bd 100644 --- a/src/Aardvark.Geometry.PointSet/Queries/QueriesRayLine3d.cs +++ b/src/Aardvark.Geometry.PointSet/Queries/QueriesRayLine3d.cs @@ -167,7 +167,7 @@ public static IEnumerable QueryPointsNearLineSegment( node.Normals?.Value.Subset(ia), node.Intensities?.Value.Subset(ia), node.Classifications?.Value.Subset(ia), - partIndices: node.PartIndices?.Subset(ia), + parts: node.PartIndices?.Subset(ia), bbox: null); throw new NotImplementedException("PARTINDICES"); }