Jump to content
  • Advertisement

Archived

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

Plague1392

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!