예제 #1
0
        public IList<SimRoute> GetSimplifedRoute(IList<SimRoute> v3s)
        {
            List<SimRoute> vectors = new List<SimRoute>();
            List<SimRoute> skipped = new List<SimRoute>();
            float ZAngle = Single.NaN;
            bool ZAngleValid = false;
            Vector3d currentV3 = v3s[0].StartNode.Position;
            vectors.Add(v3s[0]);
            for (int Current = 0; Current < v3s.Count; Current++)
            {
                Vector3d compare = v3s[Current].EndNode.Position;
                Vector3d dif = compare - currentV3;
                float NewZAngle = ComparableAngle(Math.Atan2(dif.X, dif.Y));
                if (!ZAngleValid)
                {
                    ZAngleValid = true;
                }
                else
                {
                    float adif = Math.Abs(NewZAngle - ZAngle);
                    if (adif * RAD2DEG > 10)
                    {
                        if (skipped.Count == 0)
                        {
                            vectors.Add(v3s[Current]);
                        }
                        else
                        {
                            SimRoute R = new SimRouteMulti(skipped.ToArray());
                            R.ReWeight(0.9f);
                            AddArc(R);
                            skipped.Clear();
                            vectors.Add(R);
                            skipped.Add(v3s[Current]);
                        }
                    }
                    else
                    {
                        skipped.Add(v3s[Current]);
                    }
                }
                ZAngle = NewZAngle;
                currentV3 = compare;
            }

            return vectors;
        }
예제 #2
0
        //public bool IsOneDirrection = true;

        public static SimRouteMulti CopyProperties(SimRoute simMovement, SimRouteMulti movement)
        {
            return((SimRouteMulti)CopyProperties(simMovement, (SimRoute)movement));
        }
예제 #3
0
        //public bool IsOneDirrection = true;

        public static SimRouteMulti CopyProperties(SimRoute simMovement, SimRouteMulti movement)
        {
            return (SimRouteMulti)CopyProperties(simMovement, (SimRoute)movement);
        }