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() 是 Yuka js 库中 LeftSCurveFuzzySet 类的一个方法。该方法用于更新该模糊集合中指定值的隶属度度量。

语法

updateDegreeOfMembership(value: number): number
  • value: 需要更新隶属度度量的值,必须小于或等于模糊集合的右端点。
  • 返回值: 把指定值分配给后放缓倾斜的左S形函数后得到的可解释度量的隶属度值。

示例

import { LeftSCurveFuzzySet } from 'yuka';

const fuzzySet = new LeftSCurveFuzzySet(10, 20, 30);
fuzzySet.updateDegreeOfMembership(15); // 0.5

实现细节

  • value 值应该在集合的 leftOffsetrightOffset 之间。

  • updateDegreeOfMembership() 首先计算传递的值相对于模糊集合的左侧偏移量,并将结果保留为 distance 变量。

  • 接下来,用模糊集合的偏移量加上 distance 来计算传递的值的模糊隶属度,并将结果保留为 degree

  • 最后,通过计算三角形区域的面积来分配给值分配一个可解释度量的隶属度,面积大小由 degree 值计算而来。

参考文献