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

cellsZ

简介

cellsZCellSpacePartitioning类中的一个属性,用于存储空间划分后的三维空间中的所有网格,以便于查询哪些元素在哪个网格中。

用法

使用CellSpacePartitioningpartition()方法空间划分后,可以通过访问cellsZ属性来获取所有网格的数组。该数组的下标以二维数组形式表示三维空间中某个网格的坐标,每个网格则包含若干元素。

示例代码:

const csp = new CellSpacePartitioning(10, 10, 10, 4);
csp.partition();

// 获取所有网格
const allCells = csp.cellsZ;

// 遍历第i层第j行第k列的网格,并输出其中的元素
for (let i = 0; i < csp.depth; i++) {
  for (let j = 0; j < csp.numCellsY; j++) {
    for (let k = 0; k < csp.numCellsX; k++) {
      const cell = allCells[i][j][k];
      console.log(`第${i}层第${j}行第${k}列网格中的元素:`, cell);
    }
  }
}

参考文献

  • Daly, M. (2000). The collision detection book: principles and techniques. San Francisco, CA: Morgan Kaufmann Publishers.