Курсовая работа: Разбиение Делоне
}
ReCalclateDeloneCircle();
}
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
{
int k = Math.Abs(e.Delta) / e.Delta;
if (shape.Width + 2 * k >= 0)
{
shape.SetValue(Canvas.LeftProperty, (double)shape.GetValue(Canvas.LeftProperty) - k);
shape.SetValue(Canvas.TopProperty, (double)shape.GetValue(Canvas.TopProperty) - k);
shape.Width += 2 * k;
shape.Height += 2 * k;
}
ReCalclateDeloneCircle();
}
Функции для определения радиусов кругов Делоне, и для переопределения по мере передвижения кругов по рабочему окну.
private void ReCalclateDeloneCircle()
{
double r1 = c1.Width / 2;
double x1 = (double)c1.GetValue(Canvas.LeftProperty) + r1;
double y1 = (double)c1.GetValue(Canvas.TopProperty) + r1;
double r2 = c2.Width / 2;
double x2 = (double)c2.GetValue(Canvas.LeftProperty) + r2;
double y2 = (double)c2.GetValue(Canvas.TopProperty) + r2;
double r3 = c3.Width / 2;
double x3 = (double)c3.GetValue(Canvas.LeftProperty) + r3;
double y3 = (double)c3.GetValue(Canvas.TopProperty) + r3;
double x4, y4, r4, x5, y5, r5;
CalclateDeloneCircle(x1, y1, r1, x2, y2, r2, x3, y3, r3, out x4, out y4, out r4, out x5, out y5, out r5);