# Calculating endpoint of 3D line with start point and angle.

#### ThemePark

So I need to calculate the start point (x1, y1, z1) of a 3D line of which I know the end point (x2, y2, z2), the angle which is 45 degrees, but where I also know y1. I furthermore know that y1<y2.

So is there a simplified formula for this, given the additional info?

#### DarnItJimImAnEngineer

Which angle is 45Â°? You need a minimum of two angles to define a line in 3D.

Also, to find the starting point, you would need the length of the line segment (or dependent information, such as one of x1, y1, or z1).

#### ThemePark

English isn't my first language so I'm not sure how to describe what you ask about the angle, and I'm having a hard time wrapping my head around it all as well.

The best I can do is to provide the information that it's two points in a triangle where the third point would be (x2,y1,z2) as far as I can figure out, but like I said, I can't quite wrap my head around this so I'm not sure if that's already obvious from the previously provided info or not.

#### DarnItJimImAnEngineer

So A = (x1,y1,z1), B = (x2,y2,z2), and C = (x2,y1,z2), where <CAB = 45Â° (or <ABC = 45Â°)? And y1 < y2.
This actually makes it easy, because everything lies in a plane perpendicular to the x-z plane.

On the other hand, if you are trying to find point A, there are actually an infinite number of solutions (all on a circle).

Let R = (y2-y1) = |BC|. We have a 45-45-90 triangle, so |AC| = |BC| = R. It is also given that the y component of A is the same as the y component of C. However, we can choose x1 and z1 any way we want, so long as |AC| = R.

So x1 = x2 + R cos(t), z1 = z2 + R sin(t),
and we can choose t to be any angle we want.

#### Attachments

• 91.3 KB Views: 1