The Ray implements a ray in 3D space represented with an origin and direction.
The class follows the 'copy-on-write' pattern, which means that every operation such as
Ray.multiplyScalar returns a copy of the ray with updates values.
It also implies that the values of the ray cannot be directly modified.
The concept of immutability improves sharing of objects as all types in TypeScript are assigned
by identity, instead of by-value (e.g. a copy) as in other programming languages like C.
The Ray implements a ray in 3D space represented with an origin and direction. The class follows the 'copy-on-write' pattern, which means that every operation such as Ray.multiplyScalar returns a copy of the ray with updates values. It also implies that the values of the ray cannot be directly modified.
The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.