SOLVED Retrieving camera view volume

Hello guys,
I am working with cameras to do some computation I need to retrieve its current view volume. I call view volume, the visible scene's "cone" from the camera pov.
See picture below (this cone is visible when the option "Show Cone" in camera object is switched on):
c4909046-2363-47ec-a65e-cd7b43109806-image.png

  1. Does it exist a function returning this volume no matter what kind of camera is used?

  2. While I can compute it for perspective camera, I couldn't guess the right parameters to compute it for parallel camera.


struct frustum{
 Float farVal, nearVal, right, left, top, bottom;
}f;

cam = GetCamera()) {
Float near = 0;
Float far = 1000;
Float focusLength= getParam(CAMERAOBJECT_TARGETDISTANCE, DA_REAL, cam).DReal;
		if (getParam(CAMERAOBJECT_NEAR_CLIPPING_ENABLE, DA_LLONG, cam).DLLong != 0) {
			near = getParam(CAMERAOBJECT_NEAR_CLIPPING, DA_REAL, cam).DReal;
		}
		if (getParam(CAMERAOBJECT_FAR_CLIPPING_ENABLE, DA_LLONG, cam).DLLong != 0) {
			far = getParam(CAMERAOBJECT_FAR_CLIPPING, DA_REAL, cam).DReal;
		}
		auto fov_vertical = getParam(CAMERAOBJECT_FOV_VERTICAL, DA_REAL, cam).DReal;

		
		auto widthHalf = focusLength * maxon::Tan(fov / 2.0)/100.0;
		auto heightHalf = focusLength * maxon::Tan(fov_vertical / 2.0) / 100.0;
		
		f.farVal = far;
		f.nearVal = near;
		f.right = widthHalf;
		f.left = -f.right;
		f.top = heightHalf;
		f.bottom = -f.top;
		return 0;
	}

Any help is welcome.
Thank you in advance

@user168462

  1. Not that I know of

  2. In a parallel camera, the view frustrum is a rectangular box/"cube". The dimensions depend on the render setting dimensions and the camera's zoom value. For some reason the neutral zoom is 1.024, not 1, so: if your render settings define an image of 1000x500 pixels, and the camera zoom is 1.024, then an object with the dimensions 1000x500 units parallel to the camera's view plane will appear as filling the image.
    (Obviously, in parallel projection the distance of the object does not matter.)
    A zoom of 0.512 will show the object as half size (500x250 pixels, plusminus whatever the antialias settings screw up), a zoom of 2.048 will show the object as double size, etc. As the geometric frustrum is simple, the calculations for the volume (up to the focus distance) are trivial.

0e8b171d-2ed9-4ff3-a14a-c55925fb05fb-image.png

Note: I did this on R23, so if the later versions changed the neutral zoom, I wouldn't know.

@cairyn Thank you!