This problem would be really easy if the line was pointing in the
z-axis, since then if I label the pointy end as p2, the three points
would simply be
p2 + (R*cos(theta_i),R*sin(theta_i),-L)
where theta_i = 2Pi/3*i + phi, where i = 0,1,2 and you get to choose phi
---
In the given coordinates, this would be
p2 + R*cos(theta_i)*x_new + R*sin(theta_i)*y_new -L*z_new
where theta_i = 2Pi/3*i + phi, where i = 0,1,2 and you get to choose phi
We have to find x_new, y_new and z_new, which are 3 unit vectors.
z_raw = p2-p1
z_new = z_raw/|z_raw|
where p2 is the pointy end and p1 is the other end of the line, and
|z_raw| is the length of the line.
y_new and x_new simply have to be unit vectors perpendicular to each
other and to z_new. One way of finding some vectors that work is
below.
---
You have to first guess a vector v which is not parallel to z_new.
Out of z_new_x, z_new_y, and z_new_z, pick the direction with the
smallest magnitude and construct a unit vector in that direction. This
would be either (1,0,0),(0,1,0) or (0,0,1). Call this vector v.
y_raw = v - (v.n)*n where v.n is a dot product
y_new = y_raw/|y_raw|
x_new = cross_product(y_new,z_new)
---
This seems kinda complicated, but the part about determining x_new and
y_new is so long only because you can't quite avoid running into the
problem of accidentally trying a vector which is parallel to the
original line. |