I am trying to draw a line (in a 3D box, so I can see all coordinates of that line) and, additionally, a point, to see how close that point is to that line.
With the code below, I can draw a line perfectly, but somehow the point only appears when the coordinates are positive (e.g. (“gP->SetPoint(0, 1.0, 0.0, 0.0);”). When I put the point at X = -1, the point does not appear anymore. Why is that?
Best regards,
Machiel
Main()
{
c1 = new TCanvas("c1","",500,500);
double xarr[2], yarr[2], zarr[2];
xarr[0] = -4; yarr[0] = -4; zarr[0] = -4;
xarr[1] = 4; yarr[1] = 4; zarr[1] = 4;
TGraph2D* g = new TGraph2D(2, xarr, yarr, zarr);
g->SetName("line");
g->SetLineColor(kBlue);
g->Draw("LINE");
TGraph2D* gP = new TGraph2D(1);
gP->SetName("point");
gP->SetPoint(0, -1.0, 0.0, 0.0);
gP->SetMarkerColor(kRed);
gP->SetMarkerStyle(21);
gP->SetMarkerSize(2);
gP->Draw("P SAME");
}