I need an algorithm to find equation of a line without using division.
Given a line by two points on it, with coordinates: $(x_1, y_1),\ (x_2, y_2)$.
We can simply get the line equation by the formula:
$$y=y_1+(y_2−y_1)((x−x_1) / (x_2−x_1))$$
But I want to do that without using division. I want to find $y(x_0)$ for the specific $x_0$ value $(x_1<x_0<x_2)$.
Thanks in advance.
If you parameterize the line as $L(t)=(tx_{2}+(1-t)x_{1},ty_{2}+(1-t)y_{1})$, then if you take $x_{0}$ the $t^{*}$ such that $L(t^{*})=(x_{0},y_{0})$ is given by $t^{*}=\frac{x_{0}-x_{1}}{x_{2}-x_{1}}$. Note that $c=\frac{1}{x_{2}-x_{1}}$ is known from the outset, therefore $y_{0}(x_{0})=c*(x_{0}-x_{1})*y_{2}+(1-c*(x_{0}-x_{1}))y_{1}$. I am not sure how exactly you define "not using division" but if computing a known constant $c$ at the start of the algorithm is not a problem then this works.