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

eigenDecomposition

eigenDecomposition是Matrix3类中的一个方法,用于计算矩阵的特征值和特征向量,从而得到矩阵的简化形式。在计算机图形学中,特征值分解是计算机图形学中许多算法的基础。

语法

Matrix3.eigenDecomposition();

描述

eigenDecomposition方法使用Jacobi迭代算法对Matrix3实例进行特征值计算,返回一个包含特征值和特征向量的对象。

返回值

eigenDecomposition方法返回一个包含特征值和特征向量的对象,具有以下属性:

  • values:包含矩阵的三个特征值的数组,按大小排序
  • vectors:包含矩阵的三个特征向量的数组,按照特征值的顺序排列

示例

let matrix = new Matrix3();
matrix.set(3, 1, 0, 1, 2, -1, 0, -1, 2);

let result = matrix.eigenDecomposition();

console.log(result.values);   // [4, 2, 1]
console.log(result.vectors);  // [[ 0.7071, -0.5774,  0.4082 ], [ -0.7071, -0.5774,  0.4082 ], [ 0,  0.5774,  0.8165 ]]

注意事项

  • 返回的特征值是按从大到小的顺序排列的。
  • 特征向量是标准化的向量,即长度为1的向量。
  • 当矩阵不是对称矩阵时,Jacobi迭代算法不是最优的算法,效率会降低。