Initial commit
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2016 The Cartographer Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CartographerSharp.Models.Mapping;
|
||||
|
||||
/// <summary>
|
||||
/// Protocol buffer representation of a hybrid grid.
|
||||
/// </summary>
|
||||
public struct HybridGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolution of the grid.
|
||||
/// </summary>
|
||||
[JsonPropertyName("resolution")]
|
||||
public double Resolution { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X indices. '{x, y, z}_indices[i]' is the index of 'values[i]'.
|
||||
/// </summary>
|
||||
[JsonPropertyName("x_indices")]
|
||||
public List<int> XIndices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Y indices.
|
||||
/// </summary>
|
||||
[JsonPropertyName("y_indices")]
|
||||
public List<int> YIndices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Z indices.
|
||||
/// </summary>
|
||||
[JsonPropertyName("z_indices")]
|
||||
public List<int> ZIndices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The entries in 'values' should be uint16s, not int32s, but protos don't
|
||||
/// have a uint16 type.
|
||||
/// </summary>
|
||||
[JsonPropertyName("values")]
|
||||
public List<int> Values { get; set; }
|
||||
|
||||
public HybridGrid(
|
||||
double resolution,
|
||||
List<int>? xIndices = null,
|
||||
List<int>? yIndices = null,
|
||||
List<int>? zIndices = null,
|
||||
List<int>? values = null)
|
||||
{
|
||||
Resolution = resolution;
|
||||
XIndices = xIndices ?? new List<int>();
|
||||
YIndices = yIndices ?? new List<int>();
|
||||
ZIndices = zIndices ?? new List<int>();
|
||||
Values = values ?? new List<int>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user