View Issue Details

IDProjectCategoryView StatusLast Update
0000650FreeCADFeaturepublic2012-03-28 11:48
Reportershoogen Assigned Toyorik  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Fixed in Version0.13 
Summary0000650: Placement API extension
Descriptionadd a function to test a placement to be obsolete
Additional InformationI've ssen people calculating the rotation axis and angle in order to check whether a placement does any change to the object. The efficent way to check this would be ((placement.Rotation.Q == (0,0,0,1) or placement.Rotation.Q == (0,0,0,-1)) and placement.Base.Length == 0)
But this should be hidden from the users.
This could also be be taken for the boolean value of the Placement object
TagsNo tags attached.
FreeCAD Information

Activities

yorik

2012-03-23 12:58

administrator   ~0001807

there is such a function in Draft fcgeo module:
  from draftlibs import fcgeo
  fcgeo.isNull(myPlacement)
But indeed the placement could easily have such a function...

shoogen

2012-03-23 13:39

developer   ~0001808

Last edited: 2012-03-26 09:57

i think there is a flaw in 'rotation'. I don't think that this will give the correct result for q == -q

the comparrsion should check for both representations of the rotation
bool Rotation::operator==(const Rotation & q) const
{
    bool equal = true;
    bool negative = true;
    for (int i=0; i<4;i++)
        {
        equal &= (fabs(this->quat[i] - q.quat[i]) < 0.005 );
        negative &= (fabs(this->quat[i] + q.quat[i]) < 0.005 );
        }
    return (equal || negative);
}

yorik

2012-03-28 11:48

administrator   ~0001825

Done in commit 9656a98
Placements now have an isNull() function that returns True if its Base = (0,0,0) and its Rotation = (0,0,0,1) or (0,0,0,-1)

Issue History

Date Modified Username Field Change
2012-03-23 10:32 shoogen New Issue
2012-03-23 12:58 yorik Note Added: 0001807
2012-03-23 12:58 yorik Status new => assigned
2012-03-23 12:58 yorik Assigned To => yorik
2012-03-23 13:39 shoogen Note Added: 0001808
2012-03-26 09:56 shoogen Note Edited: 0001808
2012-03-26 09:57 shoogen Note Edited: 0001808
2012-03-28 11:48 yorik Note Added: 0001825
2012-03-28 11:48 yorik Status assigned => closed
2012-03-28 11:48 yorik Resolution open => fixed
2012-03-28 11:48 yorik Fixed in Version => 0.13