当前位置: 首页>>代码示例>>C#>>正文


C# Point.Rotate方法代码示例

本文整理汇总了C#中Point.Rotate方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Rotate方法的具体用法?C# Point.Rotate怎么用?C# Point.Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point.Rotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArrangeOverride

        /// <summary>
        /// 子要素配置のオーバーライド
        /// </summary>
        /// <param name="arrangeBounds">使用可能領域</param>
        /// <returns>使用した領域のサイズを返します。</returns>
        protected override Size ArrangeOverride(Size arrangeBounds)
        {
#if DEBUG
            Debug.WriteLine("[{0}] ArrangeOverride[{1}]", this._measureCounter, arrangeBounds);
#endif
            var angle = 360.0 / this.InternalChildren.Count;
            foreach (var item in this.InternalChildren.OfType<UIElement>().Select((x, i) => new { Element = x, Angle = i * angle }))
            {
                if (item.Element != null)
                {
                    var origin = new Point(this._mainboardCenter.X, this._mainboardCenter.Y - this._mainboardSize.Height / 2.0);
                    var pt = origin.Rotate(item.Angle, this._mainboardCenter);
                    pt.Offset(-item.Element.DesiredSize.Width / 2.0, -(pt.Y - origin.Y) / this._mainboardSize.Height * item.Element.DesiredSize.Height);
                    var offset = GetLabelOffset(item.Element);
                    pt.Offset(offset.X, offset.Y);
                    item.Element.Arrange(new Rect(pt, item.Element.DesiredSize));
                }
            }

            return arrangeBounds;
        }
开发者ID:YKSoftware,项目名称:YKToolkit.Controls,代码行数:26,代码来源:Generic.RadarChart.xaml.cs

示例2: Rotate

 public void Rotate(double a, double b, double c)
 {
     Point point = new Point(X, Y, Z);
     point.Rotate(a, b, c);
     X = (int)point.X;
     Y = (int)point.Y;
     Z = (int)point.Z;
 }
开发者ID:eastcm,项目名称:RobSim,代码行数:8,代码来源:IRob.cs

示例3: Update

        /// <summary>
        /// Calculates Canvas position with a given game world position
        /// </summary>
        public void Update(Vector3 position)
        {
            try
            {
                WorldVector = position;

                var centerActorPosition = CanvasData.CenterVector;

                // Distance from Actor to Player
                RawWorldDistanceX = centerActorPosition.X - position.X;
                RawWorldDistanceY = centerActorPosition.Y - position.Y;

                // We want 1 yard of game distance to = Gridsize
                RawDrawDistanceX = RawWorldDistanceX * (float)CanvasData.GridSquareSize.Width;
                RawDrawDistanceY = RawWorldDistanceY * (float)CanvasData.GridSquareSize.Height;

                // Distance on canvas from center to actor
                RawDrawPositionX = (CanvasData.Center.X + RawDrawDistanceX);
                RawDrawPositionY = (CanvasData.Center.Y + RawDrawDistanceY);

                // Points in Canvas and Grid Scale
                RawPoint = new Point(RawDrawPositionX, RawDrawPositionY);
                RawGridPoint = new Point(RawDrawPositionX / CanvasData.GridSquareSize.Width, RawDrawPositionY / CanvasData.GridSquareSize.Height);

                // Switched to manual calculations because WPF transforms are very slow 
                // (0.0015ms+ each versus 0.0000ms for raw math).
                Point = RawPoint.Rotate(CanvasData.Center, CanvasData.GobalRotationAngle);
                Point = Point.FlipX(CanvasData.Center);               

                GridPoint = new Point((int)(Point.X / CanvasData.GridSquareSize.Width), (int)(Point.Y / CanvasData.GridSquareSize.Height));
                IsBeyondCanvas = Point.X < 0 || Point.X > CanvasData.CanvasSize.Width || Point.Y < 0 || Point.Y > CanvasData.CanvasSize.Height;
            }
            catch (Exception ex)
            {
                Logger.Debug("Exception in RadarUI.PointMorph.Update(). {0} {1}", ex.Message, ex.InnerException);
            }
        }
开发者ID:dachidahu,项目名称:AutoFollow,代码行数:40,代码来源:PointMorph.cs


注:本文中的Point.Rotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。