Given a point $(x,y,z)$ and an angle/bearing distance calculate the end point $(x,y,z)$ I'm not very mathematical but I'm working on a 3d program and for this part I simply want to draw a line.
I know the starting vector $(x,y,z)$, the length r of the line and the bearing/angle. I want to calculate the endpoint so I can draw the line. 
I had a look around and I'm using the following. Let $\theta$ be the angle in radians, and let $d$ be the distance. Then the other endpoint is $(x', y', z')$, where:
$$x' = r\cos(\theta) + x$$ 
$$y' = y$$ (the endpoint 'height' should be the same as the start point)  
$$z' = r\sin(-\theta) + z$$
is this correct?
Thanks
 A: Your formulation will work for a line drawn in a plane parallel to the x-z plane, but I'm not clear why the angle in radians for $z$ is negative, where it is positive in the formulation for $x$. With $y$ measuring height ("is held constant"), then you need to be clear about what the reference axis for your angle $\theta$.

I'd suggest the following: 
Given starting point $(x, y, z)$, with $r = $ length, $\theta$ = the measure of the angle (counter-clockwise rotation) with respect to the positive $x$-axis, in radians, then your endpoint $(x', y', z')$ is given by:
$$x' = r\cos\theta + x$$
$$y' = y$$
$$z' = r\sin\theta + z\;\;$$
Using graphic below, this will:
$\theta=0$: East being aligned with positive x-axis
$\theta=\frac\pi2 = 90^\circ$: South being aligned with positive z-axis
$\theta=\pi = 180^\circ$: West being aligned with negative x-axis
$\theta=\frac{3\pi}2 = 270^\circ$: North being aligned with negative  z-axis
EDIT:

Using this coordinate system, with y-height, using x' and y' as formulated above, then the line with ending point $(x', y', z')$ will lie on the plane y' = y, parallel to the x-z plane (where y = 0), and if $z' = r\sin(-\theta) + z$, as you propose, it will point in the direction of the north-east quadrant (towards the quadrant with $x > 0,\; z< 0$), with $\theta$ measured with respect to the positive x-axis. On the other hand, given $x', y'$ and using $z' = r\sin\theta + z$, as I suggest, then the line directed from $(x, y, z)$ towards $(x', y', z')$ will point to the south-east quadrant, with $\theta$ measured with respect to the positive x-axis.
A: If you treat $\theta$ as a bearing then your formultaion of $x′=rcos(θ)+x$, $y′=y$, $z′=rsin(−θ)+z$ will lead to:-
$\theta=0$: North being aligned with positive x-axis
$\theta=\frac\pi2$: East being aligned with negative z-axis
$\theta=\pi$: South being aligned with negative x-axis
$\theta=\frac{3\pi}2$: West being aligned with positive z-axis
Is this what you want?
