Example #1
0
        /// <summary>
        /// Tries to get start position and initial direction.
        /// </summary>
        /// <param name="X">X-coordinate.</param>
        /// <param name="Y">Y-coordinate.</param>
        /// <param name="Direction">Initial direction.</param>
        /// <returns>If a start position was found.</returns>
        public bool TryGetStart(out float X, out float Y, out float Direction)
        {
            int c = this.vertices.Count;
            if (c<2)
            {
                X = Y = Direction = 0;
                return false;
            }

            SKPoint P0 = this.vertices[0];
            SKPoint P1 = this.vertices[1];
            float dx = P1.X - P0.X;
            float dy = P1.Y - P0.Y;

            X = P0.X;
            Y = P0.Y;
            Direction = LayoutElement.CalcDirection(dx, dy);

            return true;
        }