in Three-dimensional space， i know the positon of camera and Target point，how to Calculate the Irradiated area on Plane with z=0?
in Three-dimensional space， i know the positon of camera and Target point，how to Calculate the Irradiated area on Plane with z=0?
What irradiated area? Do you want to know how large the visible area of the xy-plane (z = 0) is?
Irradiated area on Plane with z=0 ... mmmMMMmm ...
you want to compute the area of the projection of the xy-plane (z=0) on the near plane of your camera ?
Hence the term "visible" ... The OP wants to know how large the visible area of the XY plane is - depending on the current parameters of the camera.Irradiated area on Plane with z=0 ... mmmMMMmm ... you want to compute the area of the projection of the xy-plane (z=0) on the near plane of your camera ?
yanasdf789: is your camera always orthogonal to the plane or not?
For a centred perspective projection:
The height is 2 * camera_z * tan(fovy/2)
The width is 2 * camera_z * tan(fovy/2) * aspect
The area is (2 * camera_z * tan(fovy/2))^{2} * aspect.
Where camera_z is the Z coordinate of the camera's position, and fovy and aspect are the corresponding parameters to the gluPerspective() call.
For a generalised perspective projection:
The height is (top - bottom) * camera_z / nearVal
The width is (right - left) * camera_z / nearVal
The area is (right - left) * (top - bottom) * (camera_z / nearVal)^{2}
where camera_z is the Z coordinate of the camera's position, and the other variables are the corresponding parameters to the glFrustum() call.