Back to #amycoders Homepage


The mission

After the gouraud-compo has been a big dissapointment this time a smaller competition. To be more accurate its a two-competition-in-one package :) The aim is to optimize a routine drawing a line into a chunky buffer by lengths and by size. So there will also be two charts - one for the fastest and one for the shortest. You may contribute with different routines in both compos.

The deadline was sunday, september 21st, 1997 In case you are still interested in the full compo rules & source :download here.

Again many thanks to Flynn for preparing the great init-source and screenhandler. It was changed a little to suit the linedrawing-compos needs.


  • The size of the buffer is 256x256, with a color depth of 256.
  • Your lineroutine has to accept following input:

    • D0.w/D1.w: X1/Y1
    • D2.w/D3.w: X2/Y2
    • D4.b: color (this must be implemented!)
    • A0: Pointer to chunky buffer.

    • The other registers are in undefined state. (Your routine will be disqualified, if it is using input from any other register, than the mentioned ones)

  • All registers may be trashed, except a7.
  • The line has to be closed. (no gaps)
  • The line has to have a width of 1. (no 2 pixel wide lines in 45 degree cases)
  • The line must hit both, start- and endpoint exactly.
  • The routine must be working on 68020-68060! When you are sick enough to use selfmodifying code, make sure that it does also work on 040/060.
Well - please download the competition package for more detailed rules.

Results: (shortest lineroutine)

This competition was quite a success compared to the gouraud-one. 9 People sent 10 contributions. Unfortunately most poeple didnt take care of the rules very much this time. The four shortest routines produce very inaccurate lines, which is a rule violation. Well - I accepted it since such a majority of routines had this "feature". ACT and Stelios did the shortest lineroutines really matching all rules. (using bresenham). Funny enough both the shortest routines using x/y interpolation and the shortest routines using bresenham have the same length. So we don't have any clear winner in this competition.

Detailed Results:

Place Handle Algorithm Length:
1. Piru x/y interpolation *1 30
2. Joseph x/y interpolation *1,*2 30
3. Sp & Brekke x/y interpolation *1 32
4. Chauple x/y interpolation *1 34
5. Dave x/y interpolation *1,*2 34
6. Act Bresenham 60
Stelios Bresenham 60
8. Trevor Interpolation along axis 62
9. Piru (second entry) Bresenham 64
10. Shin (joke entry) Bresenham 198

*1 Line is very inaccurate
*2 longword coordinates are required, Daves and Josephs entrie were moved down a place due to this

Results: (fastest lineroutine)

This compo went pretty nice. All rules were matching the competition rules, all routines worked and we have a clear result. Not much more to say about this, except I think that these routines could be a bit faster. All routines are writing byte- whise. Why did noone do a lineroutine plotting multiple pixels at once ? (move.l for horizontal lines, 4x move.b for vertical ones for example)

Detailed Results:

Place Handle Algorithm Speed
1. Piru Bresenham 134
2. Sniper Bresenham 142
3. Dave Bresenham 144
4. Stelios Bresenham 152
5. Act Bresenham 159
6. Shin (joke entry) Bresenham 187


Well - no further comments about the code here. Just download the competition entries here Please remember that, even if you can download these routines, they are still not public domain. Ask before using any of these routines, or give credits at least.

Last change: 16.01.2001