Advertisement

Simple Line algorithm in C or C++

Started by February 10, 2000 08:20 PM
1 comment, last by SikCiv 25 years, 1 month ago
Anyone have the code to plot a straight line from one point to another? (C or C++ only please). I had the code, but I lost it )- Doh. The function looked like this.. Line(x1,y1,x2,y2,unsigned char *array, WORD horzarraysize, BYTE color); And it would plot a line from x1:y1 to x2:y2 to the array in the given color. I need it for some collision detection in my game. ThAnkxsz. http://www.gamedev.net/community/forums/icons/icon7.gif

  Downloads:  ZeroOne Realm

Do a search for ''Bresenham''s line algorithm'' on e.g. Google.
Advertisement
You can also take a look at this article, written by Hin Jang:

Digital Line Drawing

This topic is closed to new replies.

Advertisement