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 Point : IGraphicElement { public Vertex position; public Color color; public float size; public Point(Vertex position, Color color, float size) { this.position = position; this.color = color; this.size = size; } public void draw(int width, int height) { GL.Color4(color); float relX = position.x - width / 2; float relY = height / 2 - position.y; GL.Begin(BeginMode.Polygon); GL.Vertex3(relX - size, relY + size, -position.z); GL.Vertex3(relX + size, relY + size, -position.z); GL.Vertex3(relX + size, relY - size, -position.z); GL.Vertex3(relX - size, relY - size, -position.z); GL.End(); } public List getVertices(int width, int height) { float relX = position.x - width / 2; float relY = height / 2 - position.y; List result = new List(); Vector temp = new DenseVector(new float[] { relX - size, relY + size, -position.z }); result.Add(temp); temp = new DenseVector(new float[] { relX + size, relY + size, -position.z }); result.Add(temp); temp = new DenseVector(new float[] { relX + size, relY - size, -position.z }); result.Add(temp); temp = new DenseVector(new float[] { relX - size, relY - size, -position.z }); result.Add(temp); return result; } public uint[] getTriangleIndices() { return new uint[] { 0, 1, 2, 0, 2, 3 }; } public Color getColor() { return color; } } }