| |
- fuzzy.set.Set.Set(__builtin__.object)
-
- Polygon
class Polygon(fuzzy.set.Set.Set) |
|
Represents a fuzzy set, which membership function
is the shape of a polygon. For example: triangle,
trapezoid, rectangle, or something similar.
If you need something similar to ZFunction or SFunction,
use this class directly by building it from two points.::
---* *---
\ /
\ OR /
\ /
*--- ---*
See also U{http://pyfuzzy.sourceforge.net/demo/set/Polygon%20(Demo).png} |
|
- Method resolution order:
- Polygon
- fuzzy.set.Set.Set
- __builtin__.object
Methods defined here:
- __call__(self, x)
- Get membership of value x.
- __init__(self, points=None)
- Initialize with given sorted list of (x,y) values
@param points: sorted list of 2-tuples of (x,y) values
@type points: list of 2-tuples (float,float)
- __repr__(self)
- Return representation of instance.
@return: representation of instance
@rtype: string
- add(self, x, y, where=1)
- Add a new point to the polygon.
The parameter where controls at which end
it is inserted. (The points are always sorted, but
if two have the same x value their order is important.
For example: adding a second point(y=0) in the middle::
now where=END where=BEGIN
*--* *--* * *
\ | \ |\
\ | \| \
* *--* * *
- clear(self)
- Reset polygon to zero.
- getCOG(self)
- Return center of gravity.
- getValuesX(self)
- Return sequence of x-values for set.
- getValuesXY(self, flat=True)
- Return sequence of (x,y)-values for set.
In case of vertical slopes, y is a tuple of y-values for flat = False.
Otherwise several (x,y)-values will be generated having identical x-values.
- remove(self, x, where=1)
- Remove a point from the polygon.
The parameter where controls at which end
it is removed. (The points are always sorted, but
if two have the same x value their order is important.
For example: removing the second point in the middle::
now where=END where=BEGIN
*--* *--* *
| \ \
| \ \
*--* * *--*
Data descriptors defined here:
- points
- points of the polygon.
@type: list of 2-tuple (x,y)
Data and other attributes defined here:
- BEGIN = 0
- END = 1
- X = 0
- Y = 1
Data descriptors inherited from fuzzy.set.Set.Set:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |