本文整理汇总了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;
}
示例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;
}
示例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);
}
}