Beispiel #1
0
 public static FRectangle CreateByCenter(FPoint pos, float w, float h)
 {
     return(new FRectangle(pos.X - w / 2, pos.Y - h / 2, w, h));
 }
Beispiel #2
0
 public static FRectangle CreateByCenter(FPoint origin, float cx, float cy, float width, float height)
 {
     return(new FRectangle(origin.X + cx - width / 2, origin.Y + cy - height / 2, width, height));
 }
Beispiel #3
0
 public static FRectangle CreateByCenter(FPoint pos, FSize size)
 {
     return(new FRectangle(pos.X - size.Width / 2, pos.Y - size.Height / 2, size.Width, size.Height));
 }
Beispiel #4
0
 public FRectangle AsCenteredTo(FPoint center)
 {
     return(new FRectangle(center.X - Width / 2, center.Y - Height / 2, Width, Height));
 }
Beispiel #5
0
 public FRectangle AsRotateCenterAround(FPoint center, float rot)
 {
     return(CreateByCenter(Center.RotateAround(center, rot), Width, Height));
 }
Beispiel #6
0
 public FRectangle AsScaledAndTranslated(float scale, FPoint offset)
 {
     return(new FRectangle(X * scale + offset.X, Y * scale + offset.Y, Width * scale, Height * scale));
 }
Beispiel #7
0
 public bool Contains(FPoint p, float delta)
 {
     return((X - p.X) * (X - p.X) + (Y - p.Y) * (Y - p.Y) <= (Radius + delta) * (Radius + delta));
 }
Beispiel #8
0
 public bool Contains(FPoint p)
 {
     return((X - p.X) * (X - p.X) + (Y - p.Y) * (Y - p.Y) <= Radius * Radius);
 }
Beispiel #9
0
 public FCircle(FPoint location, float radius)
 {
     X      = location.X;
     Y      = location.Y;
     Radius = radius;
 }
Beispiel #10
0
 public static FSize Diff(FPoint a, FPoint b)
 {
     return(new FSize(FloatMath.Abs(a.X - b.X), FloatMath.Abs(a.Y - b.Y)));
 }