public TestingCompoundVertexInfo(Vector springForce, Vector repulsionForce, Vector gravityForce, Vector applicationForce) { SpringForce = springForce; RepulsionForce = repulsionForce; GravityForce = gravityForce; ApplicationForce = applicationForce; }
public static double AngleBetween(Vector vector1, Vector vector2) { var y = (vector1._x * vector2._y) - (vector2._x * vector1._y); var x = (vector1._x * vector2._x) + (vector1._y * vector2._y); return (Math.Atan2(y, x) * 57.295779513082323); }
public static double CrossProduct(Vector vector1, Vector vector2) { return ((vector1._x * vector2._y) - (vector1._y * vector2._x)); }
public bool Equals(Vector value) { return Equals(this, value); }
public static bool Equals(Vector vector1, Vector vector2) { return (vector1.X.Equals(vector2.X) && vector1.Y.Equals(vector2.Y)); }
public static Rect Offset(Rect rect, Vector offsetVector) { rect.Offset(offsetVector.X, offsetVector.Y); return rect; }
public void Offset(Vector offsetVector) { if (IsEmpty) { throw new InvalidOperationException("Rect_CannotCallMethod"); } _x += offsetVector._x; _y += offsetVector._y; }
public Rect(Point point, Vector vector) : this(point, point + vector) { }
public static bool IsSameDirection(Vector a, Vector b) { return Math.Sign(a.X) == Math.Sign(b.X) && Math.Sign(a.Y) == Math.Sign(b.Y); }
private void OnMouseDown(PointerRoutedEventArgs e, bool isPreview) { if (ModifierMode != ZoomViewModifierMode.None) return; _startedAsAreaSelection = false; switch (e.KeyModifiers) { case VirtualKeyModifiers.None: if (!isPreview) ModifierMode = ZoomViewModifierMode.Pan; break; case VirtualKeyModifiers.Windows | VirtualKeyModifiers.Control: _startedAsAreaSelection = true; ModifierMode = ZoomViewModifierMode.ZoomBox; break; case VirtualKeyModifiers.Windows: ModifierMode = ZoomViewModifierMode.ZoomBox; break; case VirtualKeyModifiers.Control: break; case VirtualKeyModifiers.Shift: ModifierMode = ZoomViewModifierMode.Pan; break; default: return; } if (ModifierMode == ZoomViewModifierMode.None) return; _mouseDownPos = e.GetCurrentPoint(this).Position; _startTranslate = new Vector(TranslateX, TranslateY); CapturePointer(e.Pointer); PointerMoved += ZoomControl_PreviewMouseMove; }