Hi, so I'm working on this issue and just wanted to create a thread to get some feedback.

First question:

what's up with this inversion? https://github.com/FreeCAD/FreeCAD/blob ... pp#L74-L77

I'm assuming it must be a mistake.

Anyway, I believe one of the core issues here may be an OCC bug, or at least a misuse of OCC, here and here.

Reference:

void gp_Trsf::SetMirror ( const gp_Ax2 & A2)

My test case is simple: I'm using a 1mm x 1mm square sketch, cornered at the origin and padded up 1mm, so a unit cube in the +X,+Y,+Z octant. So my gp_Pnt axbase is always (0, 0, 0).

If I reverse the inversion in my first link, I get the following results:

Mirror about vertical sketch axis (Y): axdir is (0, 1, 0). So, the mirror matrix should be [[-1, 0, 0], [0, 1, 0], [0, 0, 1]]. However the Z-direction ends up being negative.

Mirror about horizontal sketch axis (X): axdir is (1, 0, 0), ok. But the mirror matrix is [[1, 0, 0], [0, -1, 0], [0, 0,-1]] as above. The Z direction is negative when it shouldn't be.

Repeat this with sketches attached to the YZ and XZ planes, and always the corresponding normal is reversed. (So what should be X is -X, and what should be Y is -Y, respectively.)

So, this is obviously a problem. It got me thinking, though. Is this a problem with handedness/chirality of coordinate systems, and the fact that we're trying to mirror? In OCC, gp_Ax2 is a right-handed coordinate system only. There is a separate class, gp_Ax3, that can be left-handed, but then there is no gp_Trsf::SetMirror( const gp_Ax3& A3 )...