本文整理汇总了C#中Point.Last方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Last方法的具体用法?C# Point.Last怎么用?C# Point.Last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point.Last方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Optimize
public Directions Optimize(Point[] points)
{
DBC.Assert(points.Length > 1, "Unable to optimize a route with less than 2 points.");
Log(points);
if (IsSingleRouteDirections(points)) return BuildSingleRouteDirections(points);
var graph = new DirectedGraph(points);
var graphNavigator = new GraphNavigator(graph, points.First(), points.Last(), roadPathService);
IList<Directions> cycles = graphNavigator.GetCycles();
stitchingService = new StitchingService(cycles, graph);
var stitched = stitchingService.Stitch();
stitched.Order(points.First(), points.Last());
return stitched;
}
示例2: GetRamerSampledPoints_NonRecursive
/// <summary>
/// Get ramer-sampled points without using recursive function. Call "ClearCache" function for recalculation
/// </summary>
/// <param name="dthres"></param>
/// <returns></returns>
public Point[] GetRamerSampledPoints_NonRecursive(double dthres)
{
if (this.ramerSampledPoints == null)
{
Point[] points = new Point[this.Points.Count];
for (int i = 0, ilen = this.Points.Count; i < ilen; i++)
{
points[i] = this.Points[i].PointObject;
}
List<Point> sampledPoints = new List<Point>();
sampledPoints.Add(points[0]);
sampledPoints.Add(points.Last());
Queue<int[]> q = new Queue<int[]>();
q.Enqueue(new int[] {0, points.Length - 1});
while (q.Count != 0)
{
double dmax = 0.0;
int max_index = 0;
int[] range = q.Dequeue();
for (int i = range[0] + 1; i < range[1]; i++)
{
double d = CommonFunction.PerpendicularDistance(points[i], points[range[0]], points[range[1]]);
if (dmax < d)
{
dmax = d;
max_index = i;
}
}
if (dthres < dmax)
{
sampledPoints.Add(points[max_index]);
q.Enqueue(new int[] { range[0], max_index });
q.Enqueue(new int[] { max_index, range[1] });
}
}
this.ramerSampledPoints = sampledPoints.ToArray();
}
return this.ramerSampledPoints;
}
示例3: GetClickedPoint
/// <summary>
/// Gets the point where NotifyIcon is clicked by the position of ContextMenuStrip and NotifyIcon.
/// </summary>
/// <returns>Cursor location</returns>
/// <remarks>MouseEventArgs.Location property of MouseClick event does not contain data.</remarks>
private Point GetClickedPoint()
{
var contextMenuStrip = _notifyIcon.ContextMenuStrip;
var corners = new Point[]
{
//new Point(contextMenuStrip.Left, contextMenuStrip.Top),
//new Point(contextMenuStrip.Right, contextMenuStrip.Top),
new Point(contextMenuStrip.Left, contextMenuStrip.Bottom),
new Point(contextMenuStrip.Right, contextMenuStrip.Bottom)
};
var notifyIconRect = WindowPosition.GetNotifyIconRect(_notifyIcon);
if (notifyIconRect != Rect.Empty)
{
foreach (var corner in corners)
{
if (notifyIconRect.Contains(corner))
return corner;
}
}
return corners.Last(); // Fallback
}