public static void Intersect(ref RectangleFx rect1, ref RectangleFx rect2, out RectangleFx result) { result = new RectangleFx(); float num8 = rect1.Max.X; float num7 = rect2.Max.X; float num6 = rect1.Max.Y; float num5 = rect2.Max.Y; float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X; float num = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y; float num4 = (num8 < num7) ? num8 : num7; float num3 = (num6 < num5) ? num6 : num5; if ((num4 > num2) && (num3 > num)) { result.Min.X = num2; result.Min.Y = num; result.Max.X = num4; result.Max.Y = num3; } result.Min.X = 0; result.Min.Y = 0; result.Max.X = 0; result.Max.Y = 0; }
public static RectangleFx Intersect(RectangleFx rect1, RectangleFx rect2) { RectangleFx result; float num8 = rect1.Max.X; float num7 = rect2.Max.X; float num6 = rect1.Max.Y; float num5 = rect2.Max.Y; float num2 = (rect1.Min.X > rect2.Min.X) ? rect1.Min.X : rect2.Min.X; float num = (rect1.Min.Y > rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y; float num4 = (num8 < num7) ? num8 : num7; float num3 = (num6 < num5) ? num6 : num5; if ((num4 > num2) && (num3 > num)) { result.Min.X = num2; result.Min.Y = num; result.Max.X = num4; result.Max.Y = num3; return(result); } result.Min.X = 0; result.Min.Y = 0; result.Max.X = 0; result.Max.Y = 0; return(result); }
public bool Equals(RectangleFx other) { return ((this.Min.X == other.Min.X) && (this.Min.Y == other.Min.Y) && (this.Max.X == other.Max.X) && (this.Max.Y == other.Max.Y)); }
public void Intersects(ref RectangleFx rect, out bool result) { result = (this.Min.X < rect.Max.X) && (this.Min.Y < rect.Max.Y) && (this.Max.X > rect.Min.X) && (this.Max.Y > rect.Min.Y); }
public bool Intersects(RectangleFx rect) { return ((this.Min.X < rect.Max.X) && (this.Min.Y < rect.Max.Y) && (this.Max.X > rect.Min.X) && (this.Max.Y > rect.Min.Y)); }
public void Contains(ref RectangleFx rect, out bool result) { result = (this.Min.X <= rect.Min.X) && (this.Min.Y <= rect.Min.Y) && (this.Max.X >= rect.Max.X) && (this.Max.Y >= rect.Max.Y); }
public bool Contains(RectangleFx rect) { return ((this.Min.X <= rect.Min.X) && (this.Min.Y <= rect.Min.Y) && (this.Max.X >= rect.Max.X) && (this.Max.Y >= rect.Max.Y)); }
public static RectangleFx InverseTransform(Matrix matrix, RectangleFx rect) { if (matrix.Determinant() != 0.0f) { Matrix tempMatrix = Matrix.Identity; tempMatrix = Matrix.Multiply(tempMatrix, matrix); tempMatrix = Matrix.Invert(tempMatrix); rect = MatrixExtensions.Transform(tempMatrix, rect); } return(rect); }
internal void DrawRectangle(Color brush, RectangleFx rectangle) { DrawingContext.Begin( SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, null, Transform); //DrawingContext.Begin(); DrawingContext.DrawRectangle(rectangle.ToRectangle(), brush); DrawingContext.End(); }
internal static RectangleFx Transform(Matrix matrix, RectangleFx rect) { float x = rect.X; float y = rect.Y; float width = rect.Width; float height = rect.Height; PTS4[0].X = x; PTS4[0].Y = y; PTS4[1].X = x + width; PTS4[1].Y = y; PTS4[2].X = x + width; PTS4[2].Y = y + height; PTS4[3].X = x; PTS4[3].Y = y + height; PTS4 = MatrixExtensions.TransformPoints(matrix, PTS4); float minX = PTS4[0].X; float minY = PTS4[0].Y; float maxX = PTS4[0].X; float maxY = PTS4[0].Y; for (int i = 1; i < 4; i++) { x = PTS4[i].X; y = PTS4[i].Y; if (x < minX) { minX = x; } if (y < minY) { minY = y; } if (x > maxX) { maxX = x; } if (y > maxY) { maxY = y; } } RectangleFx ret = new RectangleFx(minX, minY, maxX - minX, maxY - minY); return(rect); }
public static void Union(ref RectangleFx rect1, ref RectangleFx rect2, out RectangleFx result) { result = new RectangleFx(); float num6 = rect1.Max.X; float num5 = rect2.Max.X; float num4 = rect1.Max.Y; float num3 = rect2.Max.Y; float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X; float num = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y; float num8 = (num6 > num5) ? num6 : num5; float num7 = (num4 > num3) ? num4 : num3; result.Min.X = num2; result.Min.Y = num; result.Max.X = num8; result.Max.Y = num7; }
internal void AddRectangle(RectangleFx rect) { float x = rect.X; float y = rect.Y; float w = rect.Width; float h = rect.Height; AddPoint(new PointFx(x, y), PathPointType.Start); AddPoint(new PointFx(x + w, y), PathPointType.Line); AddPoint(new PointFx(x + w, y + h), PathPointType.Line); AddPoint(new PointFx(x, y + h), PathPointType.Line); AddPoint(new PointFx(x, y), PathPointType.CloseSubpath); //AddLine(x, y, x + w, y); //AddLine(x + w, y, x + w, y + h); //AddLine(x + w, y + h, x, y + h); //AddLine(x, y + h, x, y); }
public static RectangleFx Union(RectangleFx rect1, RectangleFx rect2) { RectangleFx result = new RectangleFx(); float num6 = rect1.Max.X; float num5 = rect2.Max.X; float num4 = rect1.Max.Y; float num3 = rect2.Max.Y; float num2 = (rect1.Min.X < rect2.Min.X) ? rect1.Min.X : rect2.Min.X; float num = (rect1.Min.Y < rect2.Min.Y) ? rect1.Min.Y : rect2.Min.Y; float num8 = (num6 > num5) ? num6 : num5; float num7 = (num4 > num3) ? num4 : num3; result.Min.X = num2; result.Min.Y = num; result.Max.X = num8; result.Max.Y = num7; return(result); }
internal bool IsVisible(RectangleFx bounds) { throw new NotImplementedException(); }
public RegionFx(RectangleFx Bounds) { // TODO: Complete member initialization this.Bounds = Bounds; }
internal void FillRectangle(Color brush, RectangleFx rectangle) { DrawingContext.DrawFilledRectangle(rectangle.ToRectangle(), brush); }
internal void DrawString(string text, SpriteFont renderFont, Color textBrush, RectangleFx rectangleF, System.Drawing.StringFormat stringFormat) { DrawingContext.Begin( SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Transform); //DrawingContext.Begin(); DrawingContext.DrawText(renderFont, text, new Vector2(rectangleF.X, rectangleF.Y), textBrush); DrawingContext.End(); }
public static Point GetSizeAsPoint(this RectangleFx r) { return(new Point((int)r.Width, (int)r.Height)); }
public static RectangleFx FromLTRB(this RectangleFx src, float left, float top, float right, float bottom) { return(new RectangleFx(src.Left, src.Top, src.Right - src.Left, src.Bottom - src.Top)); }
public static bool Contains(this RectangleFx r, Vector2 pos) { return(pos.X >= r.Left && pos.X <= r.Left + r.Width && pos.Y >= r.Top && pos.Y <= r.Top + r.Height); }
public static bool Contains(this RectangleFx r, float x, float y) { return(x >= r.Left && x <= r.Left + r.Width && y >= r.Top && y <= r.Top + r.Height); }
public static Vector2 BottomRightAsVector2(this RectangleFx r) { return(new Vector2(r.Right, r.Bottom)); }
public static Vector2 GetSizeAsVector2(this RectangleFx r) { return(new Vector2(r.Width, r.Height)); }
public bool IntersectsWith(RectangleFx rect) { return(this.ToRectangleF().IntersectsWith(rect.ToRectangleF())); }
static RectangleFx() { RectangleFx.mEmpty = new RectangleFx(); RectangleFx.mMinMax = new RectangleFx(Vector2.One * float.MinValue, Vector2.One * float.MaxValue); }
public static Point BottomRightAsPoint(this RectangleFx r) { return(new Point((int)r.Right, (int)r.Bottom)); }
public static RectangleFx CenterRectangle(this RectangleFx r, int x, int y) { return(new RectangleFx(x - r.Center.X, y - r.Center.Y, r.Width, r.Height)); }