using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using OpenTK.Graphics.OpenGL; using MathNet.Numerics.LinearAlgebra.Single; namespace bbiwarg.Graphics { class Rectangle : IGraphicElement { public Vertex[] corners; public Color color; public Rectangle(Vertex[] corners, Color color) { this.corners = corners; this.color = color; } public void draw() { GL.Color4(color); GL.Begin(BeginMode.Polygon); GL.Vertex3(corners[0].x, corners[0].y, -corners[0].z); GL.Vertex3(corners[1].x, corners[0].y, -corners[0].z); GL.Vertex3(corners[1].x, corners[1].y, -corners[1].z); GL.Vertex3(corners[0].x, corners[1].y, -corners[1].z); GL.End(); } public List getVertices() { List result = new List(); result.Add(new DenseVector(new float[] { corners[0].x, corners[0].y, -corners[0].z })); result.Add(new DenseVector(new float[] { corners[1].x, corners[0].y, -corners[0].z })); result.Add(new DenseVector(new float[] { corners[1].x, corners[1].y, -corners[1].z })); result.Add(new DenseVector(new float[] { corners[0].x, corners[1].y, -corners[1].z })); return result; } public uint[] getTriangleIndices() { return new uint[] { 0, 1, 2, 0, 2, 3 }; } public Color getColor() { return color; } } }