Truss Bridge - building a grid based on two points in order to model framing

I have a feeling I am going about this the wrong way so I figured I would ask the professionals. It’s probably going to be a facepalmer but here it goes.

The end goal is to create a Dynamo graph that allows the user to select two points in the model (these points can vary in all three dimensions) and create a truss bridge (see below) based on inputs such as width, height, member sizing and spacing. I was able to accomplish a fairly simple version with basic coordinates and math but as soon as my points do not line up along (lets say) the x axis everything goes to hell. I know that this is going to get doubly problematic when the points dont line up in the z axis as well.

I feel like the answer lies in using vectors or maybe even creating a plane/coordinate system that is based on the line/vector that is created when selecting the two points.

In this picture you can see the two red circles are the user input points. I ultimately want the box to go from the circles to the x’s so that the rectangle remains a rectangle and not a parallelogram.

This is just the start of the graph with me trying to figure out basic geometric functions.

When I am done, this is sort of what I am going for but it all starts with the base of the bridge. :slight_smile:

Thanks!