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

computeDegreeOfMembership

概述

computeDegreeOfMembership方法计算一个值的隶属度(degree of membership),即该值与单例模糊集对应值的相等程度。在SingletonFuzzySet中,隶属度为0或1,取决于该值是否等于单例集合中的元素。

语法

SingletonFuzzySet.computeDegreeOfMembership(value)

参数

  • value: Number - 必需,要计算隶属度的值。

返回值

  • Number - 给定值的隶属度,为0或1。

示例

const sfs = new SingletonFuzzySet(5);
console.log(sfs.computeDegreeOfMembership(5)); // 输出: 1
console.log(sfs.computeDegreeOfMembership(3)); // 输出: 0

注意事项

  • 如果在SingletonFuzzySet的构造函数中没有传入值,则调用computeDegreeOfMembership会抛出异常。
  • SingletonFuzzySet类只适用于单个值的情况,如果要计算多个值的隶属度,应该使用其他类型的模糊集。