2011/11/20 José Luis García Pallero <jgpall...@gmail.com>: > 2011/11/20 Juan Pablo Carbajal <carba...@ifi.uzh.ch>: >> 2011/11/20 José Luis García Pallero <jgpall...@gmail.com>: >>> 2011/11/20 Carnë Draug <carandraug+...@gmail.com>: >>>> On 19 November 2011 00:40, Tobias Andersson <xyzto...@hotmail.com> wrote: >>>>> First of all, hi everyone! I'm new here and hope that this is the right >>>>> way >>>>> to post bug reports. Otherwise, please inform me how to do it. >>>>> Now, I installed octclip to find intersections between polygons and found >>>>> an >>>>> odd behaviour when sections of different polygons follow the same line. >>>>> Also, Strange results are returned when a section "touches" a point in the >>>>> other polygon. >>>>> The problem is that the result in the first example should be one polygon >>>>> and that the result in the second example should be a polygon without the >>>>> duplicate point [2.4 2.4]. >>>>> I thank you for updating the package or advising me if I think wrong on >>>>> how >>>>> the functionality should be. >>>>> >>>>> >>>>> Two example codes are shown below so that you can rerun the script >>>>> yourselves: >>>>> 1. Sections of different polygons follow the same line: >>>>> % This is a script to generate a polygon and plot it in a figure and find >>>>> intersection >>>>> polygons(1).p = [ 2.2 2.2; >>>>> 3.4 3.4; >>>>> 6.3 3.4; >>>>> 5.3 2.8; >>>>> 3.3 2.4]; >>>>> polygons(2).p = [ 1.2 2.2; >>>>> 3.4 3.4; >>>>> 5.3 3.4; >>>>> 5.3 2.8; >>>>> 4.4 2.3; >>>>> 3.3 1.7]+5; >>>>> polygons(2).p = polygons(2).p + [1*ones(size(polygons(2).p,1),1) >>>>> 0*ones(size(polygons(2).p,1),1)]; >>>>> plot(polygons(1).p(:,1),polygons(1).p(:,2),'*-'); >>>>> hold on >>>>> plot(polygons(1).p([end 1],1),polygons(1).p([end 1],2),'*-'); >>>>> >>>>> plot(polygons(2).p(:,1),polygons(2).p(:,2),'*-.k'); >>>>> plot(polygons(2).p([end 1],1),polygons(2).p([end 1],2),'*:k'); >>>>> hold off >>>>> [X,Y,nPol,nInt,nPert] = _oc_polybool(polygons(2).p,polygons(1).p,'AND'); >>>>> fprintf('runPolygonShowNonIntersecting.m\n') >>>>> fprintf('Numbers of polygons found: %i\n',nPol) >>>>> >>>>> >>>>> 2. A section "touches" a point in the other polygon: >>>>> % This is a script to generate a polygon and plot it in a figure and find >>>>> intersection >>>>> polygons(1).p = [ 2.2 2.2; >>>>> 3.4 3.4; >>>>> 6.3 3.4; >>>>> 5.3 2.8; >>>>> 3.3 2.4]; >>>>> polygons(2).p = [ 1.2 2.2; >>>>> 3.4 3.4; >>>>> 5.3 3.4; >>>>> 5.3 2.8; >>>>> 4.4 2.3; >>>>> 3.3 1.7]+0.2; >>>>> polygons(2).p = polygons(2).p + [1*ones(size(polygons(2).p,1),1) >>>>> 0*ones(size(polygons(2).p,1),1)]; >>>>> plot(polygons(1).p(:,1),polygons(1).p(:,2),'*-'); >>>>> hold on >>>>> plot(polygons(1).p([end 1],1),polygons(1).p([end 1],2),'*-'); >>>>> >>>>> plot(polygons(2).p(:,1),polygons(2).p(:,2),'*-.k'); >>>>> plot(polygons(2).p([end 1],1),polygons(2).p([end 1],2),'*:k'); >>>>> hold off >>>>> [X,Y,nPol,nInt,nPert] = _oc_polybool(polygons(2).p,polygons(1).p,'AND'); >>>>> fprintf('runPolygonShowNonIntersecting.m\n') >>>>> fprintf('Numbers of polygons found: %i\n',nPol) >>>> >>>> Hi Tobias >>>> >>>> do you think you can submit a patch? Anyway, I'm also sending this >>>> e-mail to the dev who wrote this function, he's probably the best >>>> person to fix anything about the package. >>>> >>>> Carnë >>>> >>> >>> Hello, >>> >>> Tobias, I don't understand when you say that in the first example the >>> result should be one polygon. You perform the 'AND' operation but the >>> two polygons in your example are disjoints, so they have no >>> intersection. The second example runs well for me. Please, see the >>> attached *.png files with the results of your examples in my computer >>> (in the second one I have added in red the resulting polygon). >>> >>> Take in account too that I implement the Greiner-Hormann algorithm >>> which is not robust when a point or an edge of one polygon coincides >>> with a point or an edge of the other. Please, see >>> http://davis.wpi.edu/~matt/courses/clipping/ for more details. >>> >>> About OctCLIP, you should use the oc_polybool function (is a *.m >>> script) instead of the _oc_polybool one (is the *.oct function) >>> >>> Cheers >>> >>> -- >>> ***************************************** >>> José Luis García Pallero >>> jgpall...@gmail.com >>> (o< >>> / / \ >>> V_/_ >>> Use Debian GNU/Linux and enjoy! >>> ***************************************** >>> >>> ------------------------------------------------------------------------------ >>> All the data continuously generated in your IT infrastructure >>> contains a definitive record of customers, application performance, >>> security threats, fraudulent activity, and more. Splunk takes this >>> data and makes sense of it. IT sense. And common sense. >>> http://p.sf.net/sfu/splunk-novd2d >>> _______________________________________________ >>> Octave-dev mailing list >>> Octave-dev@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/octave-dev >>> >>> >> >> Hi all, >> >> The geomtry package also has functions to deal with polygons in 2D. >> >> Is there a chance that we merge the octclip and geometry package? >> At least it would be good to know what is already implemented in both >> packages and if possible benchmark them. > > Hi Pablo, > > The OctCLIP has only one function for performs general polygon > clipping using the Greiner-Hormann algorithm (see > http://davis.wpi.edu/~matt/courses/clipping/). I see that the geometry > package is the Octave implementation of MatGeom for MatLab that has > one function for polygon clipping when the clipper polygon is a > rectangular box and the clipped one is convex. The Greiner-Hormann > algorithm can work with general polygons so it could be used in the > clipping function in geometry. I see too that this function is not > implemented in the geometry package. But I would like to maintain > alive the OctCLIP package because for me is easier to maintain > > -- > ***************************************** > José Luis García Pallero > jgpall...@gmail.com > (o< > / / \ > V_/_ > Use Debian GNU/Linux and enjoy! > ***************************************** >
I see your point. I can suggest the following courses of action: 1. You accept to be a maintainer of the geometry package (which indeed is an extension of MatGeom since it handles piecewise polynomial polygons http://octave.sourceforge.net/geometry/function/shapetransform.html) and we merge the two packages. Geometry accepts a sub-folder structure, therefore you will continue maintaining ONLY the octCLIP folder. I can take care of the merging if you accept this proposal. 2. Geometry can add a wrapper that calls your function. This is clean but has the drawback that the user needs to install more packages and the dependency list grows. I strongly suggest 1. However I do not want you to feel that geometry is assimilating your package (we are not the Borg!). Geometry will be your package and your package will be everything else that geometry has. We will just clean up a little the repository and strengthen our packages. Looking forward to your answer. -- M. Sc. Juan Pablo Carbajal ----- PhD Student University of Zürich http://ailab.ifi.uzh.ch/carbajal/ ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev