Wm4ParametricSurface.h

Go to the documentation of this file.
00001 // Wild Magic Source Code
00002 // David Eberly
00003 // http://www.geometrictools.com
00004 // Copyright (c) 1998-2007
00005 //
00006 // This library is free software; you can redistribute it and/or modify it
00007 // under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation; either version 2.1 of the License, or (at
00009 // your option) any later version.  The license is available for reading at
00010 // either of the locations:
00011 //     http://www.gnu.org/copyleft/lgpl.html
00012 //     http://www.geometrictools.com/License/WildMagicLicense.pdf
00013 // The license applies to versions 0 through 4 of Wild Magic.
00014 //
00015 // Version: 4.0.0 (2006/06/28)
00016 
00017 #ifndef WM4PARAMETRICSURFACE_H
00018 #define WM4PARAMETRICSURFACE_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Surface.h"
00022 #include "Wm4Vector3.h"
00023 
00024 namespace Wm4
00025 {
00026 
00027 template <class Real>
00028 class WM4_FOUNDATION_ITEM ParametricSurface : public Surface<Real>
00029 {
00030 public:
00031     // abstract base class
00032     virtual ~ParametricSurface ();
00033 
00034     // The parametric domain is either rectangular or triangular.  Valid (u,v)
00035     // values for a rectangular domain satisfy
00036     //   umin <= u <= umax,  vmin <= v <= vmax
00037     // Valid (u,v) values for a triangular domain satisfy
00038     //   umin <= u <= umax,  vmin <= v <= vmax,
00039     //   (vmax-vmin)*(u-umin)+(umax-umin)*(v-vmax) <= 0
00040     Real GetUMin () const;
00041     Real GetUMax () const;
00042     Real GetVMin () const;
00043     Real GetVMax () const;
00044     bool IsRectangular () const;
00045 
00046     // position and derivatives up to second order
00047     virtual Vector3<Real> P (Real fU, Real fV) const = 0;
00048     virtual Vector3<Real> PU (Real fU, Real fV) const = 0;
00049     virtual Vector3<Real> PV (Real fU, Real fV) const = 0;
00050     virtual Vector3<Real> PUU (Real fU, Real fV) const = 0;
00051     virtual Vector3<Real> PUV (Real fU, Real fV) const = 0;
00052     virtual Vector3<Real> PVV (Real fU, Real fV) const = 0;
00053 
00054     // Compute a coordinate frame.  The set {T0,T1,N} is a right-handed
00055     // orthonormal set.
00056     void GetFrame (Real fU, Real fV, Vector3<Real>& rkPosition,
00057         Vector3<Real>& rkTangent0, Vector3<Real>& rkTangent1,
00058         Vector3<Real>& rkNormal) const;
00059 
00060     // Differential geometric quantities.  The returned scalars are the
00061     // principal curvatures and the returned vectors are the corresponding
00062     // principal directions.
00063     void ComputePrincipalCurvatureInfo (Real fU, Real fV, Real& rfCurv0,
00064         Real& rfCurv1, Vector3<Real>& rkDir0, Vector3<Real>& rkDir1);
00065 
00066 protected:
00067     ParametricSurface (Real fUMin, Real fUMax, Real fVMin, Real fVMax,
00068         bool bRectangular);
00069 
00070     Real m_fUMin, m_fUMax, m_fVMin, m_fVMax;
00071     bool m_bRectangular;
00072 };
00073 
00074 typedef ParametricSurface<float> ParametricSurfacef;
00075 typedef ParametricSurface<double> ParametricSurfaced;
00076 
00077 }
00078 
00079 #endif

Generated on Wed Nov 23 19:01:06 2011 for FreeCAD by  doxygen 1.6.1