12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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<Vector> getVertices()
- {
- List<Vector> result = new List<Vector>();
- 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;
- }
- }
- }
|