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

computeUniqueVertices

功能介绍

computeUniqueVertices 方法用于计算唯一的顶点集合,这个顶点集合可以被用来绘制多面体。

语法

Polyhedron.computeUniqueVertices(polygon)

参数

  • polygon:Object。作为多面体的面数组。

返回值

该方法返回一个包含唯一顶点集合的数组,每个顶点都是一个长度为3的数组。

示例

const polyhedron = Polyhedron.get('tetrahedron');
const uniqueVertices = Polyhedron.computeUniqueVertices(polyhedron.faces);

console.log(uniqueVertices); // [[0, 0.94281, -0.33333], [-0.8165, -0.4714, -0.33333], [0.8165, -0.4714, -0.33333], [0, 0, 1.0541]]

注意事项

  • 该方法只适用于计算唯一的顶点集合,无法应用于绘制其他形状。
  • 参数 polygon 必须是一个有效的面数组,否则会导致错误或者意外结果的产生。