using YMath; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Demo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void pictureBox1_Click(object sender, EventArgs e) { /*var g = pictureBox1.CreateGraphics(); g.SmoothingMode = SmoothingMode.HighQuality; var pen = new Pen(Brushes.Black, 2); var rect = CubePoints(100.0, 2); DrawLines(g, pen, rect);*/ }/* // [-1; 1] -> [0; width] private static Vector[] RelativeToAbsolute(Vector[] points, int width, int height) { return points.Select(p => new Vector( (p[0] + 1) / 2 * width, (p[1] + 1) / 2 * height)) .ToArray(); } private static void DrawLines(Graphics g, Pen pen, Line[] lines) { foreach (var line in lines) g.DrawLine(pen, new PointF((float)line.Start[0], (float)line.End[1]), new PointF((float)line.Start[0], (float)line.End[1])); } public struct Line { public Line(Vector start, Vector end) { Start = start; End = end; } public Vector Start { get; set; } public Vector End { get; set; } } public static Line[] Cube(int nDimensions) { if (nDimensions == 0) return new Vector[] { new Vector(0) }; var result = new List(); var offset = new Vector(nDimensions); offset[nDimensions - 1] = 1; var face /*боже*//* = Cube(nDimensions - 1); result.AddRange(face.Select(p => p + offset)); result.AddRange(face.Select(p => p - offset)); } public static Vector[] CubePoints(double size, int nDimensions) { int n = 1 << nDimensions; if (nDimensions >= 32) throw new ArgumentException("Fuck yourself"); var result = new Vector[n]; for (int i = 0; i < n; i++) { var vec = new Vector(nDimensions); for (int j = 0; j < nDimensions; j++) vec[j] = ((i >> j) & 1) - 0.5; result[i] = vec; } return result; }*/ } }