Slope Formula

vckicks 0 Tallied Votes 152 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;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.