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

clearDegreeOfMembership

该方法用于清除模糊集合的隶属度(membership degree)。

语法

normalDistFuzzySet.clearDegreeOfMembership();

参数

该方法不接受任何参数。

返回值

该方法不返回任何值。

描述

该方法将清除模糊集合的隶属度,即将所有元素的隶属度设置为0。

示例

以下示例展示了如何使用clearDegreeOfMembership方法:

const fuzzySet = new Yuka.NormalDistFuzzySet(0, 10, 2);
fuzzySet.computeDegreeOfMembership(5);
fuzzySet.computeDegreeOfMembership(7);
console.log(fuzzySet); // NormalDistFuzzySet { data: [0.082, 0.618, 0.082], a: 0, b: 10, sigma: 2 }
fuzzySet.clearDegreeOfMembership();
console.log(fuzzySet); // NormalDistFuzzySet { data: [0, 0, 0], a: 0, b: 10, sigma: 2 }

在此示例中,我们首先创建了一个正态分布模糊集合,并使用computeDegreeOfMembership方法计算了元素5和7的隶属度。然后我们输出了结果,然后使用clearDegreeOfMembership方法将所有元素的隶属度设置为0,最后输出了结果,以证明隶属度已被清除。

异常

该方法不会抛出任何异常。

参见

  • computeDegreeOfMembership