Home > matGeom > geom2d > isPointOnCircle.m

isPointOnCircle

PURPOSE ^

ISPOINTONCIRCLE Test if a point is located on a given circle.

SYNOPSIS ^

function b = isPointOnCircle(point, circle, varargin)

DESCRIPTION ^

ISPOINTONCIRCLE Test if a point is located on a given circle.

   B = isPointOnCircle(POINT, CIRCLE) 
   return true if point is located on the circle, i.e. if the distance to
   the circle center equals the radius up to an epsilon value.

   B = isPointOnCircle(POINT, CIRCLE, TOL) 
   Specifies the tolerance value.

   Example:
   isPointOnCircle([1 0], [0 0 1])
   returns true, whereas
   isPointOnCircle([1 1], [0 0 1])
   return false

   See also
   circles2d, isPointInCircle

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function b = isPointOnCircle(point, circle, varargin)
0002 %ISPOINTONCIRCLE Test if a point is located on a given circle.
0003 %
0004 %   B = isPointOnCircle(POINT, CIRCLE)
0005 %   return true if point is located on the circle, i.e. if the distance to
0006 %   the circle center equals the radius up to an epsilon value.
0007 %
0008 %   B = isPointOnCircle(POINT, CIRCLE, TOL)
0009 %   Specifies the tolerance value.
0010 %
0011 %   Example:
0012 %   isPointOnCircle([1 0], [0 0 1])
0013 %   returns true, whereas
0014 %   isPointOnCircle([1 1], [0 0 1])
0015 %   return false
0016 %
0017 %   See also
0018 %   circles2d, isPointInCircle
0019 
0020 % ------
0021 % Author: David Legland
0022 % E-mail: david.legland@inrae.fr
0023 % Created: 2004-04-07
0024 % Copyright 2004-2024 INRA - TPV URPOI - BIA IMASTE
0025 
0026 tol = 1e-14;
0027 if ~isempty(varargin)
0028     tol = varargin{1};
0029 end
0030 
0031 d = sqrt(sum(power(point - circle(:,1:2), 2), 2));
0032 b = abs(d-circle(:,3))<tol;
0033

Generated on Thu 21-Nov-2024 11:30:22 by m2html © 2003-2022