AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

getDegreeOfMembership

简介

getDegreeOfMembership 方法是 FuzzyTerm 类的成员方法,用于计算模糊术语的隶属度。隶属度是指一个模糊术语与一个模糊集之间的相关程度,值域在 [0, 1] 之间。在模糊逻辑中,模糊术语和模糊集是不同的概念。

语法

FuzzyTerm.getDegreeOfMembership(value);

参数

  • value:要计算隶属度的值。

返回值

getDegreeOfMembership 方法返回一个表示隶属度的数字(在 [0, 1] 范围内)。

示例

const linguisticVariable = new FuzzyVariable('Temperature', -10, 40);
const coldTerm = new FuzzyTerm('Cold', new LeftShoulderFuzzySet(-10, 10));
const hotTerm = new FuzzyTerm('Hot', new RightShoulderFuzzySet(20, 40));

const coldDegree = coldTerm.getDegreeOfMembership(0); // 0.5
const hotDegree = hotTerm.getDegreeOfMembership(30); // 0.75

异常

  • 如果 value 不在 FuzzySet 对应的变量的定义域内,则方法会抛出 Error 异常。