irony of new location
16-Nov-94 05:41:13
Sb: #916-irony of new location
Fm: Nils Pipenbrinck 100121,2450
To: Christopher S. Young 70031,2154
Hi Chris,
I worked on a small polygon engine.. Drawing triangles is fast.. but if you
draw two treangles to simulate a 4-n-polygon (4-sided) it's of cause faster to
use the 4-n-polygon code.. Why? Simple answer:
+
| \
| \ This is our triangle.. We have to calculate 3 lines
| \
| \
+———+
+———+
| \\ |
| \\ | This is our square.. If we have a simple triangle-algorithm we
| \\ | have to calculate the diagonal line twice which is of cause
| \\| slower than calculating only the 4 border-sides.
+———+
By the way, if you store the coordinates of the lines in a buffer and you
write a subroutine to calculete the coordinates it's no problem to write a
3-sided poligon (3 linegeneation calls) and a 4-sided poligon
(4 linegeneration calls). The rest (drawing the pixels, clipping ect. is the
same code… you can do it with define-instructions..
I hope this helped to use 3 and 4-sided polys (maybe you can add 6-sided..
they are rarely needed, but you can build nice geometric objects out of them,
and
they are of cause many times faster than simulating a 6-sided poly with 6
triangles.
Regards,
Nils