Sign in to follow this  

Visible part of a circle

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

Well I have the following issue: I have a circle this circle that need to be rendered but, I require to render only the visible part of it. The circle is actually the surface of a 2D planet and the render function is a divide_et_impera algorithm so I have the capability to zoom in and zoom out and have LOD within this circle. The function gets two parameters, the angle of start and the angle of stop, as a arch or slice of the circle. I've tried several methods like line-circle intersection or testing if the segment is visible or not and then do the division. If somebody can give me some tips on how to determine the visible area of the circle please do as such.
Here is a photo with the thing that I desire, the red part of the circle is the visible, the black rectangle is the viewport.

[attachment=10413:circle_viewport.PNG]

Share this post


Link to post
Share on other sites
So you're trying to work out what the start and end angles are for the arc that represents the visible part of the circle? I'm not sure that will give you the answer you want, as the section directly below the centre of the circle (but still on screen) won't be drawn.

If you know the position of the circle's centre and where the bottom of the viewport is, couldn't you just test the Y coordinate during the draw?

Share this post


Link to post
Share on other sites
Also, graphics hardware [i]won't[/i] draw stuff outside the screen area--it's clipped right before the perspective divide. You don't incur the cost of drawing pixels. The only cost is the cost of processing vertices which, for a circle, probably isn't an issue. Is there some other reason why hardware's automatic clipping is unsuitable/irrelevant? Edited by Geometrian

Share this post


Link to post
Share on other sites
I agree that you probably don't need to do any clipping of your own. But if you do, you should realize that the intersection of a circle and a rectangle can consist of up to 4 arcs. It's probably best to think of the circle as 4 arcs to begin with (one per quadrant) and clip them independently.

Share this post


Link to post
Share on other sites

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