本文整理汇总了C#中System.Drawing.PointF.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# PointF.Skip方法的具体用法?C# PointF.Skip怎么用?C# PointF.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.PointF
的用法示例。
在下文中一共展示了PointF.Skip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsInPolygon
private static bool IsInPolygon(PointF[] poly, PointF point)
{
var coef = poly.Skip(1).Select((p, i) =>
(point.Y - poly[i].Y) * (p.X - poly[i].X)
- (point.X - poly[i].X) * (p.Y - poly[i].Y))
.ToList();
if (coef.Any(p => p == 0))
return true;
for (int i = 1; i < coef.Count(); i++)
{
if (coef[i] * coef[i - 1] < 0)
return false;
}
return true;
}
示例2: DrawSegments
public void DrawSegments(PointF[] Stroke)
{
if (RenderMethod == RenderMode.Standard)
{
// Ensure that surface is visible
if (!this.Visible)
{
this.TopMost = true;
this.Show();
}
// Create list of points that are new this draw
List<PointF> NewPoints = new List<PointF>();
// Get number of points added since last draw including last point of last stroke and add new points to new points list
int iDelta = Stroke.Count() - LastStroke.Count() + 1;
NewPoints.AddRange(Stroke.Skip(Stroke.Count() - iDelta).Take(iDelta));
// Draw new line segments to main drawing surface
SurfaceGraphics.DrawLines(DrawingPen, NewPoints.Select(p => TranslatePoint(p)).ToArray());
// Set last stroke to copy of current stroke
// ToList method creates value copy of stroke list and assigns it to last stroke
LastStroke = Stroke.ToList();
}
else
{
foreach (CompatibilitySurface surface in CompatibilitySurfaces)
surface.SurfaceGraphics.DrawLines(DrawingPen, surface.OffsetPoints(Stroke));
}
}
示例3: Properize
public static PointF[] Properize(PointF[] points, Size pattern)
{
var res = new PointF[points.Length];
var hs = new int[pattern.Height];
for (var i = 0; i < pattern.Height; i++) hs[i] = i;
var heighted = hs.Select(h => points.Skip(h * pattern.Width).Take(pattern.Width).OrderBy(p => p.X).ToArray())
.OrderBy(r => r.OrderBy(p => p.X).Select(p => p.Y).First()).ToArray();
for (var y = 0; y < pattern.Height; y++)
{
for (var x = 0; x < pattern.Width; x++)
res[x + y * pattern.Width] = heighted[y][x];
}
return res;
}