# 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.

## 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?

ID3DXLine!

##### Share on other sites
thanks,
its only for Dx 9 it seems, any solution for Dx8 ?

##### Share on other sites
Quote:
 Original post by athenathanks,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

A couple of corrections[/edit]

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

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• ### Forum Statistics

• Total Topics
633377
• Total Posts
3011565
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!