From: <jpi...@us...> - 2012-04-15 16:42:08
|
Revision: 10232 http://octave.svn.sourceforge.net/octave/?rev=10232&view=rev Author: jpicarbajal Date: 2012-04-15 16:42:01 +0000 (Sun, 15 Apr 2012) Log Message: ----------- geometry: updating all functions related to polygon simplification Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS trunk/octave-forge/main/geometry/inst/geom2d/distancePointEdge.m trunk/octave-forge/main/geometry/inst/polygons2d/simplifypolyline.m trunk/octave-forge/main/geometry/inst/shape2d/curve2polyline.m trunk/octave-forge/main/geometry/inst/shape2d/shape2polygon.m trunk/octave-forge/main/geometry/inst/shape2d/shapeplot.m Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/INDEX 2012-04-15 16:42:01 UTC (rev 10232) @@ -117,6 +117,7 @@ 2D Polygons drawPolygon simplifypolygon + simplifypolyline oc_polybool 2D Piecewise polynomial shapes polygon2shape Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/NEWS 2012-04-15 16:42:01 UTC (rev 10232) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the geometry package =============================================================================== -geometry-1.4.2 Release Date: 2012-XX-XX Release Manager: Juan Pablo Carbajal +geometry-1.5.0 Release Date: 2012-XX-XX Release Manager: Juan Pablo Carbajal =============================================================================== * Added functions: Modified: trunk/octave-forge/main/geometry/inst/geom2d/distancePointEdge.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom2d/distancePointEdge.m 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/inst/geom2d/distancePointEdge.m 2012-04-15 16:42:01 UTC (rev 10232) @@ -32,8 +32,8 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{dist} = } distancePointEdge (@var{point}, @var{edge}) -%% @deftypefnx {Function File} {@var{dist} = } distancePointEdge (@dots, @var{opt}) -%% @deftypefnx {Function File} {[@var{dist} @var{pos}]= } distancePointEdge (@dots) +%% @deftypefnx {Function File} {@var{dist} = } distancePointEdge (@dots{}, @var{opt}) +%% @deftypefnx {Function File} {[@var{dist} @var{pos}]= } distancePointEdge (@dots{}) %% Minimum distance between a point and an edge %% %% Return the euclidean distance between edge @var{edge} and point @var{point}. Modified: trunk/octave-forge/main/geometry/inst/polygons2d/simplifypolyline.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/simplifypolyline.m 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/inst/polygons2d/simplifypolyline.m 2012-04-15 16:42:01 UTC (rev 10232) @@ -27,7 +27,7 @@ %% @strong{Parameters} %% @table @samp %% @item 'Nmax' -%% Maximum number of vertices. Default value @code{100}. +%% Maximum number of vertices. Default value @code{1e3}. %% @item 'Tol' %% Tolerance for the error criteria. Default value @code{1e-4}. %% @item 'MaxIter' @@ -47,7 +47,7 @@ # --- Parse arguments --- # parser = inputParser (); parser.FunctionName = "simplifypolyline"; - parser = addParamValue (parser,'Nmax', 100, @(x)x>0); + parser = addParamValue (parser,'Nmax', 1e3, @(x)x>0); toldef = 1e-4;%max(sumsq(diff(pline_o),2))*2; parser = addParamValue (parser,'Tol', toldef, @(x)x>0); parser = addParamValue (parser,'MaxIter', 100, @(x)x>0); @@ -58,8 +58,8 @@ MaxIter = parser.Results.MaxIter; clear parser toldef - msg = ["Maximum number of points reached with maximal error %g." ... - " Increase '%s' if the result is not satisfactory."]; + msg = ["simplifypolyline: Maximum number of points reached with maximum error %g." ... + " Increase %s if the result is not satisfactory."]; # ------ # [N dim] = size(pline_o); @@ -79,13 +79,14 @@ idx = sort(idx); if length(idx) >= Nmax - warning('geometry:MayBeWrongOutput', sprintf(msg,dist,'Nmax')); + %% TODO remove extra points + warning('geometry:MayBeWrongOutput', sprintf(msg,max(dist),'Nmax')); break; end end if iter == MaxIter - warning('geometry:MayBeWrongOutput', sprintf(msg,dist,'MaxIter')); + warning('geometry:MayBeWrongOutput', sprintf(msg,max(dist),'MaxIter')); end pline = pline_o(idx,:); Modified: trunk/octave-forge/main/geometry/inst/shape2d/curve2polyline.m =================================================================== --- trunk/octave-forge/main/geometry/inst/shape2d/curve2polyline.m 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/inst/shape2d/curve2polyline.m 2012-04-15 16:42:01 UTC (rev 10232) @@ -15,7 +15,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{polyline} = } curve2polyline (@var{curve}) -%% @deftypefnx {Function File} {@var{polyline} = } curve2polyline (@dots,@var{property},@var{value},@dots) +%% @deftypefnx {Function File} {@var{polyline} = } curve2polyline (@dots{},@var{property},@var{value},@dots{}) %% Adaptive sampling of a parametric curve. %% %% The @var{curve} is described as a 2-by-N matrix. Rows correspond to the @@ -45,6 +45,7 @@ %% Thursday, April 12 2012 -- JuanPi function [polyline t bump]= curve2polyline (curve, varargin) +%% TODO make tolerance relative to the "diameter" of the curve. # --- Parse arguments --- # parser = inputParser (); @@ -58,7 +59,7 @@ tol = parser.Results.Tol; MaxIter = parser.Results.MaxIter; - clear parser + clear parser toldef # ------ # t = [0; 1]; Modified: trunk/octave-forge/main/geometry/inst/shape2d/shape2polygon.m =================================================================== --- trunk/octave-forge/main/geometry/inst/shape2d/shape2polygon.m 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/inst/shape2d/shape2polygon.m 2012-04-15 16:42:01 UTC (rev 10232) @@ -15,25 +15,23 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{polygon} = } shape2polygon (@var{shape}) -%% @deftypefnx {Function File} {@var{polygon} = } shape2polygon (@var{shape},@var{N}) +%% @deftypefnx {Function File} {@var{polygon} = } shape2polygon (@dots{},@var{property},@var{value},@dots{}) %% Transforms a 2D shape described by piecewise smooth polynomials into a polygon. %% %% @var{shape} is a n-by-1 cell where each element is a pair of polynomials %% compatible with polyval. %% @var{polygon} is a k-by-2 matrix, where each row represents a vertex. -%% @var{N} defines the number of points to be used in non-straight edges. +%% The property-value pairs are passed to @code{curve2polyline}. %% -%% @seealso{polygon2shape, drawPolygon} +%% @seealso{polygon2shape, curve2poyline} %% @end deftypefn -function polygon = shape2polygon (shape, N=16) +function polygon = shape2polygon (shape, varargin) polygon = cell2mat ( ... - cellfun (@(x) func (x,N), shape,'UniformOutput',false) ); + cellfun (@(x) curve2polyline(x,varargin{:}), shape,'UniformOutput',false) ); + polygon = simplifypolygon(polygon); - %% TODO simply the polygon based on curvature -% polygon = unique (polygon, 'rows'); - if size (polygon, 1) == 1 polygon(2,1) = polyval (shape{1}(1,:), 1); polygon(2,2) = polyval (shape{1}(2,:), 1); @@ -41,14 +39,27 @@ endfunction -function y = func (x,N) - - if size (x,2) > 2 - t = linspace (0,1-1/N,N).'; - y(:,1) = polyval (x(1,:), t); - y(:,2) = polyval (x(2,:), t); - else - y = x(:,2).'; - end - -endfunction +%!demo +%! shape = {[-93.172 606.368 -476.054 291.429; ... +%! -431.196 637.253 11.085 163.791]; ... +%! [-75.3626 -253.2337 457.1678 328.5714; ... +%! 438.7659 -653.6278 -7.9953 380.9336]; ... +%! [-89.5841 344.9716 -275.3876 457.1429; ... +%! -170.3613 237.8858 1.0469 158.0765];... +%! [32.900 -298.704 145.804 437.143; ... +%! -243.903 369.597 -34.265 226.648]; ... +%! [-99.081 409.127 -352.903 317.143; ... +%! 55.289 -114.223 -26.781 318.076]; ... +%! [-342.231 191.266 168.108 274.286; ... +%! 58.870 -38.083 -89.358 232.362]}; +%! +%! % Estimate a good tolerance +%! n = cell2mat(cellfun(@(x)curveval(x,[0 1]), shape, 'uniformoutput',false)); +%! dr = (max(n(:,1))-min(n(:,1)))*(max(n(:,2))-min(n(:,2)))*40; +%! p = shape2polygon (shape,'tol',dr); +%! +%! figure(1) +%! shapeplot(shape,'-b'); +%! hold on; +%! drawPolygon (p,'-or'); +%! hold off Modified: trunk/octave-forge/main/geometry/inst/shape2d/shapeplot.m =================================================================== --- trunk/octave-forge/main/geometry/inst/shape2d/shapeplot.m 2012-04-15 15:27:04 UTC (rev 10231) +++ trunk/octave-forge/main/geometry/inst/shape2d/shapeplot.m 2012-04-15 16:42:01 UTC (rev 10232) @@ -27,9 +27,11 @@ %% @seealso{drawPolygon, shape2polygon} %% @end deftypefn -function h = shapeplot(shape, N = 16, varargin) +function h = shapeplot(shape, varargin) - p = shape2polygon(shape, N); + n = cell2mat(cellfun(@(x)curveval(x,[0 1]), shape, 'uniformoutput',false)); + dr = (max(n(:,1))-min(n(:,1)))*(max(n(:,2))-min(n(:,2)))/10; + p = shape2polygon(shape,'tol', dr); h = drawPolygon(p,varargin{:}); endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-15 17:01:32
|
Revision: 10233 http://octave.svn.sourceforge.net/octave/?rev=10233&view=rev Author: jpicarbajal Date: 2012-04-15 17:01:26 +0000 (Sun, 15 Apr 2012) Log Message: ----------- geometry: Bumping version Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/NEWS Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2012-04-15 16:42:01 UTC (rev 10232) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2012-04-15 17:01:26 UTC (rev 10233) @@ -1,6 +1,6 @@ Name: Geometry -Version: 1.4.2 -Date: 2012-XX-XX +Version: 1.5.0 +Date: 2012-04-15 Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-04-15 16:42:01 UTC (rev 10232) +++ trunk/octave-forge/main/geometry/NEWS 2012-04-15 17:01:26 UTC (rev 10233) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the geometry package =============================================================================== -geometry-1.5.0 Release Date: 2012-XX-XX Release Manager: Juan Pablo Carbajal +geometry-1.5.0 Release Date: 2012-04-15 Release Manager: Juan Pablo Carbajal =============================================================================== * Added functions: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-16 08:31:25
|
Revision: 10235 http://octave.svn.sourceforge.net/octave/?rev=10235&view=rev Author: jpicarbajal Date: 2012-04-16 08:31:15 +0000 (Mon, 16 Apr 2012) Log Message: ----------- geometry: Fixing PKG_ADD and PKG_DEL Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/PKG_ADD trunk/octave-forge/main/geometry/PKG_DEL trunk/octave-forge/main/geometry/inst/io/data2geo.m Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-04-16 07:34:41 UTC (rev 10234) +++ trunk/octave-forge/main/geometry/INDEX 2012-04-16 08:31:15 UTC (rev 10235) @@ -125,7 +125,7 @@ shapecentroid shapeplot shapetransform - curvelval + curveval curve2polyline 2D Others bisector Modified: trunk/octave-forge/main/geometry/PKG_ADD =================================================================== --- trunk/octave-forge/main/geometry/PKG_ADD 2012-04-16 07:34:41 UTC (rev 10234) +++ trunk/octave-forge/main/geometry/PKG_ADD 2012-04-16 08:31:15 UTC (rev 10235) @@ -2,22 +2,35 @@ dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); - -%% Check if prefix was used -[pkg_folder dep_folder] = pkg ("prefix"); -pkg_folder = [pkg_folder filesep() strcat(filesep(),{pp{end-1:end}}){:} ]; -dep_folder = [dep_folder filesep() strcat(filesep(),{pp{end-1:end}}){:} ]; - -%% If we are in Architecture dependent folder add from outside arch = cstrcat (octave_config_info ("canonical_host_type"), "-", octave_config_info ("api_version")); -if strcmp (arch , pp{end}) - dirname = [strcat(filesep(),{pp{1:end-1}}){:}]; - pkg_folder = strsplit (pkg_folder,filesep (), true); - pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; + +%% Get the correct path +% Search installed packages +[local_packages, global_packages] = pkg("list"); +installed_pkgs_lst = {local_packages{:}, global_packages{:}}; +pkg_data = installed_pkgs_lst (cellfun(@(x) ismember (x.name, {"geometry"}), ... + installed_pkgs_lst, "unif", true)); +if isempty(pkg_data) + % The package is not installed yet + [pkg_folder dep_folder] = pkg ("prefix"); + pkg_folder = [pkg_folder strcat(filesep(),{pp{end-1:end}}){:} ]; +% dep_folder = [dep_folder strcat(filesep(),{pp{end-1:end}}){:} ]; + if strcmp (arch , pp{end}) + %% If we are in Architecture dependent folder add from outside + pkg_folder = strsplit (pkg_folder,filesep (), true); + pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; +% dep_folder = strsplit (dep_folder,filesep (), true); +% dep_folder = [strcat(filesep(),{dep_folder{1:end-1}}){:}]; + end +else + pkg_folder = pkg_data{1}.dir; +% dep_folder = pkg_data{1}.archprefix; end -if (! exist (fullfile (dirname, "inst"), "dir")) +%dep_folder = [dep_folder filesep arch]; + +if (! exist (fullfile (pkg_folder, "inst"), "dir")) %% Installing for ii=1:length (dirlist) addpath ( [ pkg_folder filesep() dirlist{ii}],"-end") @@ -27,9 +40,11 @@ %% Testing warning("geometry:Devel","Adding path for testing."); for ii=1:length(dirlist) - addpath ([ dirname "/inst/" dirlist{ii}]) + addpath ([ pkg_folder "/inst/" dirlist{ii}]) endfor endif +%addpath (dep_folder) warning('off', 'Octave:fopen-file-in-path'); -clear dirlist dirname pp arch pkg_folder dep_folder +clear dirlist dirname pp arch pkg_folder +%dep_folder Modified: trunk/octave-forge/main/geometry/PKG_DEL =================================================================== --- trunk/octave-forge/main/geometry/PKG_DEL 2012-04-16 07:34:41 UTC (rev 10234) +++ trunk/octave-forge/main/geometry/PKG_DEL 2012-04-16 08:31:15 UTC (rev 10235) @@ -2,28 +2,34 @@ dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); - -%% Get the correct path -p1 = pkg_info ("miscellaneous", "archprefix"); -p2 = octave_config_info ("canonical_host_type"); -p2 = octave_config_info ("api_version"); -arch_dep_fldr = [p1 filesep "-" p3]; - -%[pkg_folder dep_folder] = pkg ("prefix"); -%pkg_folder = [pkg_folder filesep() strcat(filesep(),{pp{end-1:end}}){:} ]; -%dep_folder = [dep_folder filesep() strcat(filesep(),{pp{end-1:end}}){:} ]; - -%% If we are not in Architecture dependent folder arch = cstrcat (octave_config_info ("canonical_host_type"), "-", octave_config_info ("api_version")); -pp = strsplit (dirname,filesep (), true); -if strcmp(arch , pp{end}) - dirname = [pkg("prefix") filesep() pp{end-1}]; - pkg_folder = strsplit (pkg_folder,filesep (), true); - pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; +%% Get the correct path +% Search installed packages +[local_packages, global_packages] = pkg("list"); +installed_pkgs_lst = {local_packages{:}, global_packages{:}}; +pkg_data = installed_pkgs_lst (cellfun(@(x) ismember (x.name, {"geometry"}), ... + installed_pkgs_lst, "unif", true)); +if isempty(pkg_data) + % The package is not installed yet + [pkg_folder dep_folder] = pkg ("prefix"); + pkg_folder = [pkg_folder strcat(filesep(),{pp{end-1:end}}){:} ]; +% dep_folder = [dep_folder strcat(filesep(),{pp{end-1:end}}){:} ]; + if strcmp (arch , pp{end}) + %% If we are in Architecture dependent folder add from outside + pkg_folder = strsplit (pkg_folder,filesep (), true); + pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; +% dep_folder = strsplit (dep_folder,filesep (), true); +% dep_folder = [strcat(filesep(),{dep_folder{1:end-1}}){:}]; + end +else + pkg_folder = pkg_data{1}.dir; +% dep_folder = pkg_data{1}.archprefix; end -if (! exist (fullfile (dirname, "inst"), "dir")) +%dep_folder = [dep_folder filesep arch]; + +if (! exist (fullfile (pkg_folder, "inst"), "dir")) ## Run this if the package is installed for ii=1:length (dirlist) rmpath ( [ pkg_folder filesep() dirlist{ii}]) @@ -31,8 +37,10 @@ else warning("geometry:Devel","Removing path for testing."); for ii=1:length(dirlist) - rmpath ([ dirname "/inst/" dirlist{ii}]) + rmpath ([ pkg_folder "/inst/" dirlist{ii}]) endfor endif +%rmpath (dep_folder); -clear dirlist dirname pp arch pkg_folder dep_folder +clear dirlist dirname pp arch pkg_folder +%dep_folder Modified: trunk/octave-forge/main/geometry/inst/io/data2geo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/io/data2geo.m 2012-04-16 07:34:41 UTC (rev 10234) +++ trunk/octave-forge/main/geometry/inst/io/data2geo.m 2012-04-16 08:31:15 UTC (rev 10235) @@ -97,6 +97,7 @@ %! ids = dc.pathid(); %! P = dc.path2polygon(ids{1},12)(1:end-1,:); %! P = bsxfun(@minus, P, centroid(P)); +%! P = simplifypolygon(P,'tol',5e-1); %! filename = tmpnam (); %! meshsize = sqrt(mean(sumsq(diff(P,1,1),2)))/2; %! data2geo (P, meshsize, 'output', [filename '.geo']); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-16 10:01:18
|
Revision: 10242 http://octave.svn.sourceforge.net/octave/?rev=10242&view=rev Author: jpicarbajal Date: 2012-04-16 10:01:07 +0000 (Mon, 16 Apr 2012) Log Message: ----------- geometry: porting new functions to polygon2d Modified Paths: -------------- trunk/octave-forge/main/geometry/NEWS trunk/octave-forge/main/geometry/PKG_ADD trunk/octave-forge/main/geometry/PKG_DEL Added Paths: ----------- trunk/octave-forge/main/geometry/inst/polygons2d/curvature.m trunk/octave-forge/main/geometry/inst/polygons2d/parametrize.m Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-04-16 09:53:45 UTC (rev 10241) +++ trunk/octave-forge/main/geometry/NEWS 2012-04-16 10:01:07 UTC (rev 10242) @@ -18,7 +18,8 @@ * Solved bugs: - simplifypolygon.m returned empty polygons when points are repeated, i.e when the polygon is not correctly formed. - + - Removed installation warnings. + =============================================================================== geometry-1.4.1 Release Date: 2012-03-24 Release Manager: Juan Pablo Carbajal =============================================================================== Modified: trunk/octave-forge/main/geometry/PKG_ADD =================================================================== --- trunk/octave-forge/main/geometry/PKG_ADD 2012-04-16 09:53:45 UTC (rev 10241) +++ trunk/octave-forge/main/geometry/PKG_ADD 2012-04-16 10:01:07 UTC (rev 10242) @@ -30,7 +30,7 @@ %dep_folder = [dep_folder filesep arch]; -if (! exist (fullfile (pkg_folder, "inst"), "dir")) +if (! exist (fullfile (dirname, "inst"), "dir")) %% Installing for ii=1:length (dirlist) addpath ( [ pkg_folder filesep() dirlist{ii}],"-end") @@ -40,7 +40,7 @@ %% Testing warning("geometry:Devel","Adding path for testing."); for ii=1:length(dirlist) - addpath ([ pkg_folder "/inst/" dirlist{ii}]) + addpath ([ dirname "/inst/" dirlist{ii}]) endfor endif %addpath (dep_folder) Modified: trunk/octave-forge/main/geometry/PKG_DEL =================================================================== --- trunk/octave-forge/main/geometry/PKG_DEL 2012-04-16 09:53:45 UTC (rev 10241) +++ trunk/octave-forge/main/geometry/PKG_DEL 2012-04-16 10:01:07 UTC (rev 10242) @@ -29,7 +29,7 @@ %dep_folder = [dep_folder filesep arch]; -if (! exist (fullfile (pkg_folder, "inst"), "dir")) +if (! exist (fullfile (dirname, "inst"), "dir")) ## Run this if the package is installed for ii=1:length (dirlist) rmpath ( [ pkg_folder filesep() dirlist{ii}]) @@ -37,7 +37,7 @@ else warning("geometry:Devel","Removing path for testing."); for ii=1:length(dirlist) - rmpath ([ pkg_folder "/inst/" dirlist{ii}]) + rmpath ([ dirname "/inst/" dirlist{ii}]) endfor endif %rmpath (dep_folder); Added: trunk/octave-forge/main/geometry/inst/polygons2d/curvature.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/curvature.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/polygons2d/curvature.m 2012-04-16 10:01:07 UTC (rev 10242) @@ -0,0 +1,177 @@ +%% Copyright (C) 2003-2011 David Legland <dav...@gr...> +%% Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% All rights reserved. +%% +%% 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 AUTHOR 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 the copyright holders. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{kappa} = } curvature (@var{t}, @var{px}, @var{py},@var{method},@var{degree}) +%% @deftypefnx {Function File} {@var{kappa} = } curvature (@var{t}, @var{poly},@var{method},@var{degree}) +%% @deftypefnx {Function File} {@var{kappa} = } curvature (@var{px}, @var{py},@var{method},@var{degree}) +%% @deftypefnx {Function File} {@var{kappa} = } curvature (@var{points},@var{method},@var{degree}) +%% @deftypefnx {Function File} {[@var{kappa} @var{poly} @var{t}] = } curvature (@dots{}) +%% Estimate curvature of a polyline defined by points. +%% +%% First compute an approximation of the curve given by PX and PY, with +%% the parametrization @var{t}. Then compute the curvature of approximated curve +%% for each point. +%% @var{method} used for approximation can be only: 'polynom', with specified degree. +%% Further methods will be provided in a future version. +%% @var{t}, @var{px}, and @var{py} are N-by-1 array of the same length. The points +%% can be specified as a single N-by-2 array. +%% +%% If the argument @var{t} is not given, the parametrization is estimated using +%% function @code{parametrize}. +%% +%% If requested, @var{poly} contains the approximating polygon evlauted at the +%% parametrization @var{t}. +%% +%% @seealso{parametrize, polygons2d} +%% @end deftypefn + +function [kappa, varargout] = curvature(varargin) + + % default values + degree = 5; + t=0; % parametrization of curve + tc=0; % indices of points wished for curvature + + + % ================================================================= + + % Extract method and degree ------------------------------ + + nargin = length(varargin); + varN = varargin{nargin}; + varN2 = varargin{nargin-1}; + + if ischar(varN2) + % method and degree are specified + method = varN2; + degree = varN; + varargin = varargin(1:nargin-2); + elseif ischar(varN) + % only method is specified, use degree 6 as default + method = varN; + varargin = varargin{1:nargin-1}; + else + % method and degree are implicit : use 'polynom' and 6 + method = 'polynom'; + end + + % extract input parametrization and curve. ----------------------- + nargin = length(varargin); + if nargin==1 + % parameters are just the points -> compute caracterization. + var = varargin{1}; + px = var(:,1); + py = var(:,2); + elseif nargin==2 + var = varargin{2}; + if size(var, 2)==2 + % parameters are t and POINTS + px = var(:,1); + py = var(:,2); + t = varargin{1}; + else + % parameters are px and py + px = varargin{1}; + py = var; + end + elseif nargin==3 + var = varargin{2}; + if size(var, 2)==2 + % parameters are t, POINTS, and tc + px = var(:,1); + py = var(:,2); + t = varargin{1}; + else + % parameters are t, px and py + t = varargin{1}; + px = var; + py = varargin{3}; + end + elseif nargin==4 + % parameters are t, px, py and tc + t = varargin{1}; + px = varargin{2}; + py = varargin{3}; + tc = varargin{4}; + end + + % compute implicit parameters -------------------------- + + % if t and/or tc are not computed, use implicit definition + if t==0 + t = parametrize(px, py, 'norm'); + end + + % if tc not defined, compute curvature for all points + if tc==0 + tc = t; + else + % else convert from indices to parametrization values + tc = t(tc); + end + + + % ================================================================= + % compute curvature for each point of the curve + + if strcmp(method, 'polynom') + % compute coefficients of interpolation functions + x0 = polyfit(t, px, degree); + y0 = polyfit(t, py, degree); + + % compute coefficients of first and second derivatives. In the case of a + % polynom, it is possible to compute coefficient of derivative by + % multiplying with a matrix. + derive = diag(degree:-1:0); + xp = circshift(x0*derive, [0 1]); + yp = circshift(y0*derive, [0 1]); + xs = circshift(xp*derive, [0 1]); + ys = circshift(yp*derive, [0 1]); + + % compute values of first and second derivatives for needed points + xprime = polyval(xp, tc); + yprime = polyval(yp, tc); + xsec = polyval(xs, tc); + ysec = polyval(ys, tc); + + % compute value of curvature + kappa = (xprime.*ysec - xsec.*yprime)./ ... + power(xprime.*xprime + yprime.*yprime, 3/2); + + if nargout > 1 + varargout{1} = [polyval(x0,tc(:)) polyval(y0,tc(:))]; + if nargout > 2 + varargout{2} = tc; + end + end + else + error('unknown method'); + end + +endfunction Added: trunk/octave-forge/main/geometry/inst/polygons2d/parametrize.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/parametrize.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/polygons2d/parametrize.m 2012-04-16 10:01:07 UTC (rev 10242) @@ -0,0 +1,96 @@ +%% Copyright (C) 2003-2011 David Legland <dav...@gr...> +%% Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% All rights reserved. +%% +%% 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 AUTHOR 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 the copyright holders. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{par} = } parametrize (@var{poly}) +%% @deftypefnx {Function File} {@var{par} = } parametrize (@var{px},@var{py}) +%% @deftypefnx {Function File} {@var{par} = } parametrize (@dots{},@var{normalize}) +%% +%% Parametrization of a curve, based on edges length +%% +%% Returns a parametrization of the curve defined by the serie of points, +%% based on euclidean distance between two consecutive points. +%% POLY is a N-by-2 array, representing coordinates of vertices. The +%% result PAR is N-by-1, and contains the cumulative length of edges until +%% corresponding vertex. The function also accepts the polygon as two inputs +%% @var{px} and @var{py} representinx coordinates x and y respectively. +%% When optional argument @var{normalize} is non-empty @var{par} is rescaled +%% such that the last element equals 1, i.e. @code{@var{par}(end)==1}. +%% +%% Example +%% @example +%% % Parametrize a circle approximation +%% poly = circleToPolygon([0 0 1], 200); +%% p = parametrize(poly); +%% p(end) +%% ans = +%% 6.2829 +%% p = parametrize(poly,'norm'); +%% p(end) +%% ans = +%% 1 +%% p = parametrize(poly,true); +%% p(end) +%% ans = +%% 1 +%% @end example +%% +%% @seealso{polygons2d, polylineLength} +%% @end deftypefn +function par = parametrize(varargin) + %% Process inputs + + % extract vertex coordinates + if size(varargin{1}, 2) > 1 + % vertices in a single array + pts = varargin{1}; + normalize = numel(varargin) > 1; + elseif size(varargin{1}, 2) == 1 && numel(varargin) >= 2 + % points as separate arrays + pts = [varargin{1} varargin{2}]; + normalize = numel(varargin) > 2; + end + + %% Parametrize polyline + + % compute cumulative sum of euclidean distances between consecutive + % vertices, setting distance of first vertex to 0. + if size(pts, 2) == 2 + % process points in 2D + par = [0 ; cumsum(hypot(diff(pts(:,1)), diff(pts(:,2))))]; + else + % process points in arbitrary dimension + par = [0 ; cumsum(sqrt(sum(diff(pts).^2, 2)))]; + end + + % eventually rescale between 0 and 1 + if normalize + par = par / par(end); + end + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-16 10:17:57
|
Revision: 10243 http://octave.svn.sourceforge.net/octave/?rev=10243&view=rev Author: jpicarbajal Date: 2012-04-16 10:17:46 +0000 (Mon, 16 Apr 2012) Log Message: ----------- geometry: porting new functions to polygon2d Modified Paths: -------------- trunk/octave-forge/main/geometry/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/inst/polygons2d/reversePolygon.m trunk/octave-forge/main/geometry/inst/polygons2d/reversePolyline.m trunk/octave-forge/main/geometry/inst/polygons2d/supportFunction.m Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-04-16 10:01:07 UTC (rev 10242) +++ trunk/octave-forge/main/geometry/NEWS 2012-04-16 10:17:46 UTC (rev 10243) @@ -6,10 +6,23 @@ * Added functions: - curveval.m: Evaluates a polynomial curve defined as a 2-by-N matrix. + - curve2polyline.m: Converts a polynomial curve into a polyline by the adaptive sampling method. + - simplifypolyline.m: Ramer-Douglas-Peucker algorithm to simplify polylines. + - parametrize.m: Estimate a parametrization of a polygon/line based on the distance + between the points. + + - curvature.m: Estimation of the curvature of a polygon/line based on polynomial + approximation. + + - reversePolygon.m and reversePolyline.m: reverse the orders of the points in + of polygon/line. + + - supportfunction.m: Compute support function of a polygon. + * Changed functions: - distancePointEdge.m: Now the function computes the distance between all points and all edges. A third optional argument provides @@ -19,7 +32,7 @@ - simplifypolygon.m returned empty polygons when points are repeated, i.e when the polygon is not correctly formed. - Removed installation warnings. - + =============================================================================== geometry-1.4.1 Release Date: 2012-03-24 Release Manager: Juan Pablo Carbajal =============================================================================== Added: trunk/octave-forge/main/geometry/inst/polygons2d/reversePolygon.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/reversePolygon.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/polygons2d/reversePolygon.m 2012-04-16 10:17:46 UTC (rev 10243) @@ -0,0 +1,44 @@ +%% Copyright (C) 2003-2011 David Legland <dav...@gr...> +%% Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% All rights reserved. +%% +%% 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 AUTHOR 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 the copyright holders. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{poly2} = } reversePolygon (@var{poly}) +%% Reverse a polygon, by iterating vertices from the end +%% +%% POLY2 = reversePolygon(POLY) +%% POLY2 has same vertices as POLY, but in different order. The first +%% vertex of the polygon is still the same. +%% +%% @seealso{reversePolyline} +%% @end deftypefn + +function rev = reversePolygon(poly) + + rev = poly([1 end:-1:2], :); + +endfunction Added: trunk/octave-forge/main/geometry/inst/polygons2d/reversePolyline.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/reversePolyline.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/polygons2d/reversePolyline.m 2012-04-16 10:17:46 UTC (rev 10243) @@ -0,0 +1,43 @@ +%% Copyright (C) 2003-2011 David Legland <dav...@gr...> +%% Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% All rights reserved. +%% +%% 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 AUTHOR 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 the copyright holders. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{poly2} = } reversePolyline (@var{poly}) +%% Reverse a polyline, by iterating vertices from the end +%% +%% POLY2 = reversePolyline(POLY) +%% POLY2 has same vertices as POLY, but POLY2(i,:) is the same as +%% POLY(END-i+1,:). +%% +%% @seealso{reversePolygon} +%% @end deftypefn +function rev = reversePolyline(poly) + + rev = poly(end:-1:1, :); + +endfunction Added: trunk/octave-forge/main/geometry/inst/polygons2d/supportFunction.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/supportFunction.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/polygons2d/supportFunction.m 2012-04-16 10:17:46 UTC (rev 10243) @@ -0,0 +1,77 @@ +%% Copyright (C) 2003-2011 David Legland <dav...@gr...> +%% Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% All rights reserved. +%% +%% 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 AUTHOR 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 the copyright holders. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} = } suppportFunction (@var{polygon}) +%% @deftypefnx {Function File} {@var{h} = } suppportFunction (@var{polygon}, @var{n}) +%% @deftypefnx {Function File} {@var{h} = } suppportFunction (@var{polygon}, @var{v}) +%% Compute support function of a polygon +%% +%% H = supportFunction(POLYGON, N) +%% uses N points for suport function approximation +%% +%% H = supportFunction(POLYGON) +%% assume 24 points for approximation +%% +%% H = supportFunction(POLYGON, V) +%% where V is a vector, uses vector V of angles to compute support +%% function. +%% +%% @seealso{convexification} +%% @end deftypefn + +function h = supportFunction(polygon, varargin) + N = 24; + u = 0:2*pi/N:2*pi*(1-1/N); + + if length(varargin)==1 + var = varargin{1}; + if length(var)==1 + N = var; + u = 0:2*pi/N:2*pi*(1-1/N); + else + u = var; + end + end + + % ensure u vertical vector + if size(u, 1)==1 + u=u'; + end + + + h = zeros(size(u)); + + for i=1:length(u) + + v = repmat([cos(u(i)) sin(u(i))], [size(polygon, 1), 1]); + + h(i) = max(dot(polygon, v, 2)); + end + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-16 10:39:16
|
Revision: 10245 http://octave.svn.sourceforge.net/octave/?rev=10245&view=rev Author: jpicarbajal Date: 2012-04-16 10:39:05 +0000 (Mon, 16 Apr 2012) Log Message: ----------- geometry: Checking date INDEX and DESCRIPTION Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2012-04-16 10:33:04 UTC (rev 10244) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2012-04-16 10:39:05 UTC (rev 10245) @@ -1,6 +1,6 @@ Name: Geometry Version: 1.5.0 -Date: 2012-04-15 +Date: 2012-04-16 Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-04-16 10:33:04 UTC (rev 10244) +++ trunk/octave-forge/main/geometry/INDEX 2012-04-16 10:39:05 UTC (rev 10245) @@ -16,6 +16,7 @@ centroid distancePoints drawPoint + isCounterClockwise isPointOnRay isPointInCircle isPointOnCircle @@ -115,10 +116,15 @@ drawBezierCurve cbezier2poly 2D Polygons + curvature drawPolygon + oc_polybool + parametrize + reversePolyline + reversePolygon simplifypolygon simplifypolyline - oc_polybool + supportFunction 2D Piecewise polynomial shapes polygon2shape shape2polygon @@ -136,7 +142,6 @@ drawParabola drawShape hexagonalGrid - isCounterClockwise squareGrid triangleGrid Geometric graphs creation Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-04-16 10:33:04 UTC (rev 10244) +++ trunk/octave-forge/main/geometry/NEWS 2012-04-16 10:39:05 UTC (rev 10245) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the geometry package =============================================================================== -geometry-1.5.0 Release Date: 2012-04-15 Release Manager: Juan Pablo Carbajal +geometry-1.5.0 Release Date: 2012-04-16 Release Manager: Juan Pablo Carbajal =============================================================================== * Added functions: @@ -21,7 +21,7 @@ - reversePolygon.m and reversePolyline.m: reverse the orders of the points in of polygon/line. - - supportfunction.m: Compute support function of a polygon. + - supportFunction.m: Compute support function of a polygon. * Changed functions: - distancePointEdge.m: Now the function computes the distance between all points This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-04-19 09:44:44
|
Revision: 10293 http://octave.svn.sourceforge.net/octave/?rev=10293&view=rev Author: jpicarbajal Date: 2012-04-19 09:44:33 +0000 (Thu, 19 Apr 2012) Log Message: ----------- geometry: Adding solution to the belt problem in 2D. Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/inst/geom2d/beltproblem.m Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-04-19 09:13:52 UTC (rev 10292) +++ trunk/octave-forge/main/geometry/INDEX 2012-04-19 09:44:33 UTC (rev 10293) @@ -134,6 +134,7 @@ curveval curve2polyline 2D Others + beltproblem bisector crackPattern2 crackPattern Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-04-19 09:13:52 UTC (rev 10292) +++ trunk/octave-forge/main/geometry/NEWS 2012-04-19 09:44:33 UTC (rev 10293) @@ -5,6 +5,9 @@ =============================================================================== * Added functions: + - beltproblem.m : Finds the four lines tangent to two circles with given centers and + radii. This is the solution to the belt problem in 2D. + - curveval.m: Evaluates a polynomial curve defined as a 2-by-N matrix. - curve2polyline.m: Converts a polynomial curve into a polyline by the adaptive Added: trunk/octave-forge/main/geometry/inst/geom2d/beltproblem.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom2d/beltproblem.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom2d/beltproblem.m 2012-04-19 09:44:33 UTC (rev 10293) @@ -0,0 +1,136 @@ +%% Copyright (c) 2012 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {[@var{tangent},@var{inner}] = } beltproblem (@var{c}, @var{r}) +%% Finds the four lines tangent to two circles with given centers and radii. +%% +%% The function solves the belt problem in 2D for circles with center @var{c} and +%% radii @var{r}. +%% +%% @strong{INPUT} +%% @table @var +%% @item c +%% 2-by-2 matrix containig coordinates of the centers of the circles; one row per circle. +%% @item r +%% 2-by-1 vector with the radii of the circles. +%%@end table +%% +%% @strong{OUPUT} +%% @table @var +%% @item tangent +%% 4-by-4 matrix with the points of tangency. Each row describes a segment(edge). +%% @item inner +%% 4-by-2 vector with the point of intersection of the inner tangents (crossed belts) +%% with the segment that joins the centers of the two circles. If +%% the i-th edge is not an inner tangent then @code{inner(i,:)=[NaN,NaN]}. +%% @end table +%% +%% Example: +%% +%% @example +%% c = [0 0;1 3]; +%% r = [1 0.5]; +%% [T inner] = beltproblem(c,r) +%% @result{} T = +%% -0.68516 0.72839 1.34258 2.63581 +%% 0.98516 0.17161 0.50742 2.91419 +%% 0.98675 -0.16225 1.49338 2.91888 +%% -0.88675 0.46225 0.55663 3.23112 +%% +%% @result{} inner = +%% 0.66667 2.00000 +%% 0.66667 2.00000 +%% NaN NaN +%% NaN NaN +%% +%% @end example +%% +%% @seealso{edges2d} +%% @end deftypefn + +function [edgeTan inner] = beltproblem(c,r) + + x0 = [c(1,1) c(1,2) c(2,1) c(2,2)]; + r0 = r([1 1 2 2]); + + middleEdge = createEdge(c(1,:),c(2,:)); + + ind0 = [1 0 1 0; 0 1 1 0; 1 1 1 0; -1 0 1 0; 0 -1 1 0; -1 -1 1 0;... + 1 0 0 1; 0 1 0 1; 1 1 0 1; -1 0 0 1; 0 -1 0 1; -1 -1 0 1;... + 1 0 1 1; 0 1 1 1; 1 1 1 1; -1 0 1 1; 0 -1 1 1; -1 -1 1 1;... + 1 0 -1 0; 0 1 -1 0; 1 1 -1 0; -1 0 -1 0; 0 -1 -1 0; -1 -1 -1 0;... + 1 0 0 -1; 0 1 0 -1; 1 1 0 -1; -1 0 0 -1; 0 -1 0 -1; -1 -1 0 -1;... + 1 0 -1 -1; 0 1 -1 -1; 1 1 -1 -1; -1 0 -1 -1; 0 -1 -1 -1; -1 -1 -1 -1]; + nInit = size(ind0,1); + ir = randperm(nInit); + edgeTan = zeros(4,4); + inner = zeros(4,2); + nSol = 0; + i=1; + + %% Solve for 2 different lines + while nSol<4 && i<nInit + ind = find(ind0(ir(i),:)~=0); + x = x0; + x(ind)=x(ind)+r0(ind); + [sol f0 nev]= fsolve(@(x)belt(x,c,r),x); + if nev~=1 + perror('fsolve',nev) + end + + for j=1:4 + notequal(j) = all(abs(edgeTan(j,:)-sol) > 1e-6); + end + if all(notequal) + nSol = nSol+1; + edgeTan(nSol,:) = createEdge(sol(1:2),sol(3:4)); + % Find innerTangent + inner(nSol,:) = intersectEdges(middleEdge,edgeTan(nSol,:)); + end + + i = i+1; + end + +endfunction + +function res = belt(x,c,r) + res = zeros(4,1); + + res(1,1) = (x(3:4) - c(2,1:2))*(x(3:4) - x(1:2))'; + res(2,1) = (x(1:2) - c(1,1:2))*(x(3:4) - x(1:2))'; + res(3,1) = sumsq(x(1:2) - c(1,1:2)) - r(1)^2; + res(4,1) = sumsq(x(3:4) - c(2,1:2)) - r(2)^2; + +end + +%!demo +%! c = [0 0;1 3]; +%! r = [1 0.5]; +%! [T inner] = beltproblem(c,r) +%! +%! figure(1) +%! clf +%! h = drawEdge(T); +%! set(h(find(~isnan(inner(:,1)))),'color','r'); +%! set(h,'linewidth',2); +%! hold on +%! drawCircle([c(1,:) r(1); c(2,:) r(2)],'linewidth',2); +%! axis tight +%! axis equal +%! +%! % ------------------------------------------------------------------- +%! % The circles with the tangents edges are plotted. The solution with +%! % crossed belts (inner tangets) is shown in red. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-05-04 09:10:03
|
Revision: 10359 http://octave.svn.sourceforge.net/octave/?rev=10359&view=rev Author: jpicarbajal Date: 2012-05-04 09:09:56 +0000 (Fri, 04 May 2012) Log Message: ----------- geometry: polygons2d Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-05-04 09:06:45 UTC (rev 10358) +++ trunk/octave-forge/main/geometry/INDEX 2012-05-04 09:09:56 UTC (rev 10359) @@ -117,13 +117,22 @@ cbezier2poly 2D Polygons curvature + distancePolygons + distancePointPolygon + distancePointPolyline drawPolygon + expandPolygon + medialAxisConvex oc_polybool parametrize + polygonLoops + polygonSelfIntersections + polylineSelfIntersections reversePolyline reversePolygon simplifypolygon simplifypolyline + splitPolygons supportFunction 2D Piecewise polynomial shapes polygon2shape Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-05-04 09:06:45 UTC (rev 10358) +++ trunk/octave-forge/main/geometry/NEWS 2012-05-04 09:09:56 UTC (rev 10359) @@ -26,6 +26,10 @@ - supportFunction.m: Compute support function of a polygon. + - distancePointPolygon.m, distancePointPolyline.m, distancePolygons.m , + expandPolygon.m, medialAxisConvex.m, polygonLoops.m, polygonSelfIntersections.m + polylineSelfIntersections.m, splitPolygons.m + * Changed functions: - distancePointEdge.m: Now the function computes the distance between all points and all edges. A third optional argument provides This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-05-16 08:00:54
|
Revision: 10448 http://octave.svn.sourceforge.net/octave/?rev=10448&view=rev Author: jpicarbajal Date: 2012-05-16 08:00:43 +0000 (Wed, 16 May 2012) Log Message: ----------- geometry: Adding file from Simeneon Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2012-05-15 20:40:30 UTC (rev 10447) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2012-05-16 08:00:43 UTC (rev 10448) @@ -1,7 +1,7 @@ Name: Geometry Version: 1.5.0 Date: 2012-04-16 -Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...> +Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...>, Simeon Simeonov <ss...@ca...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Description: Library for geometric computing extending MatGeom functions. Useful to create, transform, manipulate and display geometric primitives. Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-05-15 20:40:30 UTC (rev 10447) +++ trunk/octave-forge/main/geometry/INDEX 2012-05-16 08:00:43 UTC (rev 10448) @@ -14,6 +14,7 @@ polygons2d 2D Points centroid + closed_path distancePoints drawPoint isCounterClockwise Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-05-15 20:40:30 UTC (rev 10447) +++ trunk/octave-forge/main/geometry/NEWS 2012-05-16 08:00:43 UTC (rev 10448) @@ -30,6 +30,9 @@ expandPolygon.m, medialAxisConvex.m, polygonLoops.m, polygonSelfIntersections.m polylineSelfIntersections.m, splitPolygons.m + - close_path.m : given a set of points in the plane calculate a piecewise linear + simple path that passes through all points. + * Changed functions: - distancePointEdge.m: Now the function computes the distance between all points and all edges. A third optional argument provides Added: trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/geom2d/closed_path.m 2012-05-16 08:00:43 UTC (rev 10448) @@ -0,0 +1,105 @@ +%% Copyright (C) 2012 Simeon Simeonov <sim...@gm...> +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 3 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, see <http://www.gnu.org/licenses/>. +%% +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{y} =} polygon (@var{x}) +%% Returns a simple closed path that passes through all the points in x. +%% x is a vector containing 2D coordinates of the points. +%% +%% @end deftypefn + +%% Author: Simeon Simeonov <sim...@gm...> + +function y = closed_path(x) + + if(size(x,1) > 1 && size(x,1) < size(x,2)) + x = x'; + end + + N = size(x,1); % Number of points + idx = zeros(N, 1); % ind contains the indices of the sorted coordinates + + a = find(x(:,2)==min(x(:,2))); + + if(size(a,1) > 1) + [~, i] = sort(x(a,1)); + a = a(i(1)); + end + + x_1 = x(x(:,2)==x(a,2),:); % find all x with the same y coordinate + + if(x(a,1) == min(x(:,1))) + x_2 = x(x(:,1)==x(a,1),:); % find all x with the same x coordinate + else + x_2 = x(a,:); + end + + if(size(x_1,1) > 1 || size(x_2,1) > 1) + if(size(x_1,1) > 1) + x_1 = sort(x_1); % Sort by x coordinate + y(1,:) = x(a,:); % original starting point + end + + if (size(x_2,1) > 1) + x_2 = sort(x_2, 'descend'); + end + + x_not = [x_1; x_2]; + i = ismember(x,x_not,'rows'); + x(i, :) = []; + x = [x_1(size(x_1,1),:); x]; + x_1(size(x_1, 1),:) = []; + N = size(x,1); + a = 1; + else + x_1 = []; + x_2 = x(a,:); + end + d = x - repmat(x(a,:), N, 1); + th = d(:,2)./(d(:,1) + d(:,2)); + + [~, idx0] = ismember(sort(th(th==0)), th); + [~, idx1] = ismember(sort(th(th>0)), th); + [~, idx2] = ismember(sort(th(th<0)), th); + + idx = [a; idx0; idx1; idx2]; + % I contains the indices of idx in a sorted order. [v i] = sort(idx) then + % i==I. + [~,I,J]= unique(idx); + if(size(I,1) ~= size(J,1)) + R = histc(J, 1:size(I,1)); % R(1) will always be 1? + idx_sorted = idx(I); + r = find(R>1); + for ri = r' + idx_repeated = idx_sorted(ri); + idx(idx==idx_repeated) = find(th==th(idx_sorted(ri))); + end + end + + y = [x_1; x(idx,:); x_2;]; + +endfunction + +%!demo +%! maxInt = 100; +%! N = 25; +%! +%! for i = 1:5 +%! x = randi(maxInt, N, 2); +%! y = closed_path(x); +%! plot(y(:,1), y(:,2), '*'); +%! hold on; +%! plot(y(:,1), y(:,2)); +%! end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-06-05 12:26:58
|
Revision: 10567 http://octave.svn.sourceforge.net/octave/?rev=10567&view=rev Author: jpicarbajal Date: 2012-06-05 12:26:47 +0000 (Tue, 05 Jun 2012) Log Message: ----------- geometry: conversion form ellipse to covariance matrices. Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-06-05 12:23:02 UTC (rev 10566) +++ trunk/octave-forge/main/geometry/INDEX 2012-06-05 12:26:47 UTC (rev 10567) @@ -98,9 +98,11 @@ intersectLineCircle radicalAxis 2D Ellipses - ellipseAsPolygon + cov2ellipse drawEllipseArc drawEllipse + ellipseAsPolygon + ellipse2cov inertiaEllipse 2D Transformations transformLine Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-06-05 12:23:02 UTC (rev 10566) +++ trunk/octave-forge/main/geometry/NEWS 2012-06-05 12:26:47 UTC (rev 10567) @@ -5,6 +5,8 @@ =============================================================================== * Added functions: + - cov2ellipse.m & ellipse2cov: transform between ellipses and covariances matrices. + - beltproblem.m : Finds the four lines tangent to two circles with given centers and radii. This is the solution to the belt problem in 2D. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-06-05 13:52:19
|
Revision: 10569 http://octave.svn.sourceforge.net/octave/?rev=10569&view=rev Author: jpicarbajal Date: 2012-06-05 13:52:10 +0000 (Tue, 05 Jun 2012) Log Message: ----------- geometry: conversion form ellipse to covariance matrices. Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/NEWS trunk/octave-forge/main/geometry/inst/geom2d/ellipse2cov.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2012-06-05 13:39:37 UTC (rev 10568) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2012-06-05 13:52:10 UTC (rev 10569) @@ -1,6 +1,6 @@ Name: Geometry Version: 1.5.0 -Date: 2012-04-16 +Date: 2012-06-05 Author: David Legland <dav...@gr...>, José Luis García Pallero <jgp...@gm...>, Juan Pablo Carbajal <car...@if...>, Simeon Simeonov <ss...@ca...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-06-05 13:39:37 UTC (rev 10568) +++ trunk/octave-forge/main/geometry/NEWS 2012-06-05 13:52:10 UTC (rev 10569) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the geometry package =============================================================================== -geometry-1.5.0 Release Date: 2012-04-16 Release Manager: Juan Pablo Carbajal +geometry-1.5.0 Release Date: 2012-06-05 Release Manager: Juan Pablo Carbajal =============================================================================== * Added functions: Modified: trunk/octave-forge/main/geometry/inst/geom2d/ellipse2cov.m =================================================================== --- trunk/octave-forge/main/geometry/inst/geom2d/ellipse2cov.m 2012-06-05 13:39:37 UTC (rev 10568) +++ trunk/octave-forge/main/geometry/inst/geom2d/ellipse2cov.m 2012-06-05 13:52:10 UTC (rev 10569) @@ -20,7 +20,7 @@ %% Calculates covariance matrix from ellipse. %% %% If only one input is given, @var{elli} must define an ellipse as described in -%% @coomand{ellipses2d}. +%% @command{ellipses2d}. %% If two inputs are given, @var{ra} and @var{rb} define the half-lenght of the %% axes. %% If a third input is given, @var{theta} must be the angle of rotation of the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 21:17:46
|
Revision: 11053 http://octave.svn.sourceforge.net/octave/?rev=11053&view=rev Author: jpicarbajal Date: 2012-09-19 21:17:37 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Starting port of geom3d Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS trunk/octave-forge/main/geometry/PKG_ADD trunk/octave-forge/main/geometry/PKG_DEL Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/INDEX 2012-09-19 21:17:37 UTC (rev 11053) @@ -157,6 +157,13 @@ hexagonalGrid squareGrid triangleGrid +3D Descriptive + geom3d_Contents + angles3d + boxes3d + circles3d +3D Points + anglePoints3d Geometric graphs creation delaunayGraph.m knnGraph.m Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/NEWS 2012-09-19 21:17:37 UTC (rev 11053) @@ -1,8 +1,11 @@ Summary of important user-visible changes for releases of the geometry package =============================================================================== -geometry-1.5.1 Release Date: 2012-xx-xx Release Manager: Juan Pablo Carbajal +geometry-1.6.0 Release Date: 2012-xx-xx Release Manager: Juan Pablo Carbajal =============================================================================== +* Added Functions + anglePoints3d.m angles3d.m boxes3d.m geom3d_Contents.m + * Bug Fixes: - drawArrow.m was not working due to porting errors. Modified: trunk/octave-forge/main/geometry/PKG_ADD =================================================================== --- trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 21:17:37 UTC (rev 11053) @@ -1,5 +1,5 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs","geom3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), @@ -15,21 +15,15 @@ % The package is not installed yet [pkg_folder dep_folder] = pkg ("prefix"); pkg_folder = [pkg_folder strcat(filesep(),{pp{end-1:end}}){:} ]; -% dep_folder = [dep_folder strcat(filesep(),{pp{end-1:end}}){:} ]; if strcmp (arch , pp{end}) %% If we are in Architecture dependent folder add from outside pkg_folder = strsplit (pkg_folder,filesep (), true); pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; -% dep_folder = strsplit (dep_folder,filesep (), true); -% dep_folder = [strcat(filesep(),{dep_folder{1:end-1}}){:}]; end else pkg_folder = pkg_data{1}.dir; -% dep_folder = pkg_data{1}.archprefix; end -%dep_folder = [dep_folder filesep arch]; - if (! exist (fullfile (dirname, "inst"), "dir")) %% Installing for ii=1:length (dirlist) @@ -43,9 +37,7 @@ addpath ([ dirname "/inst/" dirlist{ii}]) endfor endif -%addpath (dep_folder) warning('off', 'Octave:fopen-file-in-path'); clear dirlist dirname pp arch pkg_folder clear global_packages ii installed_pkgs_lst local_packages pkg_data -%dep_folder Modified: trunk/octave-forge/main/geometry/PKG_DEL =================================================================== --- trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 09:23:37 UTC (rev 11052) +++ trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 21:17:37 UTC (rev 11053) @@ -1,5 +1,5 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs","geom3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), @@ -14,21 +14,15 @@ % The package is not installed yet [pkg_folder dep_folder] = pkg ("prefix"); pkg_folder = [pkg_folder strcat(filesep(),{pp{end-1:end}}){:} ]; -% dep_folder = [dep_folder strcat(filesep(),{pp{end-1:end}}){:} ]; if strcmp (arch , pp{end}) %% If we are in Architecture dependent folder add from outside pkg_folder = strsplit (pkg_folder,filesep (), true); pkg_folder = [strcat(filesep(),{pkg_folder{1:end-1}}){:}]; -% dep_folder = strsplit (dep_folder,filesep (), true); -% dep_folder = [strcat(filesep(),{dep_folder{1:end-1}}){:}]; end else pkg_folder = pkg_data{1}.dir; -% dep_folder = pkg_data{1}.archprefix; end -%dep_folder = [dep_folder filesep arch]; - if (! exist (fullfile (dirname, "inst"), "dir")) ## Run this if the package is installed for ii=1:length (dirlist) @@ -40,7 +34,5 @@ rmpath ([ dirname "/inst/" dirlist{ii}]) endfor endif -%rmpath (dep_folder); clear dirlist dirname pp arch pkg_folder -%dep_folder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 22:20:32
|
Revision: 11056 http://octave.svn.sourceforge.net/octave/?rev=11056&view=rev Author: jpicarbajal Date: 2012-09-19 22:20:26 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Ported all content files Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/NEWS Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2012-09-19 22:10:39 UTC (rev 11055) +++ trunk/octave-forge/main/geometry/INDEX 2012-09-19 22:20:26 UTC (rev 11056) @@ -159,17 +159,25 @@ triangleGrid 3D Descriptive geom3d_Contents + meshes3d_Contents angles3d boxes3d circles3d + lines3d + planes3d + points3d + polygons3d + vectors3d 3D Points anglePoints3d +Geometric graphs descriptive + graphs_Contents Geometric graphs creation - delaunayGraph.m - knnGraph.m - voronoi2d.m + delaunayGraph + knnGraph + voronoi2d Geometric graphs visualization - drawGraph.m + drawGraph Geometric graphs manipulation Input @svg/svg Modified: trunk/octave-forge/main/geometry/NEWS =================================================================== --- trunk/octave-forge/main/geometry/NEWS 2012-09-19 22:10:39 UTC (rev 11055) +++ trunk/octave-forge/main/geometry/NEWS 2012-09-19 22:20:26 UTC (rev 11056) @@ -4,8 +4,9 @@ =============================================================================== * Added Functions anglePoints3d.m angles3d.m boxes3d.m geom3d_Contents.m + lines3d.m planes3d.m points3d.m polygons3d.m + vectors3d.m graphs_Contents.m meshes3d_Contents.m - * Bug Fixes: - drawArrow.m was not working due to porting errors. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2012-09-19 22:21:35
|
Revision: 11057 http://octave.svn.sourceforge.net/octave/?rev=11057&view=rev Author: jpicarbajal Date: 2012-09-19 22:21:29 +0000 (Wed, 19 Sep 2012) Log Message: ----------- geometry: Ported all content files Modified Paths: -------------- trunk/octave-forge/main/geometry/PKG_ADD trunk/octave-forge/main/geometry/PKG_DEL Modified: trunk/octave-forge/main/geometry/PKG_ADD =================================================================== --- trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 22:20:26 UTC (rev 11056) +++ trunk/octave-forge/main/geometry/PKG_ADD 2012-09-19 22:21:29 UTC (rev 11057) @@ -1,5 +1,6 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs","geom3d"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip", "graphs",... + "geom3d","meshes3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), Modified: trunk/octave-forge/main/geometry/PKG_DEL =================================================================== --- trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 22:20:26 UTC (rev 11056) +++ trunk/octave-forge/main/geometry/PKG_DEL 2012-09-19 22:21:29 UTC (rev 11057) @@ -1,5 +1,6 @@ %1 -dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs","geom3d"}; +dirlist = {"geom2d","io","polygons2d","shape2d","octclip","graphs",... + "geom3d","meshes3d"}; dirname = fileparts (canonicalize_file_name (mfilename ("fullpath"))); pp = strsplit (dirname,filesep (), true); arch = cstrcat (octave_config_info ("canonical_host_type"), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |