#### Archived

This topic is now archived and is closed to further replies.

# 2D Thick Line Algorithm

This topic is 5880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Thick Line Drawing Algorithm I was working on a clone of Bust A Move and just had to change the targeting arrow from the GDI to something a bit faster. It worked nicely with the GDI using a 7 pixel thick line: I couldn’t find an algorithm to draw thick lines and couldn’t think of one myself that would allow me to end the line with a point, so I just drew seven lines next to each other with Bresenham’s algorithm. I did the code for the centre line and started it up and it looked fine: Then I rotated it and…oh dear: I think the gaps are to do with rounding when the line is rotated. I think the way I’ve implemented it is rather poor. Does anyone know where I can find an algorithm for drawing thick lines of a specified width? I’d be very grateful for any help you can offer. [edited by - plague1392 on August 18, 2002 4:17:36 PM]

##### Share on other sites
Can''t you just draw a quad and or two triangles or more?

##### Share on other sites
That was my backup plan I just think a thick line algorithm would be useful to know in the future, but I can''t seem to find one anywhere.

##### Share on other sites
Rotate a sprite of the arrow, or a textured quad if you''re in 3D.

------------
- outRider -

##### Share on other sites
Do it as a simplified form of polyfiller. That''s about the only way I can think of that solves the edge problem. I tried to code several thick-line routines over the years, but always failed to come up with a general rule of how the edges should be. If you had a good polyfiller, you could make a wrapper for each type of line edges you want.

##### Share on other sites
Hmm... I also need a good thick line drawing algorithm. Anyone know a good reference? I STFW''ed but didnt find much.

##### Share on other sites
Back in qbasic, I wrote a routine to draw a thick line pixel by pixel. It basically just a simple quad filler. You''ll have to calculate the min x and max x for each row of pixels in the quad, then draw horizontal lines between the points. Basically a simple quad filler.

##### Share on other sites
lol
just use a bitmap with all the rotating frame.
it''s an animation of the rotation, not a calculation.
do you understand ??
i know that in bust a move, the rotating arrow is from 0 to Pi.
so store the rotating arrow animation from 0 to Pi step Angle and draw the corespondant frame.

##### Share on other sites
I sorted it out last night, but I'm still very interested if anyone does have a link to an algorithm for drawing thick lines.

I probably shouldn't have asked the question specific to a problem because I could think of a number of ways to solve the specific problem, and was really just after the thick line drawing algorithm rather than suggested solutions. I mainly described the problem to show I had taken a shot at it myself and hadn't just come and posted here without trying myself first.

Anyway, thanks to everyone for putting the effort in to try and help me (well, everyone but the guy directly above). It's very much appreciated.

[edited by - plague1392 on August 19, 2002 9:26:37 AM]

1. 1
2. 2
3. 3
Rutin
16
4. 4
JoeJ
13
5. 5

• 10
• 9
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632646
• Total Posts
3007637
• ### Who's Online (See full list)

There are no registered users currently online

×