本文整理匯總了C#中System.Point.Where方法的典型用法代碼示例。如果您正苦於以下問題:C# Point.Where方法的具體用法?C# Point.Where怎麽用?C# Point.Where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Point
的用法示例。
在下文中一共展示了Point.Where方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ExtendEdges
bool ExtendEdges(Point p)
{
// Point p is on director vector of edge e, and we extend e to include p.
List<Edge> extended = new List<Edge>();
foreach (Edge e in edges)
if (p.OnLine(e.P1, e.P2) && p != e.P1 && p != e.P2)
{
int where = p.Where(e.P1, e.P2);
if (where == 1 && p.DistanceTo(e.P1) < Epsilon)
{
e.P1 = p;
extended.Add(e);
}
if (where == 2 && p.DistanceTo(e.P2) < Epsilon)
{
e.P2 = p;
extended.Add(e);
}
}
if (extended.Count == 0) return false;
// We try to link 2 extended edges to p to form a single edge.
Point P1, P2;
for (int i = 0; i < extended.Count; i++)
if (extended[i] != null)
{
if (extended[i].P1 == p) P1 = extended[i].P2;
else P1 = extended[i].P1;
for (int j = i + 1; j < extended.Count; j++)
if (extended[j] != null)
{
if (extended[j].P1 == p) P2 = extended[j].P2;
else P2 = extended[j].P1;
if (p.OnLine(P1, P2))
{
// This works because extended[i] is a pointer!
extended[i].P1 = P1;
extended[i].P2 = P2;
edges.Remove(extended[j]);
extended[j] = null;
break;
}
}
}
return true;
}