本文整理汇总了C#中Region.Volume方法的典型用法代码示例。如果您正苦于以下问题:C# Region.Volume方法的具体用法?C# Region.Volume怎么用?C# Region.Volume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region.Volume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getRegions
//private Regions regions;
private List<Region> getRegions()
{
List<Region> regions = new List<Region>();
// find candidate locations by trilateration on all combinations of the input distances
// expand candidate locations to regions, combining as necessary
for (int i1 = 0; i1 < this.entries.Count; i1++)
{
for (int i2 = i1 + 1; i2 < this.entries.Count; i2++)
{
for (int i3 = i2 + 1; i3 < this.entries.Count; i3++)
{
Candidate[] candidates = getCandidates(this.entries.ToArray(), i1, i2, i3);
//candidates.forEach(function(candidate)
foreach (Candidate candidate in candidates)
{
var r = new Region(candidate);
// see if there is existing region we can merge this new one into
for (var j = 0; j < regions.Count; j++)
{
Region u = r.union(regions[j]);
if (u.Volume() < r.Volume() + regions[j].Volume())
{
// volume of union is less than volume of individual regions so merge them
regions[j] = u;
// TODO should really rescan regions to see if there are other existing regions that can be merged into this
r = null; // clear r so we know not to add it
break;
}
}
if (r != null)
{
regions.Add(r);
}
}
}
}
}
// console.log("Candidate regions:");
// $.each(regions, function() {
// console.log(this.toString());
// });
return regions;
}