TAPs 0.7.7.3
TAPsNURBs.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsNURBs.hpp
00003 
00004 A (Generic) collection of Splines:
00005 
00006 SUKITTI PUNAK   (12/16/2005)
00007 UPDATE          (12/16/2005)
00008 ******************************************************************************/
00009 /******************************************************************************
00010 A NURBs Curve
00011 =============
00012 Degree: d
00013 Knot sequence:  {k_0,...,k_K}
00014 Control points: c_0,...,c_N, with N = K - d + 1
00015 Domain: Curve is only defined over [k_{d-1},...,k_N]
00016 ******************************************************************************/
00017 #ifndef TAPs_NURBS_HPP
00018 #define TAPs_NURBS_HPP
00019 
00020 #include "../Core/TAPsCGMath.hpp"
00021 
00022 BEGIN_NAMESPACE_TAPs
00023 //=============================================================================
00024 template <typename T>
00025 class NURBs {
00026     //-------------------------------------------------------------------------
00027     // (Friend Fn) put it through ostream
00028     friend std::ostream & operator<< ( std::ostream &output, NURBs<T> const &o )
00029     {
00030         output  << "\n======================\n"
00031                 <<   "TAPs::NURBs<"
00032                 << typeid(T).name() << "> Class:\n"
00033                 <<   "======================\n";
00034         return output;
00035     }
00036 //-----------------------------------------------------------------------------
00037 // Member Functions ------------------------------------------------------------
00038 public:
00039     //-------------------------------------------------------------------------
00045     // default constructor
00046     NURBs ();
00047     //-------------------------------------------------------------------------
00048     // nondefault constructor
00049     NURBs ( Vector3<T> ** ctrlPts, 
00050             int numUPts, int numVPts, 
00051             int uDegree, int vDegree, 
00052             int numOfUKnots, int numOfVKnots, 
00053             T * uKnots, T * vKnots );
00054     //-------------------------------------------------------------------------
00055     // destructor
00056     virtual ~NURBs ();
00057     //-------------------------------------------------------------------------
00058     // Get/Set Fn(s)
00059     //-------------------------------------------------------------------------
00060     // Fn(s)
00061     Vector3<T> RetAPointOnSurface ( T u, T v );
00062     Vector3<T> RetAPointOnCurve ( T u );        // u-direction only
00063     Vector3<T> RetAPointOnCurveToo ( T u );     // u-direction only
00064     //-------------------------------------------------------------------------
00065 #if defined(__gl_h_) || defined(__GL_H__)
00066     //-------------------------------------------------------------------------
00067     // OpenGL Fn(s)
00068 public:
00069     // DrawByOpenGL
00070     virtual void DrawByOpenGL ();
00071 #endif
00072     //-------------------------------------------------------------------------
00073 //-----------------------------------------------------------------------------
00074 // Data Members  ---------------------------------------------------------------
00075 protected:
00076     Vector3<T> **   m_prCtrlPts;    // 3D control points in 1D array
00077     int             m_iNumUPts;     // number of u-direction control points
00078     int             m_iNumVPts;     // number of v-direction control points
00079     int             m_iUDegree;     // u degree
00080     int             m_iVDegree;     // v degree
00081     int             m_iNumKnotU;    // number of u knots
00082     int             m_iNumKnotV;    // number of v knots
00083     T *             m_prKnotU;      // horizontral knot sequence (u-direction)
00084     T *             m_prKnotV;      // vertical knot sequence (v-direction)
00085 };
00086 //=============================================================================
00087 END_NAMESPACE_TAPs
00088 //-----------------------------------------------------------------------------
00089 // Include definition if TAPs_USE_EXPORT is not defined
00090 //#if !defined( TAPs_USE_EXPORT )
00091     #include "TAPsNURBs.cpp"
00092 //#endif
00093 //-----------------------------------------------------------------------------
00094 #endif
00095 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00096 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines