John merc
John merc

Reputation: 1

Function in haskell that gets every point on a Line given by two points

So i have been stuck on this for a while now, I would like to make a function that gets every point on a line and excludes all the other points, given two points, given that a point is defined as (Int , Int) Thank you

Upvotes: 0

Views: 331

Answers (1)

Probie
Probie

Reputation: 1361

Bresenham's Algorithm is probably the algorithm you want to use. There's an implementation of it on the Haskell wiki, although if you're learning Haskell it might be a good idea to try writing it yourself.

Upvotes: 1

Related Questions