Sign in to follow this  

plot circle

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

Hi all, I'm plotting points in 3d space to create a circle (looks like a wireframe disc). I have a small piece of code to do this. I'd like to now be able to figure out if a user click in my viewport intersects with the edge of my circle. I guess I need to test if the clicked point intersects the *function* of my circle. Is there any formula for seeing if a point is on the edge of a circle? This is the only way I could see this working efficiently. How could I take into account a rotation of a circle introduced by the user? I am currently plotting the circle with no rotation around the origin. If the user rotates the circle 20 degrees or some #, is it possible to take that into account as well? Thanks

Share this post


Link to post
Share on other sites
I assume you're projecting the points of the circle, and want to click on the projected circle? In the case of not drawing it at the origin, even a flat facing circle will take on the effects of perspective projection, and will not be perfectly circular (in the 3D sense).

However, if it's going to stay at the origin then you can project a ray onto the circle's plane, and then measure the radius of the circle vs the distance of your hit point from the centre.

If I assume that you may rotate the circle any amounts via the x, y, and z axes, or that it is not always at the origin, then it become extremely difficult to do it that way. In this case you could create lots of little quads (not drawn, just for hit testing), one to cover each line segment, then do a ray poly hit test on them all. You'd probably want to billboard the quads too.

Share this post


Link to post
Share on other sites
Ahh I see, so each line segment that connects my projected points (that form the edge of the circle) can be a polygon, then I can hit test the individual polys. I like that, it sounds good.

I'll give it a try, thanks!

Share this post


Link to post
Share on other sites

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