View Issue Details

IDProjectCategoryView StatusLast Update
0000531FreeCADBugpublic2011-12-13 17:02
Reportersparr0 Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.11 
Fixed in Version0.13 
Summary0000531: Python API: Mirroring rotated parts produces undesired results
DescriptionAfter a part has been .rotate()'d if you attempt to .mirror() it then the result will not be as expected. Instead of mirroring the rotated part, it will find the target location for mirroring the unrotated part around the stated mirror plane, then apply the rotation to the target location, then put the still-unrotated part at that location.
Additional Informationhttp://i.imgur.com/l0cqZ.png

How to reproduce:

from FreeCAD import Base

box = Part.makeBox(10,20,1)
Part.show(box)
box2 = box.mirror(Base.Vector(0,0,10),Base.Vector(0,0,-1))
Part.show(box2)

box.rotate(Base.Vector(0,0,0),Base.Vector(1,0,0),30)
Part.show(box)
box2 = box.mirror(Base.Vector(0,0,10),Base.Vector(0,0,-1))
Part.show(box2)

TagsNo tags attached.
FreeCAD Information

Activities

2011-12-10 12:33

 

bug.png (Attachment missing)

logari81

2011-12-10 13:42

developer   ~0001445

I think this is relevant to the inconsistencies with the placement property that I am working on now, so I assign it to myself.

wmayer

2011-12-10 14:38

administrator   ~0001449

The problem might be in TopoShape::mirror(). I guess instead of
mat = placement * mat;
it should be
mat = mat * placement;

This looks better but still not correct. This however can also be a bug in OCC. for more details:
http://www.opencascade.org/org/forum/thread_20781/

wmayer

2011-12-13 14:56

administrator   ~0001477

Obviously there is also a bug in gp_Trsf::SetMirror() because the determinant of the matrix is +1 but it should be -1.

wmayer

2011-12-13 17:00

administrator   ~0001478

No, gp_Trsf::SetMirror() is OK because the sign of the determinant is handled by another attribute. So, the solution is remove this line completely:
mat = placement * mat;

wmayer

2011-12-13 17:02

administrator   ~0001479

Fixed in rev 5296

Issue History

Date Modified Username Field Change
2011-12-10 12:33 sparr0 New Issue
2011-12-10 12:33 sparr0 File Added: bug.png
2011-12-10 13:42 logari81 Note Added: 0001445
2011-12-10 13:43 logari81 Assigned To => logari81
2011-12-10 13:43 logari81 Status new => confirmed
2011-12-10 14:38 wmayer Note Added: 0001449
2011-12-13 13:54 logari81 Assigned To logari81 =>
2011-12-13 14:56 wmayer Note Added: 0001477
2011-12-13 17:00 wmayer Note Added: 0001478
2011-12-13 17:02 wmayer Note Added: 0001479
2011-12-13 17:02 wmayer Status confirmed => closed
2011-12-13 17:02 wmayer Resolution open => fixed
2011-12-13 17:02 wmayer Fixed in Version => 0.13