Jump to content
  • Advertisement
Sign in to follow this  

D3Dprimitive and line width

This topic is 5085 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

I'm searching for a solution, not cpu intensive (no cos or sin if feasible) to draw lines with a width, can someone point me on something?

Share this post

Link to post
Share on other sites
Original post by athena
its only for Dx 9 it seems, any solution for Dx8 ?

No, you'll have to write it yourself. Off the top of my head (i.e. watch out!):
You should join the 2 endpoints using a quad with the required width. Given 2 2D endpoints, e1 and e2:
1) Let n be the perpendicular to the 2D line. n = normalize(<-(e1.y - e2.y), e1.x - e2.x>)
2) Let hw (half-width) = 0.5 * width
3) Let the 4 corners be c11, c12 (around e1), c21 and c22 (around e2). You can calculate them as follows:
c11 = e1 + hw * n;
c12 = e1 - hw * n;
c21 = e2 + hw * n;
c22 = e2 - hw * n;
4) Create a quad (using 2 triangles) with the given 4 corners

[edit]A couple of corrections[/edit]

[Edited by - Coder on December 17, 2004 11:08:25 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!