Answer the question
In order to leave comments, you need to log in
How to define a line graph function?
In general, when developing a game, I often come across such a stupid question, apparently it’s worth finding the answer once and for all.
There are two numbers. X and Y.
X is always known. I need to find Y.
I know the limits of the values, i.e.:
if X = 0.5 then Y should be equal to -85
if X = 0.75 then Y should be equal to 0
X will always be only between 0.5 and 0.75 and I need a linear way get the value of Y knowing the boundaries (at what minimum and maximum values what will be Y).
Help me please)
Answer the question
In order to leave comments, you need to log in
Does a programmer need mathematics? Of course not, damn it.
(x-x1)/(x2-x1) = (y-y1)/(y2-y1)
(x-0.5)/(0.75-05) = (y+85)/(0+85)
y(x) = 340x - 255
m.wolframalpha.com/input/?i=%28x-0.5%29%2F%280.75-...
the coordinates of any arbitrary point (X;Y) belonging to a straight line passing through 2 already known points (X1;Y1) and (X2;Y2) are connected by the formula
(Y-Y1)*(X2-X1)=(X-X1)* (Y2-Y1)
if of course the case is non-degenerate
We take the free GeoGebra program . We launch. In the line below, enter the first point:
This point appears on the chart, but it is not immediately visible - it is far below. Therefore, we zoom back so that point A becomes visible. Enter the second point:
Both points are now visible on the chart. Now we need to draw a line through them. In the palette of lines, select the icon of the line-through-two points:
and click once on each - the line a and its equation appear:
Which can be brought to the form y = ax + b by right-clicking the mouse:y = 340x - 255
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question