How do I calculate the horizontal angle from a starting position?

Calculate a position from a starting position, an horizontal angle and a distance:

_end_pos = [(_start_pos select 0) + sin(_dir)*_dist, (_start_pos select 1) + cos(_dir)*_dist, _start_pos select 2];

Calculate a position from a starting position, a direction vector and a distance:

_end_pos = [(_start_pos select 0) + (_vdir select 0)*_dist, (_start_pos select 1) + (_vdir select 1)*_dist, (_start_pos select 2)+(_vdir select 2)*_dist];