This might be a stupid question, but what is the difference between a Polygon and Patch? A Polygon is subclassed from a Patch. The only real substantial difference I see is that a Polygon object has logic flagging and ensuring that it has a closed ring, but does that really merit a whole new class?
What makes things even more confusing is that RegularPolygon and CirclePolygon are not even subclassed from Polygon.
I wonder if we might want to consider folding in some of Polygon’s functionality into Patch, and simply let Polygon be an alias for Patch (after all, a polygon is usually what people think of when they really want a patch).
Just a thought.
Cheers!
Ben Root
No, a Patch is not automatically a Polygon. You could make a Patch out of
splines or Bezier curves, for example.
Cheers,
Stefan
···
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Polygon-vs-Patch-tp43743p43746.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.
Since Polygon subclasses Patch, wouldn’t that mean that a Polygon could be made out of splines or Bezier curves? I fail to see the “inherent barrier” for Polygons and Patches to be the same thing. I am not claiming that they are identical now, I just don’t see why a Polygon’s functionality needs to be in a subclass of Patch rather than in Patch itself.
···
On Mon, Aug 4, 2014 at 2:34 AM, Stefan H. <shmueller2@…149…> wrote:
No, a Patch is not automatically a Polygon. You could make a Patch out of
splines or Bezier curves, for example.
Cheers,
Stefan
–
View this message in context: http://matplotlib.1069221.n5.nabble.com/Polygon-vs-Patch-tp43743p43746.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
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.