コード例 #1
0
        /// <summary>
        /// Returns the bounding rectangle.
        /// </summary>
        /// <param name="Rect">Rectangle to recieve the result.</param>
        public void GetBoundingRect(C2DRect Rect)
        {
            Rect.Set(_Rim.BoundingRect);

            for (var i = 0; i < _Holes.Count; i++)
            {
                Rect.ExpandToInclude(_Holes[i].BoundingRect);
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the parameters required to draw an arc.
        /// </summary>
        private void GetArcParameters(C2DArc Arc, C2DRect Rect, ref int nStartAngle, ref int nSweepAngle)
        {
            C2DPoint Centre = Arc.GetCircleCentre();

            Rect.Set(Centre.x - Arc.Radius, Centre.y + Arc.Radius,
                     Centre.x + Arc.Radius, Centre.y - Arc.Radius);

            ScaleAndOffSet(Rect.TopLeft);
            ScaleAndOffSet(Rect.BottomRight);
            ScaleAndOffSet(Centre);                                    // CR 19-1-09

            C2DPoint bottomRightTemp = new C2DPoint(Rect.BottomRight); // to make valid // CR 11-3-09

            Rect.BottomRight.Set(Rect.TopLeft);                        // to make valid // CR 11-3-09
            Rect.ExpandToInclude(bottomRightTemp);                     // to make valid // CR 11-3-09

            C2DPoint pt1 = Arc.Line.GetPointFrom();
            C2DPoint pt2 = Arc.Line.GetPointTo();

            this.ScaleAndOffSet(pt1);
            this.ScaleAndOffSet(pt2);

            C2DVector vec1 = new C2DVector(Centre, pt1);
            C2DVector vec2 = new C2DVector(Centre, pt2);

            C2DVector vecx = new C2DVector(100, 0); // x - axis

            double dStartAngle = vecx.AngleToLeft(vec1) * Constants.conDegreesPerRadian;
            double dSweepAngle = 0;

            bool bAlreadyFlipped = Scale.x * Scale.y < 0;

            if (Arc.ArcOnRight ^ bAlreadyFlipped)
            {
                dSweepAngle = vec1.AngleToLeft(vec2) * Constants.conDegreesPerRadian;
            }
            else
            {
                dSweepAngle = -vec1.AngleToRight(vec2) * Constants.conDegreesPerRadian;
            }

            nStartAngle = (int)dStartAngle;
            if (nStartAngle == 360)
            {
                nStartAngle = 0;
            }
            nSweepAngle = (int)dSweepAngle;
        }
コード例 #3
0
ファイル: C2DPointSet.cs プロジェクト: kasznare/DIP1
        /// <summary>
        /// Gets the bounding rectangle.
        /// </summary>
        /// <param name="Rect">Ouput. The Rect.</param>
        public void GetBoundingRect(C2DRect Rect)
        {
            if (Count == 0)
            {
                Rect.Clear();
                return;
            }
            else
            {
                Rect.Set(this[0]);

                for (int i = 1; i < Count; i++)
                {
                    Rect.ExpandToInclude(this[i]);
                }
            }
        }
コード例 #4
0
ファイル: C2DLine.cs プロジェクト: micrak/rakomeister-attic
        /// <summary>
        /// Returns the bounding rectangle.
        /// </summary>
        /// <param name="Rect">Output. The bounding rectangle.</param>
        public override void GetBoundingRect( C2DRect Rect) 
        {
	        Rect.Set(point);
	        Rect.ExpandToInclude(GetPointTo());
        }
コード例 #5
0
        /// <summary>
        /// Returns the bounding rect.
        /// </summary>
        /// <param name="Rect">Output. The bounding rectangle.</param>
        public override void GetBoundingRect(C2DRect Rect)
        {
	        Rect.Set(P1);
    	    Rect.ExpandToInclude(P2);
	        Rect.ExpandToInclude(P3);

        }
コード例 #6
0
        /// <summary>
        /// Returns the bounding rectangle.
        /// </summary>
        /// <param name="Rect">Rectangle to recieve the result.</param> 
        public void GetBoundingRect(C2DRect Rect) 
        {
            Rect.Set(_Rim.BoundingRect);

	        for (int i = 0; i < _Holes.Count; i++)
	        {
		        Rect.ExpandToInclude( _Holes[i].BoundingRect);
	        }
        }
コード例 #7
0
 /// <summary>
 /// Returns the bounding rect.
 /// </summary>
 /// <param name="Rect">Output. The bounding rectangle.</param>
 public override void GetBoundingRect(C2DRect Rect)
 {
     Rect.Set(P1);
     Rect.ExpandToInclude(P2);
     Rect.ExpandToInclude(P3);
 }
コード例 #8
0
 /// <summary>
 /// Returns the bounding rectangle.
 /// </summary>
 /// <param name="Rect">Output. The bounding rectangle.</param>
 public override void GetBoundingRect(C2DRect Rect)
 {
     Rect.Set(point);
     Rect.ExpandToInclude(GetPointTo());
 }
コード例 #9
0
        /// <summary>
        /// Gets the parameters required to draw an arc.
        /// </summary>
        private void GetArcParameters(C2DArc Arc, C2DRect Rect, ref int nStartAngle, ref int nSweepAngle)
        {
            C2DPoint Centre = Arc.GetCircleCentre();

            Rect.Set(Centre.x - Arc.Radius, Centre.y + Arc.Radius,
                                        Centre.x + Arc.Radius, Centre.y - Arc.Radius);

            ScaleAndOffSet(Rect.TopLeft);
            ScaleAndOffSet(Rect.BottomRight);
            ScaleAndOffSet(Centre); // CR 19-1-09

            C2DPoint bottomRightTemp = new C2DPoint(Rect.BottomRight); // to make valid // CR 11-3-09
            Rect.BottomRight.Set(Rect.TopLeft); // to make valid // CR 11-3-09
            Rect.ExpandToInclude(bottomRightTemp); // to make valid // CR 11-3-09

            C2DPoint pt1 = Arc.Line.GetPointFrom();
            C2DPoint pt2 = Arc.Line.GetPointTo();
            this.ScaleAndOffSet(pt1);
            this.ScaleAndOffSet(pt2);

            C2DVector vec1 = new C2DVector(Centre, pt1);
            C2DVector vec2 = new C2DVector(Centre, pt2);

            C2DVector vecx = new C2DVector(100, 0); // x - axis

            double dStartAngle = vecx.AngleToLeft(vec1) * Constants.conDegreesPerRadian;
            double dSweepAngle = 0;

            bool bAlreadyFlipped = Scale.x * Scale.y < 0;

            if (Arc.ArcOnRight ^ bAlreadyFlipped)
                dSweepAngle = vec1.AngleToLeft(vec2) * Constants.conDegreesPerRadian;
            else
                dSweepAngle = -vec1.AngleToRight(vec2) * Constants.conDegreesPerRadian;

            nStartAngle = (int)dStartAngle;
            if (nStartAngle == 360)
                nStartAngle = 0;
            nSweepAngle = (int)dSweepAngle;
        }