eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // Bezier.h Math.Component package 00003 //============================================================================ 00004 // Usage : 00005 //---------------------------------------------------------------------------- 00006 // Copyright (C) 2008 by eLynx project 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 // See the GNU Library General Public License for more details. 00017 //---------------------------------------------------------------------------- 00018 #ifndef __Bezier_h__ 00019 #define __Bezier_h__ 00020 00021 #include <elx/math/Geometry.h> 00022 00023 namespace eLynx { 00024 namespace Math { 00025 00026 00027 //============================================================================ 00028 // Cubic Bezier Triangle Class 00029 //============================================================================ 00030 template<typename T, typename U> 00031 struct BezierTriangle3 00032 { 00033 // Constructor 00034 BezierTriangle3(T iX0, T iY0, T iX1, T iY1, T iX2, T iY2); 00035 00036 // Swaps verticies 00037 void Swap(const uint32 iVertex1, const uint32 iVertex2); 00038 00039 // Interpolates value at iX, iY location 00040 void Interpolate(const T iX, const T iY, U* oV) const; 00041 00042 // to be private! 00043 // Array of 10 control points for cubic patch. 00044 // See http://en.wikipedia.org/wiki/Bézier_triangle 00045 // a^3, b^3, y^3, a^2*b, a*b^2, b^2*y, b*y^2, y^2*a, y*a^2 and a*b*y 00046 // First three elements correspond to the vertices of the domain triangle. 00047 Point3<U> _cp[10]; 00048 00049 private: 00050 00051 // Domain triangle. 00052 BarycentricCoordinates2<T> _bcoord; 00053 }; 00054 00055 } // namespace Math 00056 } // namespace eLynx 00057 00058 #include "inl/Bezier.inl" 00059 00060 #endif // __Bezier_h__