Sign in to follow this  

D3Dprimitive and line width

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

Quote:
Original post by athena
thanks,
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

This topic is 4744 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this