Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing CGAL #1188

Merged
merged 202 commits into from
Mar 6, 2019
Merged

Removing CGAL #1188

merged 202 commits into from
Mar 6, 2019

Conversation

cvvergara
Copy link
Member

This PR removes CGAL, GMP and MTFR dependencies.

For that purpose, the underlying code for the alpha shape algorithm had to be written to fulfill pgrouting way of using CGAL's alphashape.

Note that an alpha shape consists on a collection of polygons, lines and points, but pgRouting has being using only the polygons. So the algorithm implemented in this PR ignores lines and points that are part of an alpha shape, just as the lines and points were ignored from CGAL results.

The pgr_alphaShape is useless by itself (its the "core" function), unless its being used using pgr_pointsAsPolygons which converts the output of pgr_alphaShape to polygon geometries.

The implementation this PR is proposing:

  • currently named pgr_alphaShape1 (see TODO)
  • receives as input an array of geometries
    • can be geometry collections, polygons, lines, points
  • output a MUTIPOLYGON, or GEOMETRYCOLLECTION EMPTY when no polygon is found
  • The parameter "alpha" in CGAL is the square of the spoon radius VS in this implementation the parameter is the spoon radius. (see TODO)
  • The algorithm implemented is based on Delauny Triangles that are calculated using PostGIS ST_DelaunyTriangles, The Triangle Area is accepted as part of the alpha shape result when the triangles circumcenter's radius r < spoon radius.
  • This implementation was tested against the current results returned with [CGAL]
    (https://github.com/cvvergara/pgrouting/blob/a4f91e45311b5df760ed3fa887610384b4dcae78/tools/testers/alphaShapeTester.sql#L49)

TODO

Keep in mind that pgRouting focus is not on geometries, so once PostGIS has an alpha shape function, say ST_AlphaShape, that returns a geometry collection of polygons lines and points, then this "specialization" will be just a wrapper of such a function that extracts the polygon part.

Give an appropriate name to this function

  • pgr_alphaShape:

    • pgr gives an idea that is not an ST_AlphaShape
    • alphaShape its not returning the complete alpha shape, only the polygon part of the alpha shape, so its not really the alpha shape but gives an idea that is an specialization of the alpha shape.
    • rename the parameter: instead of alpha, use spoon radius, also gives the idea that is not THE alpha shape.
  • pgr_pointsAsPolygons:

    • points: Consider that it receives geometries, not only points in the form id, x, y
    • AsPolygon: a polygon could be the convex hull, the concave Hull, the polygon part of an alphaShape.

Move to legacy pgr_alphaShape & pgr_pointsAsPolygons

  • pgr_pointsAsPolygons & pgr_alphaShape have being rewritten as wrappers of the new implemented function, and the wrappers have being tested.
  • move the wrappers to legacy.
  • remove the tests that compare old code with new code

Documentation

  • update the documentation appropriately

@pgRouting/admins

	modified:   src/common/coordinates_input.c
	modified:   src/common/delauny_input.c
	modified:   src/common/edges_input.c
	modified:   src/common/matrixRows_input.c
	modified:   src/common/orders_input.c
	modified:   src/common/pgr_point_input.c
	modified:   src/common/points_input.c
	modified:   src/common/restrictions_input.c
	modified:   include/contraction/pgr_contractionGraph.hpp
	modified:   include/cpp_common/basePath_SSEC.hpp
	modified:   include/dijkstra/pgr_dijkstra.hpp
	modified:   include/mst/pgr_mst.hpp
	modified:   include/mst/pgr_prim.hpp
	modified:   src/allpairs/johnson_driver.cpp
	modified:   src/components/articulationPoints_driver.cpp
	modified:   src/components/biconnectedComponents_driver.cpp
	modified:   src/components/bridges_driver.cpp
	modified:   src/components/connectedComponents_driver.cpp
	modified:   src/components/strongComponents_driver.cpp
	modified:   src/contraction/contractGraph_driver.cpp
	modified:   src/lineGraph/lineGraphFull_driver.cpp
	modified:   src/lineGraph/lineGraph_driver.cpp
	modified:   src/mincut/stoerWagner_driver.cpp
	modified:   src/mst/randomSpanningTree_driver.cpp
	modified:   src/pickDeliver/pickDeliverEuclidean_driver.cpp
	modified:   include/cpp_common/pgr_base_graph.hpp
	modified:   include/yen/pgr_ksp.hpp
	modified:   src/common/edges_input.c
	modified:   src/common/vehicles_input.c
	modified:   src/trsp/GraphDefinition.cpp
	modified:   src/trsp/pgr_trspHandler.cpp
	modified:   src/trsp/trsp.c
	modified:   include/max_flow/pgr_maxflow.hpp
	modified:   include/astar/pgr_astar.hpp
	modified:   include/cpp_common/basePath_SSEC.hpp
	modified:   include/cpp_common/basic_vertex.h
	modified:   include/dagShortestPath/pgr_dagShortestPath.hpp
	modified:   include/dijkstra/pgr_dijkstra.hpp
	modified:   include/dijkstra/pgr_dijkstraVia.hpp
	modified:   include/tsp/pgr_tsp.hpp
	modified:   src/common/basic_vertex.cpp
	modified:   src/contraction/contractGraph_driver.cpp
	modified:   src/ksp/turnRestrictedPath_driver.cpp
	modified:   include/cpp_common/basePath_SSEC.hpp
	modified:   include/cpp_common/pgr_bidirectional.hpp
	modified:   include/lineGraph/pgr_lineGraphFull.hpp
	modified:   include/yen/pgr_ksp.hpp
	modified:   include/yen/pgr_turnRestrictedPath.hpp
	modified:   include/max_flow/pgr_maxflow.hpp
@cvvergara
Copy link
Member Author

cvvergara commented Mar 5, 2019

@cayetanobv this PR I think is ready for merge, how can we work it out:

  • I do the merge then you do the change in docker and I fix later on other PR if something is worng

@robe2

  • I do the merge then adjust debbie, jenkins, bessie to not compile with CGAL, we can fix on other PR any adjustments needed for the builds

@cayetanobv
Copy link
Member

@cvvergara when you merge this PR I will merge this: pgRouting/docker-pgrouting#9
Could you review it?

@cvvergara cvvergara merged commit 90cec4d into pgRouting:develop Mar 6, 2019
@cvvergara cvvergara deleted the alpha branch March 8, 2019 23:09
marsam added a commit to r-ryantm/nixpkgs that referenced this pull request May 23, 2020
cvvergara added a commit to cvvergara/pgrouting that referenced this pull request Aug 26, 2021
lbartoletti added a commit to lbartoletti/cgal-web that referenced this pull request May 17, 2023
pgRouting no longer uses CGAL since pgRouting/pgrouting#1188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants