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

updateDegreeOfMembership

描述

updateDegreeOfMembership()方法用于更新模糊集合中元素的隶属度。它接受两个参数:

  1. value(required):要更新的元素值。
  2. membershipDegree(required):新的隶属度值。

语法

updateDegreeOfMembership(value, membershipDegree)

参数

  • value:要更新的元素值。
  • membershipDegree:新的隶属度值。必须是0到1之间的数字。

返回值

示例

// 创建一个模糊集合
const collection = new FuzzyVERY();

// 添加元素和对应的隶属度值
collection.add('low', 0.3);
collection.add('medium', 0.6);
collection.add('high', 0.9);

// 更新一个元素的隶属度值
collection.updateDegreeOfMembership('medium', 0.8);

异常

如果value参数不是集合中的元素,updateDegreeOfMembership()方法将抛出一个错误。如果membershipDegree参数不是0到1之间的数字,则会抛出一个错误。