Now, I have a question that some experienced programmers can help, and I don't know if is regarding Irrlicht or not. Take a look in this simple code:
Code: Select all
Data_path * Segment::get_data_path_for_triangle(triangle3df tri)
{
track->updateAbsolutePosition();
CMatrix4<f32> mat = track->getAbsoluteTransformation();
for(u32 i = 0; i < path.size(); i++)
{
for(u32 j = 0; j < path[i]->tri.size(); j++)
{
vector3df v_a = path[i]->tri[j].pointA;
vector3df v_b = path[i]->tri[j].pointB;
vector3df v_c = path[i]->tri[j].pointC;
mat.transformVect(v_a);
mat.transformVect(v_b);
mat.transformVect(v_c);
triangle3df tri_p(v_a, v_b, v_c);
printf("\t%5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f\n\t%5.2f %5.2f %5.2f\n\n",
tri_p.pointA.X, tri_p.pointA.Y, tri_p.pointA.Z,
tri_p.pointB.X, tri_p.pointB.Y, tri_p.pointB.Z,
tri_p.pointC.X, tri_p.pointC.Y, tri_p.pointC.Z);
if(tri_p.pointA.X == tri.pointA.X && tri_p.pointB.X == tri.pointB.X && tri_p.pointC.X == tri.pointC.X &&
tri_p.pointA.Y == tri.pointA.Y && tri_p.pointB.Y == tri.pointB.Y && tri_p.pointC.Y == tri.pointC.Y &&
tri_p.pointA.Z == tri.pointA.Z && tri_p.pointB.Z == tri.pointB.Z && tri_p.pointC.Z == tri.pointC.Z)
{
printf("^^^ ABOVE ^^^\n");
return path[i];
};
};
};
return NULL;
};
This code works fine but, this is the annoying part, only if I let that "printf" there. If I remove the printf, the conditional stops working! I program in C++ over eight years and never heard something like that! I have a theory that is some typecasting involved that the printf is casting, but no conclusion at all. Someone saw anything like this before?
Thanks!
Obs.: I really get confused if I must ask for help from a programmer or a priest!