本文整理汇总了C#中Loon.Core.Geom.RectBox.GetMinX方法的典型用法代码示例。如果您正苦于以下问题:C# RectBox.GetMinX方法的具体用法?C# RectBox.GetMinX怎么用?C# RectBox.GetMinX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loon.Core.Geom.RectBox
的用法示例。
在下文中一共展示了RectBox.GetMinX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsRectToCirc
/// <summary>
/// 检查矩形与圆形是否发生了碰撞
/// </summary>
///
/// <param name="rect1"></param>
/// <param name="rect2"></param>
/// <returns></returns>
public static bool IsRectToCirc(RectBox rect1, RectBox rect2)
{
float radius = rect2.GetWidth() / 2;
Point middle = GetMiddlePoint(rect2);
Point upperLeft = new Point(rect1.GetMinX(), rect1.GetMinY());
Point upperRight = new Point(rect1.GetMaxX(), rect1.GetMinY());
Point downLeft = new Point(rect1.GetMinX(), rect1.GetMaxY());
Point downRight = new Point(rect1.GetMaxX(), rect1.GetMaxY());
bool collided = true;
if (!IsPointToLine(upperLeft, upperRight, middle, radius))
{
if (!IsPointToLine(upperRight, downRight, middle, radius))
{
if (!IsPointToLine(upperLeft, downLeft, middle, radius))
{
if (!IsPointToLine(downLeft, downRight, middle, radius))
{
collided = false;
}
}
}
}
return collided;
}
示例2: GetScroll
public virtual int GetScroll(RectBox visibleRect, int orientation, int direction)
{
int cellSize = this.GetCellSize();
double scrollPos = 0.0D;
if (orientation == 0)
{
if (direction < 0)
{
scrollPos = visibleRect.GetMinX();
}
else if (direction > 0)
{
scrollPos = visibleRect.GetMaxX();
}
}
else if (direction < 0)
{
scrollPos = visibleRect.GetMinY();
}
else if (direction > 0)
{
scrollPos = visibleRect.GetMaxY();
}
int increment = System.Math.Abs((int)System.Math.IEEERemainder(scrollPos, cellSize));
if (increment == 0)
{
increment = cellSize;
}
return increment;
}