Trouble again with 3D ellipse {FIXED}

{FIXED! NEW CODE BELOW}

got a slight problem that I need some help/advice with.

A while ago I had an issue with plotting an ellipse in 3D space. The solution I had seemed to work, and rotated things the way I needed (at the time). The solution I have works almost perfectly. It rotates the ellipses to the correct orientation… However, the start and end points of the ellipse (signified in the picture by the cyan and red crosses) are always aligned incorrectly. Here are some pictures to show what is happening, and what I need to happen.

The solution now seems obvious, simplify the orientation process. So I tweaked the coordinate generation to force the ellipse to be generated in the z/y plane, with the first point generated at 0,0,0 with this modification, the orientation becomes a simple LookRotation with a specified up vector, and then an offset to put it in the right place. (sometimes you just need a break from the code) This might only be one solution so if anyone has better ideas feel free to post them, but this works for me for now.

This is the new code that works as desired

public static void DrawEllipse(Vector3 p1, Vector3 p2, float height, Vector3 up)
{
    Quaternion quat = Quaternion.identity;
    int halfPoints = 25;
    int totalPoints = halfPoints*2;
    Vector3[] points1 = new Vector3[halfPoints];
    Vector3[] points2 = new Vector3[halfPoints];
    Vector3 midPoint = (p1 + ((p2 - p1)) * 0.5f);
    Vector3 tmp = Vector3.zero;
    Vector3 firstPoint = Vector3.zero;
    quat *= Quaternion.LookRotation(p2-p1, up);

    for (int i = 0; i < totalPoints; i++)
    {
        tmp = Vector3.zero;

        // build the coordinates in arbitrary space.
        tmp.z = -Mathf.Cos(((float)i / totalPoints) * (Mathf.PI * 2)) * (Vector3.Distance(p1, p2) * 0.5f);
        tmp.y = Mathf.Sin(((float)i / totalPoints) * (Mathf.PI * 2)) * height;

        if (i == 0) firstPoint = tmp;
        tmp -= firstPoint;
        // modify the point for correct orientation.
        tmp = (quat * tmp);

        // push to the arrays (split to show outward and return halves)
        if (i < halfPoints)
        {
            points1 *= tmp + p1;*

}
else
{
points2[i - halfPoints] = tmp + p1;
}
}
//draw the results.
DrawPath(points1, Color.cyan, false);
DrawPath(points2, Color.red, false);
Debug.DrawLine(p1, p2, Color.black);
DrawCross(points1[0], 0.2f, Color.cyan);
DrawCross(points2[0], 0.2f, Color.red);
}

Why didn’t you make all of the drawn paths and crosses and such a child of a dummy object, then apply rotation and transformation to the dummy object?