I'm rendering an image with Povray, and then adding labels using a LaTeX/TikZ file.
Now currently the way I do it is by just determining the location of the features by hand. This works, but means that I'll have to redo this every time I change the perspective of the image (that is, move the camera). Therefore I considered generating those positions automatically.
Now of course in principle I could re-implement all the camera calculations Povray does, but that would probably be even more effort than manually determining the coordinates. But given that Povray must do those calculations anyway, I wonder if there's a simple way to get at that data, so I can just output it during rendering and then use that data in my LaTeX file.
To clarify, I'm not talking about positions after things like mirroring or refraction; it's just the question, if my scene consisted of nothing but a single small object at a given point, where in the rendered image would that object appear, given the current camera settings.
That is not possible - PovRay does not have any functions for "reading" where or the extents of objects to start with (I've suffered trying to position text objects in the past).
And when one stops to think about it, it makes sense - POVRay is about raytracing afterall: so, only after one pixel is rendered do POVRay "know" if the pixel was affected by a particular object. At this point it is obviously too late to insert any parameter back into the scene description file.
Ok, unlike me trying to position objects inside the scene itself, you don't want the location data to be consumed by POV itself - so it is possible that some of POVRay output, or hooking into some output, might give one hints of where object is.
(/me pauses to render a sphere using maximum verbosity - no avail)
So, on checking the documentation, there are options for "generating an histogram" - which will output the time spent on each pixel. The time on pixels that display an object should be greater. However, the docs put that "not all POVRay versions can generate histograms, that will depend on the operating system and the file type being rendered". I could not generate the Histogram output - Povray 3.7 gave me parse error on the histogram command line options, although I think the CSV output file for histograms would work for you if you can make it work.
Otherwise, I think that better than re-creating all the camera calculations, if your objects are placed in an otherwise empty file, is to use an external script that could inspect the image and find the object coordinates for you. Python would be a nice language for that, because it has a lot of libraries that could introspect the image, and facilities to even handle your LaTex files and embed the coordinates into them via templating.