Question on cube reflection

Hello, I’m review the source code of cube_uv_reflection_fragment.glsl. I’m confused with the cube uv reflection. The face index I got is not equal to the cubemap picture. For example, if direction is (-3, 2, 1), the result of face is 3. But according to the picture, the result of face should be 1. Does three.js have different rule of cube map to access face. I can not find any information on online docs. If anyone can give me some explanation or tips, I’ll be very gratefull. Thanks in advance.

	float getFace( vec3 direction ) {

		vec3 absDirection = abs( direction );

		float face = - 1.0;

		if ( absDirection.x > absDirection.z ) {

			if ( absDirection.x > absDirection.y )

				face = direction.x > 0.0 ? 0.0 : 3.0;

			else

				face = direction.y > 0.0 ? 1.0 : 4.0;

		} else {

			if ( absDirection.z > absDirection.y )

				face = direction.z > 0.0 ? 2.0 : 5.0;

			else

				face = direction.y > 0.0 ? 1.0 : 4.0;

		}

		return face;

	}

599px-Cube_map.svg

I think if you scroll down to getUV you can map out where those faces are