本文整理匯總了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;
}