private int GetVolume(GenerationRegion region) { return region.Width * region.Height * region.Depth; }
private GenerationRegion CombinedRegion(GenerationRegion regionA, GenerationRegion regionB) { var combined = new GenerationRegion(); combined.X = Math.Min(regionA.X, regionB.X); combined.Y = Math.Min(regionA.Y, regionB.Y); combined.Z = Math.Min(regionA.Z, regionB.Z); combined.Width = (int)(Math.Max(regionA.X + regionA.Width, regionB.X + regionB.Width) - combined.X); combined.Height = (int)(Math.Max(regionA.Y + regionA.Height, regionB.Y + regionB.Height) - combined.Y); combined.Depth = (int)(Math.Max(regionA.Z + regionA.Depth, regionB.Z + regionB.Depth) - combined.Z); return combined; }
private float GetSavingsRatio(GenerationRegion regionA, GenerationRegion regionB) { var volumeA = this.GetVolume(regionA); var volumeB = this.GetVolume(regionB); var regionC = this.CombinedRegion(regionA, regionB); var volumeC = this.GetVolume(regionC); return (volumeA + volumeB) / (float)volumeC; }
public RegionCompleteEventArgs(GenerationRegion region) { this.Region = region; }