Ejemplo n.º 1
0
        public void AddSpans(Span[] list, double weight, double H)
        {
            Catenary last = null;

            if (Spans.Count > 0)
            {
                last   = Spans.Last();
                weight = last.CableWeight;
                H      = last.HorizontalTension;
            }
            RaiseListChangedEvents = false;
            for (int i = 0; i < list.Length; i++)
            {
                var cat = new Catenary(list[i], weight, H);
                if (last != null)
                {
                    cat.StartPosition = last.EndPosition;
                }
                Spans.Add(cat);
                last = cat;
            }
            RaiseListChangedEvents = true;

            OnRulingSpanChange(new ItemChangeEventArgs());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Define a new catenary using defaults
        /// </summary>
        /// <returns></returns>
        public Catenary NewCatenary()
        {
            var last = Last;

            if (last == null)
            {
                return(Catenary.Default(ProjectUnits.Default()));
            }
            return(new Catenary(last.EndPosition, last.StepX, 0.0, last.CableWeight, last.HorizontalTension));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Find vertical separation between catenary and point.
        /// </summary>
        /// <param name="point">The target point</param>
        /// <param name="directional">Return absolute value if false.</param>
        /// <returns></returns>
        public double ClearanceTo(Vector2 point, bool directional)
        {
            Catenary catenary = FindCatenaryFromX(point.X);

            if (catenary != null)
            {
                double dy = catenary.CatenaryFunction(point.X) - point.Y;
                return(directional ? dy : Math.Abs(dy));
            }
            return(0);
        }