![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsConverter.hpp 00003 00004 Converter class is a static class. 00005 00006 u and v directions are shown below 00007 ---u--> 00008 0 1 2 3 00009 | 0 * * * * 00010 | 1 * * * * 00011 v 2 * * * * 00012 | 3 * * * * 00013 v 4 * * * * 00014 where u first then v, i.e. can regard u as a column vector 00015 00016 00017 SUKITTI PUNAK (04/22/2005) 00018 UPDATE (04/25/2005) 00019 ******************************************************************************/ 00020 #ifndef TAPs_CONVERTER_HPP 00021 #define TAPs_CONVERTER_HPP 00022 00023 #include "../Core/TAPsVector3.hpp" 00024 00025 BEGIN_NAMESPACE_TAPs 00026 //============================================================================= 00027 template <typename T> 00028 class Converter { 00029 //============================================================================= 00030 private: 00031 //int m_iOrig; // original (from) vertex 00032 //int m_iDest; // destination (to) vertex 00033 //============================================================================= 00034 public: 00035 //------------------------------------------------------------------------- 00036 // A 3x4 Bezier Patch example (u is 3 and v is 4) 00037 // ---u--> 00038 // 0 1 2 3 00039 // | 0 * * * * 00040 // | 1 * * * * 00041 // v 2 * * * * 00042 // | 3 * * * * 00043 // v 4 * * * * 00044 // controlPts is the pointer to the control points 00045 // with each point is a T array of size 3 for x, y, and z. 00046 // uSub and vSub are the number of quads in u and v direction respectively 00047 static Point3<T> * ConvertABezierPatchToAQuadMesh ( Point3<T> * bPts, 00048 int uDegree, int vDegree, 00049 int uSub, int vSub ); 00050 private: 00051 //------------------------------------------------------------------------- 00052 // A recursive algorithm 00053 // b00 ---- bU0 00054 // | * | 00055 // | (u,v) | 00056 // b0V ---- bUV 00057 static void deCasteljauBiLinear ( T u, T v, int U, int V, // i/p 00058 Point3<T> * bPts_ip, // i/o or control pts 00059 Point3<T> * bPts_op, // i/o 00060 Point3<T> * meshPt ); // o/p 00061 static void deCasteljauBiLinearRec ( T u, T v, int U, int V, // i/p 00062 Point3<T> * bPts_ip, // i/p 00063 Point3<T> * bPts_op, // o/p 00064 Point3<T> * meshPt ); // o/p 00065 public: 00066 //------------------------------------------------------------------------- 00067 // Write to a 10 format file 00068 // ---u--> 00069 // 0 1 2 3 00070 // | 0 * * * * 00071 // | 1 * * * * 00072 // v 2 * * * * 00073 // | 3 * * * * 00074 // v 4 * * * * 00075 static bool WriteGridPtsAsQuadMeshToA10FormatFile ( 00076 Point3<T> * gridPts, int uSize, int vSize, char * outFileName ); 00077 static bool WriteGridPtsAsTriMeshToA10FormatFile ( 00078 Point3<T> * gridPts, int uSize, int vSize, char * outFileName ); 00079 static bool WriteGridPtsAsTriMeshToA10FormatFile2 ( 00080 Point3<T> * gridPts, int uSize, int vSize, char * outFileName ); 00081 //------------------------------------------------------------------------- 00082 static Point3<T> * ReadABezierPatchFromFile ( 00083 char * inFileName, // i/p 00084 int &uDegree, int &vDegree ); // o/p 00085 static bool SpecialFnToCreateA10FormatFileFromHegDataFile ( int uSize, int vSize ); 00086 //------------------------------------------------------------------------- 00087 }; // END CLASS BezierToLinear 00088 //============================================================================= 00089 END_NAMESPACE_TAPs 00090 //----------------------------------------------------------------------------- 00091 // Include definition if TAPs_USE_EXPORT is not defined 00092 //#if !defined( TAPs_USE_EXPORT ) 00093 #include "TAPsConverter.cpp" 00094 //#endif 00095 //----------------------------------------------------------------------------- 00096 #endif 00097 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00098 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8