Wm4ImplicitSurface.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 WM4IMPLICITSURFACE_H
00018 #define WM4IMPLICITSURFACE_H
00019 
00020 #include "Wm4FoundationLIB.h"
00021 #include "Wm4Matrix3.h"
00022 #include "Wm4Surface.h"
00023 
00024 namespace Wm4
00025 {
00026 
00027 template <class Real>
00028 class WM4_FOUNDATION_ITEM ImplicitSurface : public Surface<Real>
00029 {
00030 public:
00031     // Surface is defined by F(x,y,z) = 0.  In all member functions it is
00032     // the application's responsibility to ensure that (x,y,z) is a solution
00033     // to F = 0.
00034 
00035     // abstract base class
00036     virtual ~ImplicitSurface ();
00037 
00038     // the function
00039     virtual Real F (const Vector3<Real>& rkP) const = 0;
00040 
00041     // first-order partial derivatives
00042     virtual Real FX (const Vector3<Real>& rkP) const = 0;
00043     virtual Real FY (const Vector3<Real>& rkP) const = 0;
00044     virtual Real FZ (const Vector3<Real>& rkP) const = 0;
00045 
00046     // second-order partial derivatives
00047     virtual Real FXX (const Vector3<Real>& rkP) const = 0;
00048     virtual Real FXY (const Vector3<Real>& rkP) const = 0;
00049     virtual Real FXZ (const Vector3<Real>& rkP) const = 0;
00050     virtual Real FYY (const Vector3<Real>& rkP) const = 0;
00051     virtual Real FYZ (const Vector3<Real>& rkP) const = 0;
00052     virtual Real FZZ (const Vector3<Real>& rkP) const = 0;
00053 
00054     // verify point is on surface (within the tolerance specified by epsilon)
00055     bool IsOnSurface (const Vector3<Real>& rkP, Real fEpsilon) const;
00056 
00057     // first-order derivatives
00058     Vector3<Real> GetGradient (const Vector3<Real>& rkP) const;
00059 
00060     // second-order derivatives
00061     Matrix3<Real> GetHessian (const Vector3<Real>& rkP) const;
00062 
00063     // Compute a coordinate frame.  The set {T0,T1,N} is a right-handed
00064     // orthonormal set.
00065     void GetFrame (const Vector3<Real>& rkP, Vector3<Real>& rkTangent0,
00066         Vector3<Real>& rkTangent1, Vector3<Real>& rkNormal) const;
00067 
00068     // Differential geometric quantities.  The returned scalars are the
00069     // principal curvatures and the returned vectors are the corresponding
00070     // principal directions.
00071     bool ComputePrincipalCurvatureInfo (const Vector3<Real>& rkP,
00072         Real& rfCurv0, Real& rfCurv1, Vector3<Real>& rkDir0,
00073         Vector3<Real>& rkDir1);
00074 
00075 protected:
00076     ImplicitSurface ();
00077 };
00078 
00079 typedef ImplicitSurface<float> ImplicitSurfacef;
00080 typedef ImplicitSurface<double> ImplicitSurfaced;
00081 
00082 }
00083 
00084 #endif

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