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.

44 lines
1.3KB

  1. /* Copyleft (C) 2002 David Griffiths <dave@pawfal.org>
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17. #include <vector>
  18. #ifndef BEZIER_CURVE_STUFF
  19. #define BEZIER_CURVE_STUFF
  20. struct Vec2
  21. {
  22. Vec2(float a=0, float b=0) { x=a; y=b;}
  23. float x; float y;
  24. };
  25. using std::vector;
  26. static vector<Vec2> Spline;
  27. void Bezier(Vec2 &Out, Vec2 a, Vec2 b, Vec2 c, Vec2 d, float t);
  28. void CalculateBezierCurve(vector<Vec2> *List,
  29. float x1,float y1,float x2,float y2,
  30. float x3,float y3,float x4,float y4,
  31. int Sections=16);
  32. void AddToSpline(const Vec2 &CV);
  33. void CalculateBezierSpline(vector<Vec2> *List,int Sections=16);
  34. #endif