Sign in to follow this  
raydog

Fixed-length axis on screen?

Recommended Posts

How can I draw a fixed-length axis in 3D? So, if I zoom the view in/out, the local axis should relatively remain the same length on the screen. I'm trying to project the axis points from 3D to 2D, then render the axis in 2D, but, I'm having a little trouble afterwards, especially when looking at the axis from straight on. The axis lines start to jump around.

Share this post


Link to post
Share on other sites
Project the start point from 3d to 2d.

Store the projected point, create a second point with the length you want to have when done.

Project the second point from 2d to 3d.

Draw the axis.

Share this post


Link to post
Share on other sites
Sorry, I don't understand? Why are you going back to 3D for the second point? In my first post, I don't mean I have to draw it in 3D. I can draw it in 2D or 3D. It just has to seem as if it exists in 3D.

Where does the second point come from?

Share this post


Link to post
Share on other sites
You can't go from 2d to 3d because you've lost your depth. Those coords would be useless to me.

Can someone post some pseudo code on how to draw a fixed-length orthonormal axis, independent of zoom?

Share this post


Link to post
Share on other sites
The second point comes from the 2d calculation. You take your first 2d point, add the wanted length in the wanted direction.

You still have your depth. Usually it will be inside .z, mapped between 0.0 and 1.0. Just use the same value when mapping back.


If it's ok to paint in 2d, then it's even easier. Just project to 2d and you're done.

Maybe the jumping is from some rounding errors?

Share this post


Link to post
Share on other sites
Quote:

The second point comes from the 2d calculation. You take your first 2d point, add the wanted length in the wanted direction.


This doesn't work. My axis lines jump around because 2D has no depth. I should be able to rotate the view
so I can look down on an axis, so you will only see a point. Always drawing an axis at a fixed length in 2D won't work.

How to solve this problem, I don't know.

Share this post


Link to post
Share on other sites

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