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

edges

描述

edges 方法用于获取多面体的所有边。返回一个数组,数组中的每个元素都是代表一条边的数组。

语法

polyhedron.edges()

返回值

返回一个数组,其中每个元素都是一个数组,代表一条边。每条边的数组由两个坐标点数组组成,每个坐标点数组由三个数字组成,分别代表坐标系中的 x、y、z 坐标。

示例

const vertices = [
  [0, 0, 0],
  [0, 0, 1],
  [0, 1, 0],
  [0, 1, 1],
  [1, 0, 0],
  [1, 0, 1],
  [1, 1, 0],
  [1, 1, 1]
];

const faces = [
  [0, 2, 3, 1],
  [2, 6, 7, 3],
  [6, 4, 5, 7],
  [4, 0, 1, 5],
  [0, 4, 6, 2],
  [1, 3, 7, 5],
];

const polyhedron = new YUKA.Polyhedron(vertices, faces);

const edges = polyhedron.edges();

console.log(edges); //  [[ [ 0, 0, 0 ], [ 0, 0, 1 ] ], [ [ 0, 0, 0 ], [ 0, 1, 0 ] ], ... ]

异常

附注