# how to determine the position of points which belong to a circle ?

58 visualizaciones (últimos 30 días)
jan el 22 de Dic. de 2014
Editada: jan el 23 de Dic. de 2014
Hi how to determine the points of a circle (their x, y coordinates) if we knew the position of the center and the radius of the circle thanks!!!!
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Roger Stafford el 22 de Dic. de 2014
If the center is at (x0,y0) and the radius is r, then
1) if (x-x0)^2 + (y-y0)^2 < r^2, the point (x,y) is inside the circle,
2) if (x-x0)^2 + (y-y0)^2 == r^2, the point (x,y) is on the circle, and
3) if (x-x0)^2 + (y-y0)^2 > r^2, the point (x,y) is outside the circle.
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
jan el 23 de Dic. de 2014
thanks for this fast response this is what i'm realy looking for just i need now to write the appropriate code

Iniciar sesión para comentar.

### Más respuestas (1)

Image Analyst el 22 de Dic. de 2014
##### 6 comentariosMostrar 4 comentarios más antiguosOcultar 4 comentarios más antiguos
Image Analyst el 23 de Dic. de 2014
Well the first way is a totally inefficient way of doing the first method of the FAQ. You can do it just once like the FAQ shows you instead of having a double for loop.
And your second half of your code is just the 4th block of code in the FAQ, just what I recommended to you but you said you didn't use . But you did - you just didn't realize it. Anyway, you don't need to do it both ways.
In your first code it seems like you're trying to get the perimeter pixels, while in the second code you're getting a solid circular disc. I think you should decide whether you want all the pixels in the circle, or just the perimeter pixels, and use the section of the FAQ that does whichever one you want. I would not use your code as-is.
jan el 23 de Dic. de 2014
Editada: jan el 23 de Dic. de 2014
the second part of my code is just to show you what i want to get as result i.e i used it to shwo you the difference between the both codes. Besides, i had this part from about one year ago and for all these reasons i accepted the first answer and not yours but thanks !!

Iniciar sesión para comentar.

### Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by