Jump to content
  • Advertisement
Sign in to follow this  

Projected line size in pixels

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

Ok, if I have a 3D vertical (Y-axis parallel) segment, and I want to discover its projected size in pixels, how can I do that in Direct3D? The problem is that we need to consider viewport size and projection matrix.

Share this post


Link to post
Share on other sites
Advertisement
Easiest way would be to use D3DXVec3Project on the end points and find the length of the resulting vector.

edit: Just to clarify, the length in screenspace should be within one pixel of the length in pixels. If you mean the actual number of pixels that make up that line, that is trickier. I suppose you could project the two line endpoints, then simulate drawing it with bresenhams or some such and count the number of pixels it would have plotted.

[Edited by - Kibble on September 21, 2004 2:34:50 AM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!