Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Voxel"/> struct.
 /// </summary>
 /// <param name="ID">The identifier.</param>
 /// <param name="solid">The solid.</param>
 internal Voxel(long ID, VoxelizedSolid solid = null)
 {
     this.ID = ID;
     Constants.GetAllFlags(ID, out var level, out var role, out var btmIsInside);
     Role              = role;
     Level             = level;
     BtmCoordIsInside  = btmIsInside;
     SideLength        = solid.VoxelSideLengths[Level];
     CoordinateIndices = Constants.GetCoordinateIndices(ID, solid.singleCoordinateShifts[level]);
     BottomCoordinate  =
         solid.GetRealCoordinates(Level, CoordinateIndices[0], CoordinateIndices[1], CoordinateIndices[2]);
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VoxelBinClass"/> class.
 /// </summary>
 /// <param name="ID">The identifier.</param>
 /// <param name="voxelRole">The voxel role.</param>
 /// <param name="solid">The solid.</param>
 public VoxelBinClass(long ID, VoxelRoleTypes voxelRole, VoxelizedSolid solid,
                      bool btmCoordIsInside = false)
 {
     InnerVoxels = new VoxelHashSet[solid.lastLevel];
     for (int i = 1; i < solid.numberOfLevels; i++)
     {
         InnerVoxels[i - 1] = new VoxelHashSet(i, solid.bitLevelDistribution);
     }
     Role    = voxelRole;
     this.ID = Constants.ClearFlagsFromID(ID) +
               Constants.MakeFlags(Level, Role, Role == VoxelRoleTypes.Full || btmCoordIsInside);
     BtmCoordIsInside  = btmCoordIsInside;
     SideLength        = solid.VoxelSideLengths[Level];
     CoordinateIndices = Constants.GetCoordinateIndices(ID, solid.singleCoordinateShifts[0]);
     BottomCoordinate  =
         solid.GetRealCoordinates(Level, CoordinateIndices[0], CoordinateIndices[1], CoordinateIndices[2]);
 }