Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/graphviz/pathplan/pathplan.3

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TH LIBPATH 3 "01 APRIL 1997"
.SH NAME
\fBlibpathplan\fR \- finds and smooths shortest paths
.SH SYNOPSIS
.ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
.PP
.nf
\f5
#include <graphviz/pathplan.h>

typedef struct Pxy_t {
    double x, y;
} Pxy_t;

typedef struct Pxy_t Ppoint_t;
typedef struct Pxy_t Pvector_t;

typedef struct Ppoly_t {
    Ppoint_t *ps;
    int pn;
} Ppoly_t;

typedef Ppoly_t Ppolyline_t;

typedef struct Pedge_t {
    Ppoint_t a, b;
} Pedge_t;

typedef struct vconfig_s vconfig_t;

#define POLYID_NONE	
#define POLYID_UNKNOWN

\fP
.fi
.SH FUNCTIONS

.nf
\f5
int Pshortestpath(Ppoly_t *boundary, Ppoint_t endpoints[2], Ppolyline_t *output_route);
\fP
.fi
Finds a shortest path between two points in a simple polygon.
You pass endpoints interior to the polygon boundary.
A shortest path connecting the points that remains in the polygon
is returned in output_route.  If either endpoint does not lie in
the polygon, an error code is returned. (what code!!)

.nf
\f5
vconfig_t *Pobsopen(Ppoly_t **obstacles, int n_obstacles);
.br
int Pobspath(vconfig_t *config, Ppoint_t p0, int poly0, Ppoint_t p1, int poly1, Ppolyline_t *output_route);
.br
void Pobsclose(vconfig_t *config);
\fP
.fi
These functions find a shortest path between two points in a
simple polygon that possibly contains polygonal obstacles (holes).
\f5Pobsopen\fP creates a configuration (an opaque struct of type
\f5vconfig_t\fP) on a set of obstacles. \f5Pobspath\fP finds
a shortest path between the endpoints that remains outside the
obstacles.  If the endpoints are known to lie inside obstacles,
\f5poly0\fP or \f5poly1\fP should be set to the index in the
\f5obstacles\fP array.  If an endpoint is definitely not inside
an obstacle, then \f5POLYID_NONE\fP should be passed.  If the
caller has not checked, then \f5POLYID_UNKNOWN\fP should be passed,
and the path library will perform the test.

(!! there is no boundary polygon in this model?!!!)

.nf
\f5
int Proutespline (Pedge_t *barriers, int n_barriers, Ppolyline_t input_route, Pvector_t endpoint_slopes[2],
	Ppolyline_t *output_route);
\fP
.fi

This function fits a Bezier curve to a polyline path. 
The curve must avoid a set of barrier segments. The polyline
is usually the \f5output_route\fP of one of the shortest path
finders, but it can be any simple path that doesn't cross
any obstacles.  The input also includes endpoint slopes and
0,0 means unconstrained slope.  

Finally, this utility function converts an input list of polygons
into an output list of barrier segments:
.nf
\f5
int Ppolybarriers(Ppoly_t **polys, int n_polys, Pedge_t **barriers, int *n_barriers);
\fP
.fi

.SH AUTHORS
David Dobkin (dpd@cs.princeton.edu),
Eleftherios Koutsofios (ek@research.att.com),
Emden Gansner (erg@research.att.com).

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.