algorithms.tutorialhorizon.com

Given two coordinates, print the line equation | Algorithms

Given two coordinates (x1, y1) and (x2, y2). Write a java program to construct a line equation that passes through the given coordinates. Line Equation: Given two coordinates (x1, y1) and (x2, y2) the line equation is y - y1 = m(x - x1) where m is the slope of the line, where slope = (y2-y1)/(x2-x1) Example: Given coordinates: [3,7] and [5,11] Line Equation: y = 2x + 1