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

fromCoplanarPoints

描述

fromCoplanarPoints 是 Yuka js 库中的一个函数,用来创建一个平面对象。该函数需要至少传入三个共面点的坐标。

语法

Plane.fromCoplanarPoints( point1: Vector3, point2: Vector3, point3: Vector3 ) : Plane

参数

  • point1:Vector3 类型,表示共面点的坐标。
  • point2:Vector3 类型,表示共面点的坐标。
  • point3:Vector3 类型,表示共面点的坐标。

返回值

  • Plane:一个平面对象,以参数 point1point2point3 所在的平面为基础。

示例

// 创建一个平面对象
const plane = Plane.fromCoplanarPoints(
  new Vector3(0, 0, 1),
  new Vector3(1, 0, 1),
  new Vector3(0, 1, 1)
);

console.log(plane.normal); // Vector3 { x: 0, y: 0, z: 1 }

以上代码创建了一个平面对象,通过调用其 normal 属性可以获取该平面的法向量。

注意事项

  • 传入的三个点必须共面。
  • point1point2point3 不一定需要按顺序给出。

参考链接