public static List <Box3Fill> Simplify(List <Box3Fill> simpl)
        {
            try
            {
                return(Simplify1(simpl));
            }
            catch (Exception)
            {
                return(simpl);
            }
            int             bc = simpl.Count;
            int             t0 = Environment.TickCount;
            List <Box3Fill> s0 = Simplify0(new List <Box3Fill>(simpl));
            int             t1 = Environment.TickCount;
            List <Box3Fill> s1 = Simplify1(new List <Box3Fill>(simpl));
            int             t2 = Environment.TickCount;
            int             c0 = s0.Count;
            int             c1 = s1.Count;

            CollisionPlane.Debug("Simplify {0} S0={1}/{2}  S1={3}/{4}  ", bc, t1 - t0, c0, t2 - t1, c1);
            if (c1 < c0)
            {
                return(s1);
            }
            return(s0);
        }
Beispiel #2
0
 public void SetOccupied(CallbackXY p, SimZMinMaxLevel MinMaxZ, float detail)
 {
     if (InnerBoxes.Count == 0)
     {
         CollisionPlane.Debug("using outerbox for " + this);
         OuterBox.SetOccupied(p, MinMaxZ, detail);
         return;
     }
     foreach (CollisionObject box in InnerBoxes)
     {
         box.SetOccupied(p, MinMaxZ, detail);
     }
 }
Beispiel #3
0
        public bool IsInside(float x, float y, float z)
        {
            // Offset position

            if (OuterBox.IsInside(x, y, z)) // Is possible?
            {
                if (InnerBoxes.Count == 0)
                {
                    CollisionPlane.Debug("using outerbox for " + this);
                    return(true);
                }
                foreach (CollisionObject box in InnerBoxes)
                {
                    if (box.IsInside(x, y, z))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        private void object_click(object sender, EventArgs e)
        {
            IList <CollisionObject> occs = (IList <CollisionObject>)Current.GetOccupiedObjects(LastPlane.MinZ, LastPlane.MaxZ);

            try
            {
                if (sender is Button)
                {
                    Button          B    = (Button)sender;
                    string          name = B.Name.Substring(1);
                    int             i    = int.Parse(name) - 1;
                    CollisionObject O    = occs[i];
                    if (O is IMeshedObject)
                    {
                        ((IMeshedObject)O).RemeshObject();
                    }
                }
            }
            catch (Exception ex)
            {
                CollisionPlane.Debug(ex);
            }
        }
Beispiel #5
0
 public virtual bool UpdateOccupied(SimPathStore pathStore)
 {
     if (pathStore == null)
     {
         CollisionPlane.Debug("Cant UpdatePathOccupied for {0}", this);// + " pos " + RootObject.DistanceVectorString(RootObject));
         return(false);
     }
     if (!UpdateMeshPaths)
     {
         return(false);
     }
     if (MeshOnlySolids && !IsSolid)
     {
         return(false);
     }
     if (InnerBoxes == null)
     {
         return(false);
     }
     if (InnerBoxes.Count == 0)
     {
         return(false);
     }
     if (!IsRegionAttached())
     {
         return(false);
     }
     //  int t1;
     try
     {
         //lock (PathStore)
         {
             if (PathStore == pathStore)
             {
                 return(false);
             }
             PathStore = pathStore;//.Add(pathStore);
             if (tryFastVersion)
             {
                 //                UpdatePathOccupiedFast(PathStore);
                 // int tc = Environment.TickCount;
                 UpdatePathOccupiedVeryFast(pathStore);
                 // t1 = Environment.TickCount - tc;
                 InnerBoxes = null;
                 PathStore.AddedCount++;
                 //  CollisionPlane.Debug("t1 vs t2 = " + t1 );
                 return(true);
             }
         }
         ForceUpdatePathOccupied(pathStore);
         return(true);
     }
     catch (Exception e)
     {
         //  lock (PathStore)
         {
             PathStore = null;//.Remove(pathStore);
         }
         return(false);
     };
 }