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

Line3.equals()

The equals() method in Three.js is used to compare two Line3 objects and determine if they are equal in terms of position and direction.

Syntax

equals( line : Line3 ) : Boolean
  • line parameter: The Line3 object to compare to.
  • Return value: Returns true if the two Line3 objects are equal, and false otherwise.

Example

const line1 = new THREE.Line3(new THREE.Vector3(0, 0, 0), new THREE.Vector3(1, 1, 1));
const line2 = new THREE.Line3(new THREE.Vector3(0, 0, 0), new THREE.Vector3(1, 1, 1));
const line3 = new THREE.Line3(new THREE.Vector3(0, 0, 0), new THREE.Vector3(1, 0, 0));

console.log(line1.equals(line2)); // true
console.log(line1.equals(line3)); // false

In this example, we create three Line3 objects. line1 and line2 are identical, while line3 has a different direction. We use the equals() method to compare these objects and output the results to the console.

Notes

  • The equals() method compares the positions and directions of the two Line3 objects, so objects with different segments may still be considered equal if they have the same position and direction.
  • The equals() method uses floating-point comparison, so objects with extremely small differences in position or direction may still be considered equal.