コード例 #1
0
 private int GetVolume(GenerationRegion region)
 {
     return region.Width * region.Height * region.Depth;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public RegionCompleteEventArgs(GenerationRegion region)
 {
     this.Region = region;
 }