private static XbimMatrix3D ConvertCartesianTranformOperator3D(IfcCartesianTransformationOperator3D ct3D)
        {
            XbimMatrix3D m3d = ConvertCartesianTransform3D(ct3D);

            m3d.Scale(ct3D.Scl);
            return m3d;
        }
        private static XbimMatrix3D ConvertCartesianTransform3D(IfcCartesianTransformationOperator3D ct3D)
        {
            XbimVector3D u3; //Z Axis Direction
            XbimVector3D u2; //X Axis Direction
            XbimVector3D u1; //Y axis direction
            if (ct3D.Axis3 != null)
            {
                IfcDirection dir = ct3D.Axis3;
                u3 = new XbimVector3D(dir.DirectionRatios[0], dir.DirectionRatios[1], dir.DirectionRatios[2]);
                u3.Normalize();
            }
            else
                u3 = new XbimVector3D(0, 0, 1);
            if (ct3D.Axis1 != null)
            {
                IfcDirection dir = ct3D.Axis1;
                u1 = new XbimVector3D(dir.DirectionRatios[0], dir.DirectionRatios[1], dir.DirectionRatios[2]);
                u1.Normalize();
            }
            else
            {
                XbimVector3D defXDir = new XbimVector3D(1, 0, 0);
                u1 = u3 != defXDir ? defXDir : new XbimVector3D(0, 1, 0);
            }
            XbimVector3D xVec = XbimVector3D.Multiply(XbimVector3D.DotProduct(u1, u3), u3);
            XbimVector3D xAxis = XbimVector3D.Subtract(u1, xVec);
            xAxis.Normalize();

            if (ct3D.Axis2 != null)
            {
                IfcDirection dir = ct3D.Axis2;
                u2 = new XbimVector3D(dir.DirectionRatios[0], dir.DirectionRatios[1], dir.DirectionRatios[2]);
                u2.Normalize();
            }
            else
                u2 = new XbimVector3D(0, 1, 0);

            XbimVector3D tmp = XbimVector3D.Multiply(XbimVector3D.DotProduct(u2, u3), u3);
            XbimVector3D yAxis = XbimVector3D.Subtract(u2, tmp);
            tmp = XbimVector3D.Multiply(XbimVector3D.DotProduct(u2, xAxis), xAxis);
            yAxis = XbimVector3D.Subtract(yAxis, tmp);
            yAxis.Normalize();
            u2 = yAxis;
            u1 = xAxis;

            XbimPoint3D lo = ct3D.LocalOrigin.XbimPoint3D(); //local origin

            return new XbimMatrix3D(u1.X, u1.Y, u1.Z, 0,
                                           u2.X, u2.Y, u2.Z, 0,
                                           u3.X, u3.Y, u3.Z, 0,
                                           lo.X, lo.Y, lo.Z, 1);
           
        }