3d line with 2point

how construct a 3d quad line with 2 point?

Get your normalized line vector, and cross it with your quad’s desired normal direction (the vector pointing away from the flat surface.

You scale that cross-product and add it to your points to generate the line. Once you have your four points you just triangulate, since it’s only four pts you can pretty much just eyeball it (ptA->ptB->ptC and ptB->ptD->ptC probably in CW).

var lineVec = Vector3.Normalize(end - start);
var crsVec = Vector3.Cross(lineVec, Vector3.UnitY); // note cross product of 2 unit vectors will be a unit vector
var ptA = start + crsVec * halfLineWidth;
var ptB = start + crsVec * -halfLineWidth;
var ptC = end + crsVec * halfLineWidth;
var ptD = end + crsVec * -halfLineWidth;

Texture coordinates are tricky depending on what you need to do.

When your line has multiple segments you use different vectors instead of a single cross-product for each of the line points. What exactly depends on what you desire to do and it starts to run off into dealing with miters and such.

The easy way is to blend each line’s cross-product with the cross-product of the line before it and use that for calculating the two new vertices from that point. That does the basics for line-chains and closed polygons.