graphics

Dec 12, 2008 at 11:20am
if we make a circle taking (0,0) as the center and 100 as the radius.
then we are able to view only the 4th quadrant of the circle.
how can we view the whole circle without changing the coordinates and radius of the circle?
Dec 12, 2008 at 11:48am
Your grahics system appears to have the origin (0,0) in a corner. This is normal. Some systems use the upper left while others use the lower left as the origin.

You need to move the thing over. Try drawing at (100,100) instead. I have no idea what your coordinate system is or the range of your X/Y axes.
Dec 12, 2008 at 11:56am
u didnt get my question.
my top left corner is 0,0 .
and taking that as the centre i want to draw and view the whole circle.
how is that possible??
Dec 12, 2008 at 12:15pm
It's not. Those coordinates are not virtual coordinates for a viewport. They are physical coordinates of the screen. Doing what you ask is like accessing negative elements of an array.

Unless the coordinates you are passing are for a viewport. In which case, you just need to move the viewport.
Dec 12, 2008 at 5:56pm
i think my question isnt properly understood.

my viewport settings are default with (0,0) at the top left .

now ive made a circle taking (0,0) (default viewport settings) as the center. and 100 as the radius

so can i view the whole circle instead of just viewing the 4th quadrant of the circle???

if yes , then how??

if no then why not??

this information is very important for me!

please help.
Last edited on Dec 12, 2008 at 5:57pm
Dec 12, 2008 at 6:13pm
What's the interface you're using to draw to the screen (i.e. what library)?
Dec 12, 2008 at 6:18pm
what do you mean by- what library?- could you please explain.

im quite unfamiliar with graphics terms.
Dec 12, 2008 at 9:48pm
You know, I think helios has been extraordinarily patient with this so far. Don't keep running him in circles. It is time to go ask your teacher for help.

If you are using the old Borland BGI library, there is no reason you can't just adjust the center of the circle to somewhere else:
1
2
3
4
// center (x, y) = (150, 150)
// radius = 100
circle( 150, 150, 100 );
// Voilà! Je peux voir le cercle entier! 


If you are plotting the circle yourself, just add the center offset [(150, 150) in my example above] to the coordinate of each point before you plot it.

Good luck!
Last edited on Dec 12, 2008 at 9:52pm
Dec 12, 2008 at 10:13pm
Well, it's not like I was annoyed or anything. The question doesn't really belong in this forum, though.

I assume Duoas knows enough about that library to know if it implements a viewport or not. If you are using Borland, do what he suggested. Otherwise, consult the documentation for the library you're using, but I don't really see any reason not to move the center of the circle.
Dec 12, 2008 at 11:11pm
It's been said already...if you really want, you can hide it like this:
1
2
3
4
5
6
7
void circle( int x, int y, unsigned int r )
{
    // make the origin in the middle of the screen
    library::circle( x + SCREENWIDTH/2, y + SCREENHEIGHT/2, r );
}
// ...
circle( 0, 0, 100 );

Dec 13, 2008 at 4:59am
thanx to all the repliers especially helios
Topic archived. No new replies allowed.