mercredi 31 mai 2017

Algorithm - How to draw a non-perfect diagonal in a pixelated space?

I'm programming this for my class

enter image description here

Is a group of squares and I need to paint its with different shapes.

But I don't know how to draw a diagonal just by passing 2 coordinates (x1,y1)(x2,y2)

Does anybody know an algorithm/pseudo-code for this?

P.S. I'm using typescript

Aucun commentaire:

Enregistrer un commentaire