public MainWindow() { InitializeComponent(); Draw = new Draw(Canvas, 10); Grid = new Grid(Canvas, 720, 720, 10); }
public Setings(MainWindow main) { InitializeComponent(); Main = main; Draw.DrawMainPanel(Tablica, 5, 4); }
private void Rotate(double x0, double y0, double degree) { double x1, y1, x2, y2; degree = -degree; y0 = height - y0; foreach (Line line in canvas.Children) { if (line.Tag.ToString() == "Drawing") { x1 = line.X1; y1 = line.Y1; x2 = line.X2; y2 = line.Y2; line.X1 = x0 + (x1 - x0) * Math.Cos(Draw.DegToRad(degree)) - (y1 - y0) * Math.Sin(Draw.DegToRad(degree)); line.Y1 = y0 + (x1 - x0) * Math.Sin(Draw.DegToRad(degree)) + (y1 - y0) * Math.Cos(Draw.DegToRad(degree)); line.X2 = x0 + (x2 - x0) * Math.Cos(Draw.DegToRad(degree)) - (y2 - y0) * Math.Sin(Draw.DegToRad(degree)); line.Y2 = y0 + (x2 - x0) * Math.Sin(Draw.DegToRad(degree)) + (y2 - y0) * Math.Cos(Draw.DegToRad(degree)); } } }