pathplan.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * @file
  3. * @brief finds and smooths shortest paths
  4. * @ingroup public_apis
  5. *
  6. * **libpathplan** provides functions for creating spline paths in the plane
  7. * that are constrained by a polygonal boundary or obstacles to avoid.
  8. * All polygons must be simple, but need not be convex.
  9. *
  10. * [man 3 pathplan](https://graphviz.org/pdf/pathplan.3.pdf)
  11. *
  12. */
  13. /*************************************************************************
  14. * Copyright (c) 2011 AT&T Intellectual Property
  15. * All rights reserved. This program and the accompanying materials
  16. * are made available under the terms of the Eclipse Public License v1.0
  17. * which accompanies this distribution, and is available at
  18. * https://www.eclipse.org/legal/epl-v10.html
  19. *
  20. * Contributors: Details at https://graphviz.org
  21. *************************************************************************/
  22. #pragma once
  23. #include "pathgeom.h"
  24. #include <stddef.h>
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #ifdef GVDLL
  29. #ifdef PATHPLAN_EXPORTS
  30. #define PATHPLAN_API __declspec(dllexport)
  31. #else
  32. #define PATHPLAN_API __declspec(dllimport)
  33. #endif
  34. #endif
  35. #ifndef PATHPLAN_API
  36. #define PATHPLAN_API /* nothing */
  37. #endif
  38. /* find shortest euclidean path within a simple polygon */
  39. PATHPLAN_API int Pshortestpath(Ppoly_t * boundary, Ppoint_t endpoints[2],
  40. Ppolyline_t * output_route);
  41. /* fit a spline to an input polyline, without touching barrier segments */
  42. PATHPLAN_API int Proutespline(Pedge_t *barriers, size_t n_barriers,
  43. Ppolyline_t input_route,
  44. Pvector_t endpoint_slopes[2],
  45. Ppolyline_t *output_route);
  46. /* utility function to convert from a set of polygonal obstacles to barriers */
  47. PATHPLAN_API int Ppolybarriers(Ppoly_t ** polys, int npolys,
  48. Pedge_t ** barriers, int *n_barriers);
  49. /* function to convert a polyline into a spline representation */
  50. PATHPLAN_API void make_polyline(Ppolyline_t line, Ppolyline_t* sline);
  51. #undef PATHPLAN_API
  52. #ifdef __cplusplus
  53. }
  54. #endif