Example #1
0
        ////
        //// Force this segment into standard position; only 1st and second quadrants allowed.
        ////
        //public Segment Standardize()
        //{
        //    Point vector = Point.MakeVector(this.Point1, this.Point2);

        //    // If this segment is in the 3rd or 4th quadrant, force into the second by taking the opposite.
        //    if (vector.Y < 0) vector = Point.GetOppositeVector(vector);

        //    return new Segment(origin, vector);
        //}

        public Segment ConstructSegmentByAngle(Point tail, int angle, int length)
        {
            // Make a vector in standard position
            Point vector = Point.MakeVector(tail, this.OtherPoint(tail));

            // Calculate the angle from standard position.
            double stdPosAngle = Point.GetDegreeStandardAngleWithCenter(origin, vector);

            // Get the exact point we want.
            Point rotatedPoint = Figure.GetPointByLengthAndAngleInStandardPosition(length, stdPosAngle - angle);

            return(new Segment(tail, rotatedPoint));
        }