A series of possibly disconnected, possibly closed, line and curve segments. The underlying storage is made up of two parallel numpy arrays: - *vertices*: an (N, 2) float array of vertices - *codes*: an N-length `numpy.uint8` array of path codes, or None These two arrays
| 22 | |
| 23 | |
| 24 | class Path: |
| 25 | """ |
| 26 | A series of possibly disconnected, possibly closed, line and curve |
| 27 | segments. |
| 28 | |
| 29 | The underlying storage is made up of two parallel numpy arrays: |
| 30 | |
| 31 | - *vertices*: an (N, 2) float array of vertices |
| 32 | - *codes*: an N-length `numpy.uint8` array of path codes, or None |
| 33 | |
| 34 | These two arrays always have the same length in the first |
| 35 | dimension. For example, to represent a cubic curve, you must |
| 36 | provide three vertices and three `CURVE4` codes. |
| 37 | |
| 38 | The code types are: |
| 39 | |
| 40 | - `STOP` : 1 vertex (ignored) |
| 41 | A marker for the end of the entire path (currently not required and |
| 42 | ignored) |
| 43 | |
| 44 | - `MOVETO` : 1 vertex |
| 45 | Pick up the pen and move to the given vertex. |
| 46 | |
| 47 | - `LINETO` : 1 vertex |
| 48 | Draw a line from the current position to the given vertex. |
| 49 | |
| 50 | - `CURVE3` : 1 control point, 1 endpoint |
| 51 | Draw a quadratic Bézier curve from the current position, with the given |
| 52 | control point, to the given end point. |
| 53 | |
| 54 | - `CURVE4` : 2 control points, 1 endpoint |
| 55 | Draw a cubic Bézier curve from the current position, with the given |
| 56 | control points, to the given end point. |
| 57 | |
| 58 | - `CLOSEPOLY` : 1 vertex (ignored) |
| 59 | Draw a line segment to the start point of the current polyline. |
| 60 | |
| 61 | If *codes* is None, it is interpreted as a `MOVETO` followed by a series |
| 62 | of `LINETO`. |
| 63 | |
| 64 | Users of Path objects should not access the vertices and codes arrays |
| 65 | directly. Instead, they should use `iter_segments` or `cleaned` to get the |
| 66 | vertex/code pairs. This helps, in particular, to consistently handle the |
| 67 | case of *codes* being None. |
| 68 | |
| 69 | Some behavior of Path objects can be controlled by rcParams. See the |
| 70 | rcParams whose keys start with 'path.'. |
| 71 | |
| 72 | .. note:: |
| 73 | |
| 74 | The vertices and codes arrays should be treated as |
| 75 | immutable -- there are a number of optimizations and assumptions |
| 76 | made up front in the constructor that will not change when the |
| 77 | data changes. |
| 78 | """ |
| 79 | code_type = np.uint8 |
| 80 | |
| 81 | # Path codes |
no outgoing calls
searching dependent graphs…