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

epsilonCoplanarTest

概述

epsilonCoplanarTest是Yuka js库中的一个函数,用于测试两个三维向量是否在误差限度内共面。该函数是基于epsilon值判断误差的方法。

语法

epsilonCoplanarTest( vectorA: Vector3, vectorB: Vector3, epsilon: number ): boolean

参数

  • vectorA:表示第一个三维向量。
  • vectorB:表示第二个三维向量。
  • epsilon:表示误差的限度。

返回值

如果在epsilon误差限度内vectorA和vectorB共面,则返回true,否则返回false。

示例

import { epsilonCoplanarTest, Vector3 } from 'yuka';

const a = new Vector3( 0.1, 0.2, 0.3 );
const b = new Vector3( 0.3, 0.6, 0.9 );

if ( epsilonCoplanarTest( a, b, 0.01 ) ) {
    console.log( 'a and b are coplanar within the tolerance' );
}
else {
    console.log( 'a and b are not coplanar within the tolerance' );
}

注意事项

  • epsilon值应该足够小,以便检测到共面性。如果epsilon值过大,会导致检测出假阳性。
  • 该函数只能检测误差限度内的共面性,无法检测准确的共面性。

参考资料