Exemplo n.º 1
0
        /// <summary>
        /// The opposite side line is the line opposite the angle between this line and the
        /// adjacent line. This line, the adjacent line and the opposite line form a right
        /// triangle. Where the right angle of the right triangle is at the intersection of
        /// the adjacent line and the opposite side line.
        ///
        /// Use this method to get the position on the line of the opposite side line as
        /// the length of the adjacent line is varied.
        /// </summary>
        /// <param name="AdjacentSideLength"></param>
        /// <returns></returns>
        public LineCoordinates CalcOppositeSideLine(double AdjacentSideLength)
        {
            var adjSide = new HorizontalLineCoordinates(this.Start, AdjacentSideLength);

            var angle = Math.Abs(this.Angle);

            var radians = angle * (Math.PI / 180);
            var tan     = Math.Tan(radians);

            // length of the opposite side line.
            var oppLgth = AdjacentSideLength * tan;

            // the end point of the opposite side line. Where the end point is either
            // above the adjacent line or below it. Depending on if the line ( the
            // hypotenuse ) goes up or down.
            Point oppEnd;

            if (this.SlopesUp == true)
            {
                oppEnd            = new Point(adjSide.End.X, adjSide.End.Y - oppLgth + 1.00);
                _OppositeSideLine = new LineCoordinates(oppEnd, adjSide.End);
            }
            else
            {
                oppEnd            = new Point(adjSide.End.X, adjSide.End.Y + oppLgth - 1.00);
                _OppositeSideLine = new LineCoordinates(adjSide.End, oppEnd);
            }

            return(_OppositeSideLine);
        }
Exemplo n.º 2
0
        public LineCoordinates CalcAdjacentSideLine(double OppLgth)
        {
            // calc the adj side line lgth from the angle of this line and the given
            // opposite side lgth.
            var angle   = Math.Abs(this.Angle);
            var radians = angle * (Math.PI / 180);
            var tan     = Math.Tan(radians);
            var adjLgth = OppLgth / tan;

            var adjLine = new HorizontalLineCoordinates(this.Start, adjLgth);

            return(adjLine);
        }