Super silly question :|


#1

Hi everyone!

I’m in the middle of the selected line code, and I don’t get the following code:

float x = start.x + t * (end.x - start.x); float y = start.y + t * (end.y - start.y);

The part I don’t get is why the x coordinate plus the little approaches defined by the cycle are multiplied by the line length…

Can anyone slap my bald head and explain it to me please? :blush:


#2

We’re finding some random points on a line like below to find out if the input point is on or near the line. For example, if start is 0 and length is 100, the points would be 0, 5, 10, …, 95, 100.

start + (0/20 * length)
start + (1/20 * length)
start + (2/20 * length)
… …
start + (20/20 * length)


#3

Ohhh!!

Thank you so much sunny4s!!! I knew it was so simple but didn’t get it…

Again, thanks a lot :wink: