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

toTriangleSoup

Yuka.js库中的MeshGeometry对象方法之一,用于将三角形网格转化为三角形Soup。

描述

toTriangleSoup()方法将网格中的三角形面片转化为由独立的三角形组成的三角形Soup,该方法将返回一个新的三角形网格,该网格由TriangleSoup对象表示。

用法

geometry.toTriangleSoup();

参数

该方法没有参数。

返回值

该方法返回一个新的TriangleSoup对象,该对象表示网格的三角形Soup。

示例

const geometry = new YUKA.MeshGeometry();

geometry.vertices.push( new YUKA.Vector3( - 1, - 1, 0 ) );
geometry.vertices.push( new YUKA.Vector3(   1, - 1, 0 ) );
geometry.vertices.push( new YUKA.Vector3(   1,   1, 0 ) );
geometry.vertices.push( new YUKA.Vector3( - 1,   1, 0 ) );

geometry.indices.push( 0, 1, 2 );
geometry.indices.push( 2, 3, 0 );

const triangleSoup = geometry.toTriangleSoup();
console.log( triangleSoup ); // TriangleSoup { triangles: [] }

更多信息

该方法用于将网格从一个格式转换为另一个格式,以便于更高效地进行一些计算。在某些情况下,三角形Soup可能比三角形网格更加方便,例如光线追踪或物理碰撞检测等应用程序。

参考资料