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

getDegreeOfMembership

getDegreeOfMembership方法用于计算输入值与当前RightSCurveFuzzySet的隶属度。

语法

RightSCurveFuzzySet.getDegreeOfMembership(value);

参数

  • value(Number): 输入的值

返回值

  • (Number): 输入值与当前RightSCurveFuzzySet的隶属度

示例

const set = new RightSCurveFuzzySet(5, 8);
set.getDegreeOfMembership(6); // 0.5
set.getDegreeOfMembership(9); // 1
set.getDegreeOfMembership(2); // 0

算法说明

RightSCurveFuzzySet是一个“右侧S型曲线隶属度函数”,其具体算法如下:

  • 当输入值小于等于起点时,隶属度为0;
  • 当输入值大于等于顶点时,隶属度为1;
  • 当输入值在起点和顶点之间时,隶属度根据以下公式计算:

$$ \text{degree}(x) = \frac{x - \text{start}}{\text{end} - \text{start}} $$

其中,$\text{start}$为起点,$\text{end}$为顶点,$x$为输入值。

异常情况

  • 如果输入值不是一个数字,返回NaN

参考链接