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

功能说明

该函数用于更新指定模糊集合中特定元素的隶属度。

语法

fuzzySet.updateDegreeOfMembership(element, degree)

参数说明

  • element: 要更新隶属度的元素,可以是字符串或数字。
  • degree: 元素的新隶属度,必须是介于0和1之间的数字。

使用示例

var fuzzySet = new FuzzySet('Temperature', [
  {label: 'Cold', x: -10, y: 1},
  {label: 'Warm', x: 10, y: 0},
  {label: 'Hot', x: 40, y: 1}
]);

fuzzySet.updateDegreeOfMembership('Warm', 0.5);

上面的示例将温度模糊集合中标签为“Warm”的隶属度更新为0.5。

异常情况

  • 如果element参数不是模糊集合中的元素,则抛出TypeError异常。
  • 如果degree参数不是介于0和1之间的数字,则抛出RangeError异常。