3D Shapes : polygon

I used multiple TGraph2D to draw multiple triangles, but there was a memory leak and the resulting image was a bit strange


I don’t understand why there are so many dotted lines that seem to come out from the origin of the windows

    auto c = new TCanvas("c", "Graph2D example", 0, 0, 600, 400);

    for each (QString line in l)
    {
        QStringList s = line.split(" ", Qt::SkipEmptyParts);

        TH2F* h1 = new TH2F("h1", "h1", 10, minx-0.5, maxx+0.5, 10, miny-0.5, maxy+0.5);
        h1->SetMinimum(minz-0.5);
        h1->SetMaximum(maxz+0.5);
        auto dt = new TGraph2D(3);
        dt->SetPoint(0, s[0].toDouble(), s[1].toDouble(), s[2].toDouble());
        dt->SetPoint(1, s[3].toDouble(), s[4].toDouble(), s[5].toDouble());
        dt->SetPoint(2, s[6].toDouble(), s[7].toDouble(), s[8].toDouble());
        dt->SetHistogram(h1);
        if (N == 0)
            dt->Draw("TRI");
        else
        {
            dt->Draw("TRI SAME");
        }
        N++;
    }