]> Shamusworld >> Repos - ttedit/blobdiff - src/bezier.cpp
Repurposed code in bezier.h/cpp, added middle button scrolling
[ttedit] / src / bezier.cpp
diff --git a/src/bezier.cpp b/src/bezier.cpp
deleted file mode 100755 (executable)
index 415f381..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//\r
-// Bezier curve fitter\r
-// by James L. Hammons\r
-// (C) 2005 Underground Software\r
-//\r
-// This function takes three points and draws a curve using a\r
-// second order Bezier function.\r
-//\r
-// JLH = James L. Hammons <jlhamm@acm.org>\r
-//\r
-// Who  When        What\r
-// ---  ----------  -------------------------------------------------------------\r
-// JLH  03/14/1998  Created this file\r
-// JLH  01/20/2005  Converted to use wxWidgets\r
-//\r
-\r
-#include "bezier.h"\r
-\r
-double abs(double n)                                                   // Helper function\r
-{\r
-       return (n < 0 ? -n : n);\r
-}\r
-\r
-void Bezier(wxDC &dc, point p1, point p2, point p3)\r
-{\r
-       double step = abs(p1.x - p3.x), tmp = abs(p1.y - p3.y);\r
-       step = (tmp > step ? tmp : step);                       // Get the larger of the two...\r
-       step = (step > 0 ? 1/step : 1);                         // & convert to valid step value\r
-\r
-//     MoveToEx(hdc, (int)p1.x, (int)p1.y, NULL);\r
-       wxCoord prevX = (wxCoord)p1.x, prevY = (wxCoord)p1.y;\r
-\r
-       for(double u=0; u<=1; u+=step)\r
-       {\r
-               double _2u = 2*u, _uu = u*u, _2uu = 2*_uu,\r
-                       x = (p1.x * (1 - _2u + _uu)) + (p2.x * (_2u - _2uu)) + (p3.x * _uu),\r
-                       y = (p1.y * (1 - _2u + _uu)) + (p2.y * (_2u - _2uu)) + (p3.y * _uu);\r
-//             LineTo(hdc, (int)x, (int)y);\r
-               dc.DrawLine(prevX, prevY, (wxCoord)x, (wxCoord)y);\r
-               prevX = (wxCoord)x, prevY = (wxCoord)y;\r
-       }\r
-\r
-//     LineTo(hdc, (int)p3.x, (int)p3.y);\r
-       dc.DrawLine(prevX, prevY, (wxCoord)p3.x, (wxCoord)p3.y);\r
-}\r