found incorrectly working methods .intersectBox(), .intersectPlane() for determining the intersection point of THREE.Ray

coordinates of origin points:

pos2{“x”: 928.7828190673121, “y”: 39.71493452167897, “z”: -940.4438369584312}

pos1{“x”: -31.45437421978416, “y”: 30.972718151985603, “z”: -0.499054374461312}

pos4{“x”: -723.9416839086465, “y”: 189.5642678652407, “z”: 763.9022176215932}

pos3{“x”: -841.2586235570504,“y”: 64.64211539068612,“z”: -902.6526891569666}

pos5{“x”: 707.1580008987936,“y”: 66.08373507906762,“z”: 839.262074939043}

function quadrilateralProjectForPlane (camera) {

let box = new THREE.Box3( new THREE.Vector3( -1000, 9.9, -1000 ), new THREE.Vector3( 1000, 10, 1000 ) ),

ray = new THREE.Ray( camera.pos.clone()),

quadrilateral = [

new THREE.Vector3( -1, -1, 1 ),

new THREE.Vector3( 1, -1, 1 ),

new THREE.Vector3( -1, 1, 1 ),

new THREE.Vector3( 1, 1, 1 )

];

quadrilateral.forEach(dir=>{

dir.unproject(camera);

engine.showLine(camera.pos.clone(), dir.clone(), ‘yellow’);//draws a yellow line

ray.direction.copy(dir).normalize();

ray.intersectBox (box, dir);

});

engine.showLine(quadrilateral[0].clone(), quadrilateral[2].clone(), ‘red’);//draws a red line

engine.showLine(quadrilateral[1].clone(), quadrilateral[3].clone(), ‘red’);

engine.showLine(quadrilateral[2].clone(), quadrilateral[3].clone(), ‘red’);

engine.showLine(quadrilateral[1].clone(), quadrilateral[0].clone(), ‘red’);

console.log(1);

return quadrilateral;

}