Exemple #1
0
        private bool AddCollisionData(int step, string lugName, string rollerName, VIZCore3D.NET.Data.Vertex3D lug, VIZCore3D.NET.Data.Vertex3D roller, string tag, out CollisionItem collisionItem)
        {
            collisionItem = new CollisionItem();

            if (AnimationOnly == true) return false;

            VIZCore3D.NET.Data.Vertex3D start = lug;
            VIZCore3D.NET.Data.Vertex3D finish = roller;
            VIZCore3D.NET.Data.Vertex3D offset = start.PointToPoint(finish, 200);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            List<VIZCore3D.NET.Data.NearestObjectByAxisPoint> nearObjects
                = vizcore3d.GeometryUtility.GetNearestObjects(new List<int>() { 0 }, offset, finish, 0);

            sw.Stop();

            if (EnablePerformanceLog == true)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("{0} : {1} ms", tag, sw.ElapsedMilliseconds.ToString()));
                System.Diagnostics.Trace.WriteLine(string.Format("{0} : {1} ms", tag, sw.ElapsedMilliseconds.ToString()));
            }

            bool find = false;

            foreach (VIZCore3D.NET.Data.NearestObjectByAxisPoint item in nearObjects)
            {
                if (item.Index > 0 && ROLLER.ContainsKey(item.Index) == false)
                {
                    if (CollisionObjects.ContainsKey(item.Index) == false)
                    {
                        string nodePath = vizcore3d.Object3D.GetNodePath(item.Index);
                        if (nodePath.Contains("BLK") == true)
                        {
                            collisionItem.Set(item, lugName, rollerName, nodePath);

                            CollisionObjects.Add(item.Index, collisionItem);
                            find = true;
                        }
                    }
                }
            }

            return find;
        }
Exemple #2
0
 private void AddRollerCache(int index)
 {
     if (ROLLER.ContainsKey(index) == false)
         ROLLER.Add(index, index);
 }