Maybe I'm misunderstanding, but I would think that the easiest thing to do, in terms of getting the information you seek, would be to become familiar with the ITrafficInfo module - (at least if you're working in FSX/P3D). This will supply target aircraft altitude, lat/lon, heading etc. and you can then perform the necessary calculations for relative altitude/bearing (etc.) using your own-ship variables.
Is this an attempt at modelling an optical tracking system? In this case, things get a bit more technically involved, in terms of retrieving specific camera magnifications, pitch/bearing etc. so as to achieve an automatic camera track.