Determine if an object at XYZ is behind my camera which is pointing in the direction given by a Euler angle?

115 Views Asked by At

If my camera is pointing in the direction defined by a Euler angle with values _x, _y, and _z, and I have a 3D point with values X, Y, and Z, is there a trigonometric formula that will tell me if the 3D point is in front of my camera or behind it?

The Euler angle method is that used by the ThreeJS 3D library:

https://threejs.org/docs/#api/en/math/Euler

That document page says this about the Euler method used:

Three.js uses intrinsic Tait-Bryan angles. This means that rotations are performed with respect to the local coordinate system. That is, for order 'XYZ', the rotation is first around the local-X axis (which is the same as the world-X axis), then around local-Y (which may now be different from the world Y-axis), then local-Z (which may be different from the world Z-axis).

I will be calculating field of view angles between a source object (or camera) and another object in my 3D world. But I only want to do that calculation for objects the camera can "see". So given the plane determined by the 2D plane that is orthogonal to the vector the camera is pointing in, I don't want to bother with any objects that are on the back side of the plane (i.e. - "behind" the source object or camera).

By orthogonal 2D plane I mean the flat surface that for example, if you were holding a camera and your back was against a wall, that wall behind you would be the orthogonal 2D plane that I want use to separate objects that are in front of the source object, from objects that are behind it.