本文整理汇总了C#中System.Windows.Media.PointCollection.AddPoint方法的典型用法代码示例。如果您正苦于以下问题:C# PointCollection.AddPoint方法的具体用法?C# PointCollection.AddPoint怎么用?C# PointCollection.AddPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.PointCollection
的用法示例。
在下文中一共展示了PointCollection.AddPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: approximater
/* takes recent n points,
* proceeds to get approximated coordinate where the finger was heading to.*/
private PointCollection approximater()
{
// Find objects near these estimated points.
IHTMLDocument2 webdoc = (IHTMLDocument2)webBrowser1.Document;
double run = 0.0;
double prev_x = 0.0;
double avg_x = 0.0;
double rise = 0.0;
double prev_y = 0.0;
double avg_y = 0.0;
PointCollection recent_points = new PointCollection();
Console.WriteLine("Gather recent points");
// add the points into pointcollection
foreach (Point p in coord_pack_Q.ToList())
{
recent_points.AddPoint(p);
}
Point centroid1 = new Point(0.0, 0.0);
Point centroid2 = new Point(0.0, 0.0);
if (coord_pack_Q.Count > 40)
{
Console.WriteLine("Do Clustering");
// Get clusters.
List<PointCollection> allclusters = Clustering.doClustering(recent_points, 2);
centroid1 = allclusters[0].Centroid;
centroid2 = allclusters[1].Centroid;
get_around(webdoc, (int)centroid1.X, (int)centroid1.Y);
Console.WriteLine("get around centroid1 at:" + centroid1.X.ToString() + "," + centroid1.Y.ToString());
get_around(webdoc, (int)centroid2.X, (int)centroid2.Y);
Console.WriteLine("get around centroid2 at:" + centroid2.X.ToString() + "," + centroid2.Y.ToString());
}
//Console.WriteLine("find linear estimation");
// Find average growth rate from list.
// This is for linear movement.
/*
foreach (Point cord in coord_pack_Q.ToList())
{
run = cord.X - prev_x;
prev_x = cord.X;
avg_x = (avg_x + run);
rise = cord.Y - prev_y;
prev_y = cord.Y;
avg_y = (avg_y + rise);
}
avg_x = avg_x / coord_pack_Q.Count();
avg_y = avg_y / coord_pack_Q.Count();
Point estimate = new Point(avg_x, avg_y);
get_around(webdoc, (int)(estimate.X), (int)(estimate.Y));
Console.WriteLine("get around linear estimation point at:" + estimate.X.ToString() + "," + estimate.Y.ToString());
*/
PointCollection near_points = new PointCollection();
//near_points.AddPoint(estimate);
near_points.AddPoint(centroid1);
near_points.AddPoint(centroid2);
return near_points;
}