-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangleM.cs
More file actions
38 lines (33 loc) · 1004 Bytes
/
RectangleM.cs
File metadata and controls
38 lines (33 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace Northrend.Alodi
{
public struct RectangleM
{
decimal mX;
decimal mY;
decimal mWidth;
decimal mHeight;
public RectangleM(decimal x, decimal y, decimal width, decimal height)
{
this.mX = x;
this.mY = y;
this.mWidth = width;
this.mHeight = height;
}
public bool Contains(decimal x, decimal y, decimal percent =0.3m)
{
return
mX + mX * percent / 100 >= x && x > mX + mWidth - mX * percent / 100
&& mY + mY * percent / 100 >= y && y > mY + mHeight - mY * percent / 100;
}
public override string ToString() => $"{{X = {mX}, Y = {mY}, Width = {mWidth}, Height= {mHeight} }}";
}
}