Ejemplo n.º 1
0
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			var start = new StateGeometry(values[0], values[1], values[2]);
			var end = new StateGeometry(values[3], values[4], values[5]);
			var vec = start.CenterOf(end);
			return new Thickness(vec.X, vec.Y, 0, 0);
		}
Ejemplo n.º 2
0
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			var start = new StateGeometry(values[0], values[1], values[2]);
			var end = new StateGeometry(values[3], values[4], values[5]);
			var startvec = start.CenterOf(end);
			var endvec = end.CenterOf(start);
			//dy/dx = tan(t) => t = arcTan(dy/dx)
			double t = Math.Atan2(
						Math.Abs(startvec.Y - endvec.Y),
						Math.Abs(startvec.X - endvec.X)) * 180 / Math.PI;
			if (endvec.X <= startvec.X && endvec.Y >= startvec.Y) return 180 - t;
			if (endvec.X >= startvec.X && endvec.Y <= startvec.Y) return -t;
			if (endvec.X <= startvec.X && endvec.Y <= startvec.Y) return 180 + t;
			return t;
		}
Ejemplo n.º 3
0
		public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
		{
			var start = new StateGeometry(values[0], values[1], values[2]);
			var end = new StateGeometry(values[3], values[4], values[5]);
			//get side for states
			var startvec = start.CenterOf(end);
			var endvec = end.CenterOf(start);
			return Math.Sqrt(Math.Pow(startvec.X - endvec.X, 2) + Math.Pow(startvec.Y - endvec.Y, 2));
		}