Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## jts-topo-suite-user

 [Jts-topo-suite-user] Sorting Geometry polygons over edge adjacency From: Brian Sanjeewa Rupasinghe - 2013-04-19 16:01:46 Attachments: Message as HTML ```Hi, I have a set of triangles in an Geometry array which together forms a connected strip when placed them according to edge adjacency. However, in the array they are not in order based on the edge adjacency. How can i rearrange (sort) them in the array? Best, Brian. ```
 Re: [Jts-topo-suite-user] Sorting Geometry polygons over edge adjacency From: Martin Davis - 2013-04-19 20:07:58 Attachments: Message as HTML ```To do this you need to perform a topological sort, where the triangles are the nodes of the graph and the edge-adjacency provides the graph edges. Since you know the graph is a single line, the sort actually devolves into finding a node with only one other adjacent triangle, and then traversing the graph visiting all the other triangles in turn. Also, since you know that each node has a maximum of two adjacent nodes, you could model the graph using two arrays. A more natural solution would be to create a node object with two references to the adjacent nodes. The sort itself is linear. The hard part is finding the adjacency graph. To do this I would create normalized LineSegments for each edge, You can then use a Map to look up the adjacent triangles. On Fri, Apr 19, 2013 at 9:01 AM, Brian Sanjeewa Rupasinghe < jinkabs@...> wrote: > Hi, > > I have a set of triangles in an Geometry array which together forms a > connected strip when placed them according to edge adjacency. However, in > the array they are not in order based on the edge adjacency. How can i > rearrange (sort) them in the array? > > Best, Brian. > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Jts-topo-suite-user mailing list > Jts-topo-suite-user@... > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > > ```
 Re: [Jts-topo-suite-user] Sorting Geometry polygons over edge adjacency From: Stefan Steiniger - 2013-04-25 14:36:37 ```mhm.. how about a "geometric perspective": couldn't you sort based on using the coordinates of the bounding boxes? But well, for that you would need to know the direction of the strip and maybe transform it to an axes direction? stefan Am 19.04.13 16:07, schrieb Martin Davis: > To do this you need to perform a topological sort, where the triangles > are the nodes of the graph and the edge-adjacency provides the graph > edges. Since you know the graph is a single line, the sort actually > devolves into finding a node with only one other adjacent triangle, and > then traversing the graph visiting all the other triangles in turn. > > Also, since you know that each node has a maximum of two adjacent nodes, > you could model the graph using two arrays. A more natural solution > would be to create a node object with two references to the adjacent nodes. > > The sort itself is linear. The hard part is finding the adjacency > graph. To do this I would create normalized LineSegments for each edge, > You can then use a Map to look up the adjacent triangles. > > > On Fri, Apr 19, 2013 at 9:01 AM, Brian Sanjeewa Rupasinghe > > wrote: > > Hi, > > I have a set of triangles in an Geometry array which together forms > a connected strip when placed them according to edge adjacency. > However, in the array they are not in order based on the edge > adjacency. How can i rearrange (sort) them in the array? > > Best, Brian. > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for > building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Jts-topo-suite-user mailing list > Jts-topo-suite-user@... > > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > Jts-topo-suite-user mailing list > Jts-topo-suite-user@... > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > ```