Package fuzzy :: Package set :: Module Triangle :: Class Triangle
[hide private]
[frames] | no frames]

Class Triangle

source code


Realize a triangle-shaped fuzzy set:

         ______  y_max
         A
        /|\
       / | \
      /  |  \
    _/   |   \_  y_min
     |   m   |
     |   |   |
    alpha|beta

See also http://pyfuzzy.sourceforge.net/demo/set/Triangle.png

Instance Methods [hide private]
 
__init__(self, m=0.0, alpha=1.0, beta=1.0, y_max=1.0, y_min=0.0)
Initialize a triangle-shaped fuzzy set.
source code
 
_update(self)
update polygon
source code
 
add(self, x, y, where=1)
Don't let anyone destroy our triangle.
source code
 
remove(self, x, where=1)
Don't let anyone destroy our triangle.
source code
 
clear(self)
Don't let anyone destroy our triangle.
source code
string
__repr__(self)
Return representation of instance.
source code

Inherited from Polygon.Polygon: __call__, getCOG, getValuesX, getValuesXY

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from Polygon.Polygon: BEGIN, END, X, Y

Properties [hide private]
float y_max
y-value at top of the triangle
float y_min
y-value outside the triangle
float m
x-value of top of triangle
float alpha
distance of left corner to m
float beta
distance of right corner to m

Inherited from Polygon.Polygon: points

Inherited from object: __class__

Method Details [hide private]

__init__(self, m=0.0, alpha=1.0, beta=1.0, y_max=1.0, y_min=0.0)
(Constructor)

source code 

Initialize a triangle-shaped fuzzy set.

Parameters:
  • y_max - y-value at top of the triangle (1.0)
  • y_min - y-value outside the triangle (0.0)
  • m - x-value of top of triangle (0.0)
  • alpha - distance of left corner to m (1.0)
  • beta - distance of right corner to m (1.0)
Overrides: object.__init__

add(self, x, y, where=1)

source code 

Don't let anyone destroy our triangle.

Overrides: Polygon.Polygon.add

remove(self, x, where=1)

source code 

Don't let anyone destroy our triangle.

Overrides: Polygon.Polygon.remove

clear(self)

source code 

Don't let anyone destroy our triangle.

Overrides: Polygon.Polygon.clear

__repr__(self)
(Representation operator)

source code 

Return representation of instance.

Returns: string
representation of instance
Overrides: object.__repr__

Property Details [hide private]

y_max

y-value at top of the triangle

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

y_min

y-value outside the triangle

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

m

x-value of top of triangle

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

alpha

distance of left corner to m

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

beta

distance of right corner to m

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float