本文整理汇总了C#中Procedurality.Channel.findMax方法的典型用法代码示例。如果您正苦于以下问题:C# Channel.findMax方法的具体用法?C# Channel.findMax怎么用?C# Channel.findMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Procedurality.Channel
的用法示例。
在下文中一共展示了Channel.findMax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CratersAlgo
public static Channel CratersAlgo(int sizeX, int sizeY, int numCraters, int seed)
{
Channel chan = new Channel(sizeX, sizeY);
Console.WriteLine();
Random rand = new Random(seed);
for (int i = 0; i < numCraters; )
{
int x = rand.Next(0, sizeX);
int y = rand.Next(0, sizeY);
double radius = (rand.NextDouble() * 84.0) - 20;
// Clamp
//x=(x<0) ? 0 : ((x>size-1) ? size-1 : x);
//x=(y<0) ? 0 : ((y>size-1) ? size-1 : y);
//radius=(radius<20.0) ? 20.0 : ((radius>84.0) ? 84.0 : radius);
Channel crater = (new Crater(sizeX, sizeY, x, y, radius)).toChannel();
if (crater.findMax() != 1.0)
{
continue;
}
//if(crater.findMin()!=0.0)
//{
// Console.Write("!");
// continue;
//}
i++;
drawTextProgressBar(i, numCraters);
//crater.toLayer().saveAsPNG("../sims/crater_debug.png");
chan.channelAdd(crater.normalize(-0.01f, 0.01f));
}
chan.normalize();
Console.WriteLine("\nRange [{0},{1}]", chan.findMin(), chan.findMax());
return chan;
}
示例2: HillsAlgo
public static Channel HillsAlgo(int sizeX, int sizeY, int numHills, int seed)
{
Console.WriteLine();
Channel chan = new Channel(sizeX, sizeY);
Random rand = new Random(seed);
for (int i = 0; i < numHills; )
{
int x = rand.Next(0, sizeX);
int y = rand.Next(0, sizeY);
double radius = ((rand.NextDouble() * 84.0) - 20);
Channel crater = (new Hill(sizeX, sizeY, x, y, (float)radius)).toChannel();
if (crater.findMax() != 1.0)
{
continue;
}
i++;
drawTextProgressBar(i, numHills);
//crater.toLayer().saveAsPNG("../sims/crater_debug.png");
chan.channelAdd(crater.normalize(0f, 0.01f));
}
chan.normalize();
Console.WriteLine("\nRange [{0},{1}]", chan.findMin(), chan.findMax());
return chan;
}