Checking given point in circle

5 次查看(过去 30 天)
How to write function for checking if a given point (x, y) is within the circle with a centre at (p, q) and radius, r?

回答(2 个)

Star Strider
Star Strider 2022-5-31
I would begin with the inpolygon function.

DGM
DGM 2022-5-31
编辑:DGM 2022-5-31
Depending on the context, there are probably more purpose-built tools, but you can do it in a very basic manner just the same.
center = [5 5];
radius = 10;
points = [10 10; 10 15];
isincircle = sum((center-points).^2,2) <= radius^2
isincircle = 2×1 logical array
1 0

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by