Hi All,Need urgent help. have a point with x,y value and i want to check when this point will touch the line in the line graph.
need to write the code to get to the point where the point is on the line graph. line graph has a list of points.
something line for the point i see the distance with the list of points and if the distance is <0.01 means the point is just on line.
my point is
0.89853, 0.50803
and from the list of points i should check which point is same to this point so this point falls on the line chart.
list of data making a line chart is below
0.21395 0.9891
0.42811 0.9577
0.89853 0.50803
0.64249 0.91112
0.68539 0.90055
0.7283 0.88969
0.77122 0.87858
0.81415 0.86727
0.85708 0.85579
0.90003 0.8442
0.94298 0.83253
0.98594 0.82081
1.01483 0.81112
1.046 0.80147
1.06682 0.79364
1.07728 0.78749
1.08568 0.7817
1.08993 0.77638
1.09418 0.77103
1.10509 0.74458
1.1095 0.72748
1.1095 0
1.1095 0.72747
What I have tried:
i am trying the code like to find the distance
private bool CheckPointStatus(ObservableCollection<tmpRunModel> _finalrunModelList, double KR_Fracture, double LR)
{
List<tmpRunModel> objinlist = _finalrunModelList.Where(item => item.Lr > LR && item.Kr > KR_Fracture).ToList();
bool flag = false;
if (objinlist != null && objinlist.Count > 0)
{
foreach (var item in objinlist)
{
var x1 = LR;
var y1 = KR_Fracture;
var y2 = item.Kr;
var x2 = item.Lr;
var d = Math.Pow(Math.Pow(x2 - x1, 2) + Math.Pow(y2 - y1, 2), 0.5);
_lst_distance.Add(d);
if (d < 0.05)
{
flag = true;
break;
}
}
}
return flag;
}