Point3D.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using OpenTK.Graphics.OpenGL;
  8. using MathNet.Numerics.LinearAlgebra.Single;
  9. namespace bbiwarg.Graphics.GraphicElements3D
  10. {
  11. class Point3D : IGraphicElement3D
  12. {
  13. private Vector position;
  14. private Color color;
  15. private float size;
  16. public Point3D(Vector position, Color color, float size)
  17. {
  18. this.position = position;
  19. this.color = color;
  20. this.size = size;
  21. }
  22. public void draw()
  23. {
  24. GL.Color4(color);
  25. GL.Begin(BeginMode.Polygon);
  26. GL.Vertex3(position[0] - size/2, position[1] + size/2, -position[2]);
  27. GL.Vertex3(position[0] + size/2, position[1] + size/2, -position[2]);
  28. GL.Vertex3(position[0] + size/2, position[1] - size/2, -position[2]);
  29. GL.Vertex3(position[0] - size/2, position[1] - size/2, -position[2]);
  30. GL.End();
  31. }
  32. }
  33. }