// Public Methods (4) /// <summary> /// Clone the object /// </summary> /// <returns></returns> public override object Clone() { var vg = new VoxelGrid3D(this.BBox, VoxelSize); for (var i = 0; i < Count; i++) { if (this[i]) { vg[i] = true; } } return(vg); }
/// <summary> /// VoxelGrid constructor: Copies (clone) a VoxelGrid from another voxelGrid /// Complexity O(n) for voxelsize /// </summary> /// <param name="vg"></param> public VoxelGrid3D(VoxelGrid3D vg) { // struct: should be copy this.BBox = vg.BBox; // struct: should be copy VoxelSize = vg.VoxelSize; // struct: should be copy SizeUVW = vg.SizeUVW; // class: needs deep copy Grid = new BitArray(vg.Grid.Count); for (var i = 0; i < vg.Grid.Count; i++) { Grid[i] = vg.Grid[i]; } }