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() { GL.Color4(color); GL.Begin(BeginMode.Polygon); GL.Vertex3(position.x - size/2, position.y + size/2, -position.z); GL.Vertex3(position.x + size/2, position.y + size/2, -position.z); GL.Vertex3(position.x + size/2, position.y - size/2, -position.z); GL.Vertex3(position.x - size/2, position.y - size/2, -position.z); GL.End(); } public List getVertices() { List result = new List(); result.Add(new DenseVector(new float[] { position.x - size/2, position.y + size/2, -position.z })); result.Add(new DenseVector(new float[] { position.x + size/2, position.y + size/2, -position.z })); result.Add(new DenseVector(new float[] { position.x + size/2, position.y - size/2, -position.z })); result.Add(new DenseVector(new float[] { position.x - size/2, position.y - size/2, -position.z })); return result; } public uint[] getTriangleIndices() { return new uint[] { 0, 1, 2, 0, 2, 3 }; } public Color getColor() { return color; } } }