BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Plane.setFromCoplanarPoints()

Plane.setFromCoplanarPoints() 是 three.js 中 Plane 类中用于计算三个共面点生成 Plane 对象的方法。 该方法能够通过指定的三个共面点生成一个平面,并且将其储存在 Plane 对象中。

语法

plane.setFromCoplanarPoints(pointA, pointB, pointC);

参数

  • pointApointBpointC: 用于计算平面的三个 Vector3 点。

描述

生成的平面对象具有法向量及偏移量,使它们满足三个点所在的平面。储存在 Plane 类实例中。

示例

const pointA = new THREE.Vector3(-1, 0, 0);
const pointB = new THREE.Vector3(0, 1, 0);
const pointC = new THREE.Vector3(1, 0, 0);

const plane = new THREE.Plane();
plane.setFromCoplanarPoints(pointA, pointB, pointC);

上述示例代码将创建一个平面,它由三个 Vector3 点构成。这个平面的法向量将与传入的向量 pointApointB 以及 pointC 所在的平面相同。

异常

如果给定的三个点不在同一个平面上,会抛出 THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0 异常。

更多信息