The Plane.normalize()
method is a function that normalizes the values of this Plane object. Normalization here means scaling the vector of this Plane object to a length of 1.
plane.normalize();
This function doesn’t take any parameters.
This function doesn’t return any value.
The Plane.normalize()
function is used to normalize the vector of the Plane object. The normalization process scales the vector of this Plane object to a length of 1. This is useful when we want to ensure that a particular vector has the same direction as before but is only scaled in length to 1.
The length of the vector of the Plane object can be calculated using the Plane.distanceToPoint()
or Plane.distanceToSphere()
method.
Let's consider a plane defined by a normal vector (1, 1, 1) and a distance value of 2. We create an instance of the Plane
object as follows:
const normal = new THREE.Vector3( 1, 1, 1 ).normalize();
const plane = new THREE.Plane( normal, 2 );
The normalize()
method can then be used to normalize the vector of the Plane
object:
plane.normalize();
After normalizing the vector of the plane object, the resulting vector has a length of 1.