X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbezier.cpp;fp=src%2Fbezier.cpp;h=0000000000000000000000000000000000000000;hb=5c7c36b21d0f2a88accd8ff12c05dcc3004ce0e8;hp=415f3819dbd293024f0fd010b7ff3106b74eac2a;hpb=4e11c12e60477f13a26c0bbad41fbd9a2b1db5d9;p=ttedit diff --git a/src/bezier.cpp b/src/bezier.cpp deleted file mode 100755 index 415f381..0000000 --- a/src/bezier.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// Bezier curve fitter -// by James L. Hammons -// (C) 2005 Underground Software -// -// This function takes three points and draws a curve using a -// second order Bezier function. -// -// JLH = James L. Hammons -// -// Who When What -// --- ---------- ------------------------------------------------------------- -// JLH 03/14/1998 Created this file -// JLH 01/20/2005 Converted to use wxWidgets -// - -#include "bezier.h" - -double abs(double n) // Helper function -{ - return (n < 0 ? -n : n); -} - -void Bezier(wxDC &dc, point p1, point p2, point p3) -{ - double step = abs(p1.x - p3.x), tmp = abs(p1.y - p3.y); - step = (tmp > step ? tmp : step); // Get the larger of the two... - step = (step > 0 ? 1/step : 1); // & convert to valid step value - -// MoveToEx(hdc, (int)p1.x, (int)p1.y, NULL); - wxCoord prevX = (wxCoord)p1.x, prevY = (wxCoord)p1.y; - - for(double u=0; u<=1; u+=step) - { - double _2u = 2*u, _uu = u*u, _2uu = 2*_uu, - x = (p1.x * (1 - _2u + _uu)) + (p2.x * (_2u - _2uu)) + (p3.x * _uu), - y = (p1.y * (1 - _2u + _uu)) + (p2.y * (_2u - _2uu)) + (p3.y * _uu); -// LineTo(hdc, (int)x, (int)y); - dc.DrawLine(prevX, prevY, (wxCoord)x, (wxCoord)y); - prevX = (wxCoord)x, prevY = (wxCoord)y; - } - -// LineTo(hdc, (int)p3.x, (int)p3.y); - dc.DrawLine(prevX, prevY, (wxCoord)p3.x, (wxCoord)p3.y); -}