Slope Formula

vckicks 0 Tallied Votes 149 Views Share

Calculate the slope between two points.

private static double GetSlope(PointF point1, PointF point2)
{
    //slope is delta-y/delta-x
    double deltaX = (double)(point2.X - point1.X);
    double deltaY = (double)(point2.Y - point1.Y);

    return deltaY / deltaX;
}