ISPOINTONEDGE Test if a point belongs to an edge. Usage B = isPointOnEdge(POINT, EDGE) B = isPointOnEdge(POINT, EDGE, TOL) Description B = isPointOnEdge(POINT, EDGE) with POINT being [xp yp], and EDGE being [x1 y1 x2 y2], returns TRUE if the point is located on the edge, and FALSE otherwise. B = isPointOnEdge(POINT, EDGE, TOL) Specify an optilonal tolerance value TOL. The tolerance is given as a fraction of the norm of the edge direction vector. Default is 1e-14. B = isPointOnEdge(POINTARRAY, EDGE) B = isPointOnEdge(POINT, EDGEARRAY) When one of the inputs has several rows, return the result of the test for each element of the array tested against the single parameter. B = isPointOnEdge(POINTARRAY, EDGEARRAY) When both POINTARRAY and EDGEARRAY have the same number of rows, returns a column vector with the same number of rows. When the number of rows are different and both greater than 1, returns a Np-by-Ne matrix of booleans, containing the result for each couple of point and edge. Examples % create a point array points = [10 10;15 10; 30 10]; % create an edge array vertices = [10 10;20 10;20 20;10 20]; edges = [vertices vertices([2:end 1], :)]; % Test one point and one edge isPointOnEdge(points(1,:), edges(1,:)) ans = 1 isPointOnEdge(points(3,:), edges(1,:)) ans = 0 % Test one point and several edges isPointOnEdge(points(1,:), edges)' ans = 1 0 0 1 % Test several points and one edge isPointOnEdge(points, edges(1,:))' ans = 1 1 0 % Test N points and N edges isPointOnEdge(points, edges(1:3,:))' ans = 1 0 0 % Test NP points and NE edges isPointOnEdge(points, edges) ans = 1 0 0 1 1 0 0 0 0 0 0 0 See also edges2d, points2d, isPointOnLine
Package: matgeom