bug in gp_Dir::Mirror(const gp_Ax2 & axis)

hello,
i would like to signal a bug in gp_Dir. The void Mirror(const gp_Ax2 & axis) and gp_Dir Mirrored(const gp_Ax2 & axis) don't work. For example :
gp_Dir toSym(1,1,1);

gp_Dir dir(1,0,0);
gp_Pnt loc(0,0,0);
gp_Ax2 symObj(loc,dir);

toSym.Mirror(symObj);
std::cout

And the result is :
the result -0.57735 -0.57735 -0.57735

but we should have :
the result -0.57735 0.57735 0.57735

thank you,
Moreno

Thomas Paviot's picture

Hi Moreno,

If you look at the file gp_Ax2.cxx, you will see:
[snippet]
void gp_Ax2::Mirror (const gp_Pnt& P)
{
gp_Pnt Temp = axis.Location();
Temp.Mirror (P);
axis.SetLocation (Temp);
vxdir.Reverse ();
vydir.Reverse ();
}
[/snippet]

vxdir and vydir are reversed, which seems to be the origin of the issue you reported. I doubt there is any bug in this 21 years old file, but why not. Could you explain why the result "should be" -0.5.. 0.5.. 0.5.. (didn't have time to take a sheet of paper and quickly draw your problem).

Thomas

Thomas Paviot's picture

Sorry, you use a gp_Ax2 for the mirror function, and I quoted the wrong function prototype. Here is what is related to Mirror(const gp_Ax2& A2):
[snippet]
void gp_Ax2::Mirror (const gp_Ax2& A2)
{
vydir.Mirror (A2);
vxdir.Mirror (A2);
gp_Pnt Temp = axis.Location();
Temp.Mirror (A2);
axis.SetLocation (Temp);
axis.SetDirection (vxdir.Crossed (vydir));
}
[/snippet]
Reading this sample, I have no explaination regarding the reported issue. Sorry for the noise!

Forum supervisor's picture

Hi Moreno,
I would like to inform you that the posted problem is checked and reproduced.
The corresponding issue with ID = OCC22558 has been registered.
Later you can know if the issue is resolved by checking references to the specified ID in OCCT Release Notes. The analysis of the issue will take some time depending on our technical capability and availability of resources.
Regards