本文整理汇总了C#中System.Point.Inside方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Inside方法的具体用法?C# Point.Inside怎么用?C# Point.Inside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Point
的用法示例。
在下文中一共展示了Point.Inside方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecursiveApply
private void RecursiveApply(int[] tracker, int[] voronoi, int idx, Point p, int width, int height)
{
int ox = this.EdgeSampling;
int oy = this.EdgeSampling;
int rw = width + this.EdgeSampling * 2;
int rh = height + this.EdgeSampling * 2;
if (p.Inside(-ox, -oy, rw, rh) && voronoi[(p.X + ox) + (p.Y + oy) * rw] != 2 /* edge */ && tracker[(p.X + ox) + (p.Y + oy) * rw] == 0 /* not hit */)
tracker[(p.X + ox) + (p.Y + oy) * rw] = idx + MAPPING_OFFSET;
else
return;
this.RecursiveApply(tracker, voronoi, idx, p.Left, width, height);
this.RecursiveApply(tracker, voronoi, idx, p.Right, width, height);
this.RecursiveApply(tracker, voronoi, idx, p.Up, width, height);
this.RecursiveApply(tracker, voronoi, idx, p.Down, width, height);
}
示例2: FindValueNearOpposite
private int FindValueNearOpposite(int[] tracker, int[] data, int x, int y, int i, int j, int width, int height)
{
Point p = new Point(i, j);
int ox = this.EdgeSampling;
int oy = this.EdgeSampling;
int rw = width + this.EdgeSampling * 2;
int rh = height + this.EdgeSampling * 2;
if (p.Inside(width, height) && tracker[(i + ox) + (j + oy) * rw] != 0)
return data[i + j * width];
Random r = this.GetCellRNG(x + i, y + j);
if (p.Right.Inside(width, height) && (p.Down.Inside(width, height) || r.Next(2) == 0))
return this.FindValueNearOpposite(tracker, data, x, y, i + 1, j, width, height);
else if (p.Down.Inside(width, height))
return this.FindValueNearOpposite(tracker, data, x, y, i, j + 1, width, height);
return 0;
}