# plot circle

This topic is 4671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633288
• Total Posts
3011219
• ### Who's Online (See full list)

There are no registered users currently online

×