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.equals()

The Plane.equals() method is a utility function in the Three.js library that determines whether two planes are equal to each other.

Syntax

plane.equals(plane2)

The equals() method takes one argument, which is the plane to compare with the current plane (plane).

Return Value

The equals() method returns a boolean value that indicates whether the two planes are equal to each other. Specifically, the method return true if the two planes have the same normal vector and distance from the origin, and false otherwise.

Example Usage

Here is an example of how to use the equals() method to compare two planes in Three.js:

const plane1 = new THREE.Plane(new THREE.Vector3(0, 1, 0), 0);
const plane2 = new THREE.Plane(new THREE.Vector3(0, 1, 0), 0);

if ( plane1.equals(plane2) ) {
  console.log('The two planes are equal');
} else {
  console.log('The two planes are NOT equal');
}

In this example, we create two new planes plane1 and plane2 with identical normal vectors and distances from the origin. We then use the equals() method to compare them, and the console.log() statement should output "The two planes are equal".

Remarks

The equals() method is an instance method on the Plane class. It is commonly used in Three.js to check whether two objects are identical to each other.

When comparing planes using the equals() method, keep in mind that floating point errors may cause planes that should be equal to be considered slightly different. To avoid this, you can use an epsilon value to compare the distance between the planes instead of exact equality.

Conclusion

The Plane.equals() method is a simple but useful utility function in Three.js that allows you to determine whether two planes are equal to each other. By comparing the normal vector and distance from the origin of each plane, you can easily check whether two planes are identical.