8000 FEATURE: Path.get_stroked_extents · brunobeltran/matplotlib@a055b24 · GitHub
[go: up one dir, main page]

Skip to content

Commit a055b24

Browse files
committed
FEATURE: Path.get_stroked_extents
1 parent d3eaffd commit a055b24

File tree

7 files changed

+712
-4
lines changed

7 files changed

+712
-4
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
New function to get Path's *stroked* Bbox
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
A Path is typically drawn by stroking it (with some ``markeredgewidth``), an
5+
operation which changes its bounding box in a nontrivial way, depending on the
6+
Path's joinstyle, capstyle, miterlimit, and shape.
7+
8+
`~.path.Path.get_stroked_extents` was added to allow computation of the final
9+
8000 bounding box in pixel/points coordinates of the line, after it has been drawn
10+
(and accounting for the joinstyle, capstyle, and miterlimit).

lib/matplotlib/bezier.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,20 @@ def degree(self):
235235
"""Degree of the polynomial. One less the number of control points."""
236236
return self._N - 1
237237

238+
@property
239+
def tan_in(self):
240+
if self._N < 2:
241+
raise ValueError("Need at least two control points to get tangent "
242+
"vector!")
243+
return self.control_points[1] - self.control_points[0]
244+
245+
@property
246+
def tan_out(self):
247+
if self._N < 2:
248+
raise ValueError("Need at least two control points to get tangent "
249+
"vector!")
250+
return self.control_points[-1] - self.control_points[-2]
251+
238252
@property
239253
def polynomial_coefficients(self):
240254
r"""

0 commit comments

Comments
 (0)
0