Hello, I think that's what you're looking for:
https://www.e-education.psu.edu/natureofgeoinfo/book/export/html/1837
Here's a python code that calculates the slope degree (that 'vertical angle' so you know how far 'vertically rotate' the camera):
PHP:
from math import sqrt , atan, pi
pos = dict(
x=0,
y=0,
z=0
)
his_pos = dict(
x=6,
y=8,
z=10
)
def get_2d_distance(x,y, x2, y2):
'''Pythagorean theorem'''
return sqrt((x - x2) ** 2 + (y - y2) ** 2)
run = get_2d_distance(
pos['x'], pos['y'],
his_pos['x'], his_pos['y']
)
rise = his_pos['z'] - pos['z'] # vertical difference between you and him (between your Z-position and his Z-position)
slope_degree = atan(rise/run) * 180 / pi
print "run={0} - it's like 2D distance".format(run)
print "rise={0} - difference between your z-position and his z-position".format(rise)
print "slope_angle={0} - that's what you looking for I guess".format(slope_degree)
Edit: quick formula would be:
slope_degree = atan((z - z2) / sqrt((x - x2) ** 2 + (y - y2) ** 2)) * 180 / pi
where "** 2" stands for the power of 2,
and "* 180 / pi" is just for conversion of radians to degrees
Edit2:
so the output of the program is:
run=10.0 - it's like 2D distance
rise=10 - difference between your z-position and his z-position
slope_angle=45.0 - that's what you looking for I guess