Пример #1
0
        public static HRegion GetRegion(this IRectangle2 rect)
        {
            var processRegion = new HRegion();

            processRegion.GenRectangle2(rect.Y, rect.X, rect.Angle, rect.HalfWidth, rect.HalfHeight);
            return(processRegion);
        }
Пример #2
0
        public static HRegion GenRegion(this IRectangle2 rectangle2)
        {
            var region = new HRegion();

            region.GenRectangle2(
                rectangle2.Y,
                rectangle2.X,
                rectangle2.Angle,
                rectangle2.HalfWidth,
                rectangle2.HalfHeight);
            return(region);
        }
Пример #3
0
        public static IRectangle2 UpdateRelativeCoordinate(this IRectangle2 rectangle2,
                                                           IRelativeCoordinate relativeCoordinate)
        {
            var relativeCenterVector = new Vector(rectangle2.X, rectangle2.Y);
            var actualCenterVector   = relativeCoordinate.GetOriginalVector(relativeCenterVector);

            var relativeRect = new Rectangle2
            {
                X          = actualCenterVector.X,
                Y          = actualCenterVector.Y,
                Angle      = relativeCoordinate.GetCoordinateAngle() + rectangle2.Angle,
                HalfWidth  = rectangle2.HalfWidth,
                HalfHeight = rectangle2.HalfHeight
            };

            return(relativeRect);
        }