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

fromJSON

描述

fromJSON 方法用于从 JSON 对象中构造一个 RightShoulderFuzzySet 实例。JSON 对象应包含 nameparams 字段。name 字段表示模糊集的名称,params 字段表示模糊集的参数。如果 JSON 对象中还包含 alphaCut 字段,则使用该值来设置模糊集的 alpha cut。

语法

RightShoulderFuzzySet.fromJSON(json)

参数

  • json:JSON 对象,包含模糊集的名称和参数。

示例

const json = {
  "name": "low",
  "params": [0, 50],
  "alphaCut": 0.5
};

const fuzzySet = RightShoulderFuzzySet.fromJSON(json);

异常

  • 如果传入的参数不是 JSON 对象,将抛出类型错误。
  • 如果 JSON 对象中缺少 nameparams 字段,将抛出错误。
  • 如果 params 字段不是一个数组,将抛出类型错误。
  • 如果参数错误,将抛出错误。