Exemple #1
0
 public void MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (e.Button.HasFlag(System.Windows.Forms.MouseButtons.Left)) leftButton = true;
     if (e.Button.HasFlag(System.Windows.Forms.MouseButtons.Right)) rightButton = true;
     mousePos = new int2(e.X, e.Y);
     dragStart = new int2(e.X, e.Y);
     UpdateMouseControls();
 }
Exemple #2
0
 public void MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     mousePos = new int2(e.X, e.Y);
     UpdateMouseControls();
     dragStart = new int2(e.X, e.Y);
 }
Exemple #3
0
 public double2(int2 i)
 {
     x = (double)i.x;
     y = (double)i.y;
 }
Exemple #4
0
 public void SetUndefined()
 {
     m_min = new int2(int.MaxValue, int.MaxValue);
     m_max = new int2(int.MinValue, int.MinValue);
 }
Exemple #5
0
 public float2(int2 i)
 {
     x = (float)i.x;
     y = (float)i.y;
 }
Exemple #6
0
 public void Intersection(BoxI2 box)
 {
     if (!Intersects(box))
     {
         SetUndefined();
         return;
     }
     m_min = m_min.Max(box.m_min);
     m_max = m_max.Min(box.m_max);
 }
Exemple #7
0
 public void MergePoint(int2 point1)
 {
     m_min = m_min.Min(point1);
     m_max = m_max.Max(point1);
 }
Exemple #8
0
 public BoxI2(Box2 b)
 {
     m_min = new int2(b.Min);
     m_max = new int2(b.Max);
 }
Exemple #9
0
 public bool Contains(int2 point)
 {
     if (!IsDefined()) return false;
     if (m_min.x > point.x) return false;
     if (m_min.y > point.y) return false;
     if (m_max.x < point.x) return false;
     if (m_max.y < point.y) return false;
     return true;
 }
Exemple #10
0
 public int2 Min(int2 v)
 {
     int2 ret = new int2();
     ret.x = x < v.x ? x : v.x;
     ret.y = y < v.y ? y : v.y;
     return ret;
 }
Exemple #11
0
 public BoxI2(int2 min, int2 max)
 {
     m_min = min.Min(max);
     m_max = min.Max(max);
 }
Exemple #12
0
 public int2 Max(int2 v)
 {
     int2 ret = new int2();
     ret.x = x > v.x ? x : v.x;
     ret.y = y > v.y ? y : v.y;
     return ret;
 }
Exemple #13
0
 // math functions
 public int Dot(int2 v)
 {
     return (x * v.x) + (y * v.y);
 }
Exemple #14
0
 public int Distance(int2 v)
 {
     int2 delta = v - this;
     int len = delta.Dot(delta);
     return (int)System.Math.Sqrt((double)len);
 }
Exemple #15
0
 public static int2 Lerp(int2 a, int2 b, int alpha)
 {
     throw new Exception("Not yet implemented");
 }
Exemple #16
0
 public int2(int2 f)
 {
     x = f.x;
     y = f.y;
 }