Small OpenGL based c++ rendering library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

punkt2d.h 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* libsegl - Sebas Extended GL Library
  2. * Collection of Opengl/3D-Math helpers
  3. *
  4. * Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de
  5. * http://www.seba-geek.de
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef __PUNKT3D_H
  23. #define __PUNKT3D_H
  24. #include <iostream>
  25. #include <cmath>
  26. #include "emath.h"
  27. namespace segl {
  28. class Punkt2D {
  29. public:
  30. Punkt2D();
  31. Punkt2D(float, float);
  32. float x, y;
  33. void set(float, float);
  34. void print(std::string="");
  35. float abs();
  36. void normalize();
  37. Punkt2D getNormalized() const;
  38. // Operatoren
  39. Punkt2D operator+(const Punkt2D&);
  40. Punkt2D operator-(const Punkt2D&);
  41. Punkt2D& operator+=(const Punkt2D&);
  42. Punkt2D& operator-=(const Punkt2D&);
  43. Punkt2D operator+(const float&);
  44. Punkt2D operator-(const float&);
  45. Punkt2D operator*(const float&);
  46. Punkt2D operator/(const float&);
  47. Punkt2D& operator+=(const float&);
  48. Punkt2D& operator-=(const float&);
  49. Punkt2D& operator*=(const float&);
  50. Punkt2D& operator/=(const float&);
  51. float operator*(const Punkt2D&);
  52. Punkt2D operator-();
  53. bool operator==(const Punkt2D&);
  54. bool operator!=(const Punkt2D&);
  55. friend Punkt2D operator+(const float&, const Punkt2D&);
  56. friend Punkt2D operator-(const float&, const Punkt2D&);
  57. friend Punkt2D operator*(const float&, const Punkt2D&);
  58. friend Punkt2D operator/(const float&, const Punkt2D&);
  59. };
  60. } // namespace segl
  61. void glTexCoord2f(segl::Punkt2D);
  62. float abs(segl::Punkt2D);
  63. // Fixed Headers
  64. void glTexCoordP2D(segl::Punkt2D p);
  65. #endif