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

degreeOfMembership

描述

degreeOfMembership方法用于计算一个值在正态分布模糊集合中的隶属度。

语法

NormalDistFuzzySet.degreeOfMembership(value, mean, stdev)

参数

  • value : Number - 要计算隶属度的值。
  • mean : Number - 正态分布的均值。
  • stdev : Number - 正态分布的标准差。

返回值

返回值为一个Number类型,表示value在正态分布模糊集合中的隶属度。

实例

const { NormalDistFuzzySet } = require("@yukajs/yuka");
const set = new NormalDistFuzzySet(5, 2);

set.degreeOfMembership(5); // => 1
set.degreeOfMembership(6); // => 0.6065306597126334
set.degreeOfMembership(3); // => 0.1353352832366127

异常

  • 如果value的类型不是Number,则抛出TypeError异常。
  • 如果meanstdev的类型不是Number,则抛出TypeError异常。
  • 如果stdev的值为0,则抛出RangeError异常。

示例

// 计算在均值为5,标准差为2的正态分布模糊集合中,值为7的隶属度。
const { NormalDistFuzzySet } = require("@yukajs/yuka");
const set = new NormalDistFuzzySet(5, 2);

const degreeOfMembership = set.degreeOfMembership(7);

console.log(degreeOfMembership); // => 0.12098536225957168

在这个例子中,我们首先实例化一个均值为5,标准差为2的正态分布模糊集合,然后调用degreeOfMembership方法计算值为7的隶属度。最后,将结果打印到控制台中。