Muhammad_mhs's blog

By Muhammad_mhs, history, 5 years ago, In English

In this problem the number of integer points on a segment is gcd(x,y)+1. where x = abs(x1-x2) and y = abs(y1-y2). But why it does? Anyone please explain it. Thanks in advance.

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
5 years ago, # |
  Vote: I like it +1 Vote: I do not like it

you can find answer whit this formula. sqrt((x2-x1)^2+(Y2-Y1)^2)/(max(tg a, ctg a)) where a is angel betveen segment and x axis