I need to resolve this by using the least amount of calculation possible using C#.
I have the points (x0, y0); (y1, y1); (x2, y2): (x1, y1); (x2, y2) define a line, but is an segment "S". and (x0, y0) is an isolated point, and the distance "d" shorter segment is a segment perpendicular, which has a distance "d".
I have calculated "d" using this formula http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html and also calculated the value of "r" using "Distance between two points".
public static Double GetDistance(Point sourcePoint, Point destinyPoint)
{
Double horizontalDistance = (destinyPoint.X - sourcePoint.X);
Double verticalDistance = (destinyPoint.Y - sourcePoint.Y);
Double distance = System.Math.Sqrt((horizontalDistance * horizontalDistance) + (verticalDistance * verticalDistance));
return distance;
}
Actually I need to find the coordinates of the red dot.