Beispiel #1
0
        public XbimMatrix3D ToMatrix3D(ConcurrentDictionary <int, object> maps = null)
        {
            object transform;

            if (maps != null && maps.TryGetValue(EntityLabel, out transform)) //already converted it just return cached
            {
                return((XbimMatrix3D)transform);
            }
            if (RefDirection != null)
            {
                XbimVector3D v = RefDirection.XbimVector3D();
                v.Normalized();
                transform = new XbimMatrix3D(v.X, v.Y, 0, 0, v.Y, v.X, 0, 0, 0, 0, 1, 0, Location.X, Location.Y, 0, 1);
            }
            else
            {
                transform = new XbimMatrix3D(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, Location.X, Location.Y,
                                             Location.Z, 1);
            }
            if (maps != null)
            {
                maps.TryAdd(EntityLabel, transform);
            }
            return((XbimMatrix3D)transform);
        }
Beispiel #2
0
        private XbimMatrix3D ConvertAxis3D()
        {
            if (RefDirection == null || Axis == null)
            {
                return(new XbimMatrix3D(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, Location.X, Location.Y,
                                        Location.Z, 1));
            }

            var za = Axis.XbimVector3D();

            za.Normalized();
            var xa = RefDirection.XbimVector3D();

            xa.Normalized();
            var ya = XbimVector3D.CrossProduct(za, xa);

            ya.Normalized();
            return(new XbimMatrix3D(xa.X, xa.Y, xa.Z, 0, ya.X, ya.Y, ya.Z, 0, za.X, za.Y, za.Z, 0, Location.X,
                                    Location.Y, Location.Z, 1));
        }