From: <jpi...@us...> - 2011-10-21 19:17:33
|
Revision: 8826 http://octave.svn.sourceforge.net/octave/?rev=8826&view=rev Author: jpicarbajal Date: 2011-10-21 19:17:25 +0000 (Fri, 21 Oct 2011) Log Message: ----------- geometry. All is* functions Modified Paths: -------------- trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/isLeftOriented.m trunk/octave-forge/main/geometry/geom2d/inst/isPointInCircle.m trunk/octave-forge/main/geometry/geom2d/inst/isPointInEllipse.m trunk/octave-forge/main/geometry/geom2d/inst/isPointOnCircle.m trunk/octave-forge/main/geometry/geom2d/inst/isPointOnLine.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-21 19:10:17 UTC (rev 8825) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-21 19:17:25 UTC (rev 8826) @@ -137,6 +137,11 @@ intersectCircles.m intersectEdges.m intersectLineCircle.m + isLeftOriented.m + isPointInCircle.m + isPointInEllipse.m + isPointOnCircle.m + isPointOnLine.m =============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/isLeftOriented.m (from rev 8818, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isLeftOriented.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isLeftOriented.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -0,0 +1,59 @@ +%% Copyright (c) 2011, INRA +%% 2005-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isLeftOriented (@var{point}, @var{line}) +%% Test if a point is on the left side of a line +%% +%% B = isLeftOriented(POINT, LINE); +%% Returns TRUE if the point lies on the left side of the line with +%% respect to the line direction. +%% +%% @seealso{lines2d, points2d, isCounterClockwise, isPointOnLine, distancePointLine} +%% @end deftypefn + +function b = isLeftOriented(point, line) + Nl = size(line, 1); + Np = size(point, 1); + + x0 = repmat(line(:,1)', Np, 1); + y0 = repmat(line(:,2)', Np, 1); + dx = repmat(line(:,3)', Np, 1); + dy = repmat(line(:,4)', Np, 1); + xp = repmat(point(:,1), 1, Nl); + yp = repmat(point(:,2), 1, Nl); + + + b = (xp-x0).*dy-(yp-y0).*dx < 0; + +endfunction Copied: trunk/octave-forge/main/geometry/geom2d/inst/isPointInCircle.m (from rev 8818, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isPointInCircle.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isPointInCircle.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -0,0 +1,67 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isPointInCircle (@var{point}, @var{circle}) +%% Test if a point is located inside a given circle +%% +%% B = isPointInCircle(POINT, CIRCLE) +%% Returns true if point is located inside the circle, i.e. if distance to +%% circle center is lower than the circle radius. +%% +%% B = isPointInCircle(POINT, CIRCLE, TOL) +%% Specifies the tolerance value +%% +%% Example: +%% isPointInCircle([1 0], [0 0 1]) +%% isPointInCircle([0 0], [0 0 1]) +%% returns true, whereas +%% isPointInCircle([1 1], [0 0 1]) +%% return false +%% +%% @seealso{circles2d, isPointOnCircle} +%% @end deftypefn + +function b = isPointInCircle(point, circle, varargin) + + % extract computation tolerance + tol = 1e-14; + if ~isempty(varargin) + tol = varargin{1}; + end + + d = sqrt(sum(power(point - circle(:,1:2), 2), 2)); + b = d-circle(:,3)<=tol; + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/isPointInEllipse.m (from rev 8818, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isPointInEllipse.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isPointInEllipse.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -0,0 +1,81 @@ +%% Copyright (c) 2011, INRA +%% 2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isPointInellipse (@var{point}, @var{ellipse}) +%% Check if a point is located inside a given ellipse +%% +%% B = isPointInEllipse(POINT, ELLIPSE) +%% Returns true if point is located inside the given ellipse. +%% +%% B = isPointInEllipse(POINT, ELLIPSE, TOL) +%% Specifies the tolerance value +%% +%% Example: +%% isPointInEllipse([1 0], [0 0 2 1 0]) +%% ans = +%% 1 +%% isPointInEllipse([0 0], [0 0 2 1 0]) +%% ans = +%% 1 +%% isPointInEllipse([1 1], [0 0 2 1 0]) +%% ans = +%% 0 +%% isPointInEllipse([1 1], [0 0 2 1 30]) +%% ans = +%% 1 +%% +%% @seealso{ellipses2d, isPointInCircle} +%% @end deftypefn + +function b = isPointInEllipse(point, ellipse, varargin) + + % extract computation tolerance + tol = 1e-14; + if ~isempty(varargin) + tol = varargin{1}; + end + + % compute ellipse to unit circle transform + rot = createRotation(-deg2rad(ellipse(5))); + sca = createScaling(1./ellipse(3:4)); + trans = sca * rot; + + % transform points to unit circle basis + pTrans = bsxfun(@minus, point, ellipse(:,1:2)); + pTrans = transformPoint(pTrans, trans); + + % test if distance to origin smaller than 1 + b = sqrt(sum(power(pTrans, 2), 2)) - 1 <= tol; + +endfunction Copied: trunk/octave-forge/main/geometry/geom2d/inst/isPointOnCircle.m (from rev 8818, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isPointOnCircle.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isPointOnCircle.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -0,0 +1,65 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isPointOnCircle (@var{point}, @var{circle}) +%% 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 +%% +%% @seealso{circles2d, isPointInCircle} +%% @end deftypefn + +function b = isPointOnCircle(point, circle, varargin) + + tol = 1e-14; + if ~isempty(varargin) + tol = varargin{1}; + end + + d = sqrt(sum(power(point - circle(:,1:2), 2), 2)); + b = abs(d-circle(:,3))<tol; + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/isPointOnLine.m (from rev 8818, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isPointOnLine.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isPointOnLine.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -0,0 +1,72 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isPointOnLine (@var{point}, @var{line}) +%% Test if a point belongs to a line +%% +%% B = isPointOnLine(POINT, LINE) +%% with POINT being [xp yp], and LINE being [x0 y0 dx dy]. +%% Returns 1 if point lies on the line, 0 otherwise. +%% +%% If POINT is an N*2 array of points, B is a N*1 array of booleans. +%% +%% If LINE is a N*4 array of line, B is a 1*N array of booleans. +%% +%% @seealso {lines2d, points2d, isPointOnEdge, isPointOnRay, angle3Points} +%% @end deftypefn + +function b = isPointOnLine(point, line, varargin) + + % extract computation tolerance + tol = 1e-14; + if ~isempty(varargin) + tol = varargin{1}; + end + + % number of lines and of points + Nl = size(line, 1); + Np = size(point, 1); + + % adapt the size of inputs + x0 = repmat(line(:,1)', Np, 1); + y0 = repmat(line(:,2)', Np, 1); + dx = repmat(line(:,3)', Np, 1); + dy = repmat(line(:,4)', Np, 1); + xp = repmat(point(:,1), 1, Nl); + yp = repmat(point(:,2), 1, Nl); + + % test if lines are colinear + b = abs((xp-x0).*dy-(yp-y0).*dx)./hypot(dx, dy) < tol; + +endfunction Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m 2011-10-21 19:10:17 UTC (rev 8825) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -1,62 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function b = isLeftOriented(point, line) -%ISLEFTORIENTED Test if a point is on the left side of a line -% -% B = isLeftOriented(POINT, LINE); -% Returns TRUE if the point lies on the left side of the line with -% respect to the line direction. -% -% See also: -% lines2d, points2d, isCounterClockwise, isPointOnLine, distancePointLine -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/07/2005. -% - -Nl = size(line, 1); -Np = size(point, 1); - -x0 = repmat(line(:,1)', Np, 1); -y0 = repmat(line(:,2)', Np, 1); -dx = repmat(line(:,3)', Np, 1); -dy = repmat(line(:,4)', Np, 1); -xp = repmat(point(:,1), 1, Nl); -yp = repmat(point(:,2), 1, Nl); - - -b = (xp-x0).*dy-(yp-y0).*dx < 0; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m 2011-10-21 19:10:17 UTC (rev 8825) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -1,72 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function b = isPointInCircle(point, circle, varargin) -%ISPOINTINCIRCLE Test if a point is located inside a given circle -% -% B = isPointInCircle(POINT, CIRCLE) -% Returns true if point is located inside the circle, i.e. if distance to -% circle center is lower than the circle radius. -% -% B = isPointInCircle(POINT, CIRCLE, TOL) -% Specifies the tolerance value -% -% Example: -% isPointInCircle([1 0], [0 0 1]) -% isPointInCircle([0 0], [0 0 1]) -% returns true, whereas -% isPointInCircle([1 1], [0 0 1]) -% return false -% -% See also: -% circles2d, isPointOnCircle -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 07/04/2004. -% - -% HISTORY -% 22/05/2009 rename to isPointInCircle, add psb to specify tolerance - -% extract computation tolerance -tol = 1e-14; -if ~isempty(varargin) - tol = varargin{1}; -end - -d = sqrt(sum(power(point - circle(:,1:2), 2), 2)); -b = d-circle(:,3)<=tol; - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m 2011-10-21 19:10:17 UTC (rev 8825) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -1,86 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function b = isPointInEllipse(point, ellipse, varargin) -%ISPOINTINELLIPSE Check if a point is located inside a given ellipse -% -% B = isPointInEllipse(POINT, ELLIPSE) -% Returns true if point is located inside the given ellipse. -% -% B = isPointInEllipse(POINT, ELLIPSE, TOL) -% Specifies the tolerance value -% -% Example: -% isPointInEllipse([1 0], [0 0 2 1 0]) -% ans = -% 1 -% isPointInEllipse([0 0], [0 0 2 1 0]) -% ans = -% 1 -% isPointInEllipse([1 1], [0 0 2 1 0]) -% ans = -% 0 -% isPointInEllipse([1 1], [0 0 2 1 30]) -% ans = -% 1 -% -% See also: -% ellipses2d, isPointInCircle -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 11/03/2011 -% - -% HISTORY - -% extract computation tolerance -tol = 1e-14; -if ~isempty(varargin) - tol = varargin{1}; -end - -% compute ellipse to unit circle transform -rot = createRotation(-deg2rad(ellipse(5))); -sca = createScaling(1./ellipse(3:4)); -trans = sca * rot; - -% transform points to unit circle basis -pTrans = bsxfun(@minus, point, ellipse(:,1:2)); -pTrans = transformPoint(pTrans, trans); - -% test if distance to origin smaller than 1 -b = sqrt(sum(power(pTrans, 2), 2)) - 1 <= tol; - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m 2011-10-21 19:10:17 UTC (rev 8825) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -1,70 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function b = isPointOnCircle(point, circle, varargin) -%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 -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 07/04/2004. -% - -% HISTORY -% 22/05/2009 rename to isPointOnCircle, add psb to specify tolerance - -tol = 1e-14; -if ~isempty(varargin) - tol = varargin{1}; -end - -d = sqrt(sum(power(point - circle(:,1:2), 2), 2)); -b = abs(d-circle(:,3))<tol; - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m 2011-10-21 19:10:17 UTC (rev 8825) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m 2011-10-21 19:17:25 UTC (rev 8826) @@ -1,94 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function b = isPointOnLine(point, line, varargin) -%ISPOINTONLINE Test if a point belongs to a line -% -% B = isPointOnLine(POINT, LINE) -% with POINT being [xp yp], and LINE being [x0 y0 dx dy]. -% Returns 1 if point lies on the line, 0 otherwise. -% -% If POINT is an N*2 array of points, B is a N*1 array of booleans. -% -% If LINE is a N*4 array of line, B is a 1*N array of booleans. -% -% See also: -% lines2d, points2d, isPointOnEdge, isPointOnRay, angle3Points -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/10/2003. -% - -% HISTORY -% 11/03/2004 support for multiple inputs -% 08/12/2004 complete implementation, add doc -% 22/05/2009 rename to isPointOnLine, add psb to specify tolerance - -% extract computation tolerance -tol = 1e-14; -if ~isempty(varargin) - tol = varargin{1}; -end - -% number of lines and of points -Nl = size(line, 1); -Np = size(point, 1); - -% adapt the size of inputs -x0 = repmat(line(:,1)', Np, 1); -y0 = repmat(line(:,2)', Np, 1); -dx = repmat(line(:,3)', Np, 1); -dy = repmat(line(:,4)', Np, 1); -xp = repmat(point(:,1), 1, Nl); -yp = repmat(point(:,2), 1, Nl); - -% test if lines are colinear -b = abs((xp-x0).*dy-(yp-y0).*dx)./hypot(dx, dy) < tol; - - - - - - - - - - - - - - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |