I do see a clear-cut difference. A Patch is a two-dimensional region
characterized by a boundary and an interior region, which may have colors,
line/hatch styles, etc. Also, a Patch has an algorithms to compute an area,
a circumference, decide whether a point lies inside or outside the Patch, to
cut a Patch for visibility calculations, etc.
A Polygon is a special case of a Patch, namely one that is bounded by
piecewise-linear segments. This implies specific formulae/algorithms to
compute the properties mentioned above.
Now, it is entirely meaningful to realize a Patch differently than in terms
of piecewise-linear segments. I could use piecewise cubic segments
(splines), or give the control points of a closed Bezier curve. All the
properties of a Patch are still meaningful, but none of the algorithms for a
Polygon apply.
Hence I find it meaningful to define
class Polygon(Patch)
such that I am not precluded to define
class SplinePatch(Patch)
class BezierPatch(Patch)
etc.
Hence I prefer to have Patch as an Abstract Base Class and not as a specific
implementation of a Polygon.
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Polygon-vs-Patch-tp43743p43748.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.
|