# getting coordinates

Does anybody know how to use openGL to radially move outward from a certain coordinate and keep moving until you find a pixel of a certain color? Then, get the coordinates of that point.

Could you give a bit more information as to what you are trying to do?

Originally posted by Rajveer:
Does anybody know how to use openGL to radially move outward from a certain coordinate and keep moving until you find a pixel of a certain color? Then, get the coordinates of that point.

Well, I have two float arrays (xcoord[20] & zcoord[20]) holding the x and z coordinates of a “sort of oval” shape. So I draw the resulting oval at y=0 with the following code:

glBegin(GL_LINE_LOOP);
for(int i=0; i<20; i++)
{
glVertex3f(xcoord[i], 0, zcoord[i]);
}
glEnd();

now, for specific reasons, I need to store the coordinates of this “somewhat oval” shape at every 30 degrees (going radially outward from the center-for which I know the location). This requires a new set of arrays, because the coordinates I used are not spaced evenly, they are just random. How can I do this??

A couple of questions:
Does your oval shape change in size of shape during the drawing process?
Are you trying to draw in a spiral or circular pattern going outward?
The coordinates that you want is it the origin of each oval or every point in the oval?

Originally posted by Rajveer:
[b]Well, I have two float arrays (xcoord[20] & zcoord[20]) holding the x and z coordinates of a “sort of oval” shape. So I draw the resulting oval at y=0 with the following code:

glBegin(GL_LINE_LOOP);
for(int i=0; i<20; i++)
{
glVertex3f(xcoord[i], 0, zcoord[i]);
}
glEnd();

now, for specific reasons, I need to store the coordinates of this “somewhat oval” shape at every 30 degrees (going radially outward from the center-for which I know the location). This requires a new set of arrays, because the coordinates I used are not spaced evenly, they are just random. How can I do this??[/b]

Sorry for the bad descriptions. This is really hard to explain. No, my oval doesn’t change in size. I’m not trying to draw in a spiral or circular pattern. I’m just trying to find the coordinates of other points in the oval that could be inbetween some of the points I’m given. What i’ve done is just connected the points I’m given to draw the oval and now I need to find the points on that oval that are at equal angles if I drew a line from the center to the actual edge of the oval. I hope this is a better explanation.

Originally posted by nexusone:
[b]A couple of questions:
Does your oval shape change in size of shape during the drawing process?
Are you trying to draw in a spiral or circular pattern going outward?
The coordinates that you want is it the origin of each oval or every point in the oval?

[/b]

I would have to think some more on this…
But one way would be to compare array’s, since each oval is made up of an array of points. Then with a little math get the dot product, check what points are at equal angles to each other.

I think there are a few other math functions that will give you the information needed.

It’s times like this a digital sketch pad would be nice.

Originally posted by Rajveer:
[b]Sorry for the bad descriptions. This is really hard to explain. No, my oval doesn’t change in size. I’m not trying to draw in a spiral or circular pattern. I’m just trying to find the coordinates of other points in the oval that could be inbetween some of the points I’m given. What i’ve done is just connected the points I’m given to draw the oval and now I need to find the points on that oval that are at equal angles if I drew a line from the center to the actual edge of the oval. I hope this is a better explanation.

[/b]