ZLab.Discrete ZLab.Discrete
ZLab.Discrete ZLab.Discrete
Developed by Zeke Zhang

Search Results for

    Edit this page

    Method SerializeBinary2Bit

    | Edit this page View Source

    SerializeBinary2Bit(IGrid<Occupancy>)

    Serializes occupancy grids using advanced bit-packing compression. This specialized method achieves significant space savings by encoding multiple occupancy values into single bytes using a ternary 2-bit representation.

    Declaration
    public static byte[] SerializeBinary2Bit(this IGrid<Occupancy> grid)
    Parameters
    Type Name Description
    IGrid<Occupancy> grid

    The occupancy grid to serialize.

    Returns
    Type Description
    byte[]

    A byte array containing the compressed occupancy data.

    Remarks

    This method provides the highest compression ratio for occupancy data by using ZLab.Discrete.Algorithms.Encoding.OccupancyBitPacker to store multiple occupancy states in minimal space with a ternary 2-bit encoding scheme.

    Typical compression ratios are 60-70% compared to standard binary serialization, making this ideal for large voxel grids and spatial data structures.

    This overload takes priority over the generic unmanaged version when called on IGrid<T> instances.