~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Mod/Mesh/App/WildMagic4/Wm4ParametricSurface.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Wild Magic Source Code
 
2
// David Eberly
 
3
// http://www.geometrictools.com
 
4
// Copyright (c) 1998-2007
 
5
//
 
6
// This library is free software; you can redistribute it and/or modify it
 
7
// under the terms of the GNU Lesser General Public License as published by
 
8
// the Free Software Foundation; either version 2.1 of the License, or (at
 
9
// your option) any later version.  The license is available for reading at
 
10
// either of the locations:
 
11
//     http://www.gnu.org/copyleft/lgpl.html
 
12
//     http://www.geometrictools.com/License/WildMagicLicense.pdf
 
13
// The license applies to versions 0 through 4 of Wild Magic.
 
14
//
 
15
// Version: 4.0.0 (2006/06/28)
 
16
 
 
17
#ifndef WM4PARAMETRICSURFACE_H
 
18
#define WM4PARAMETRICSURFACE_H
 
19
 
 
20
#include "Wm4FoundationLIB.h"
 
21
#include "Wm4Surface.h"
 
22
#include "Wm4Vector3.h"
 
23
 
 
24
namespace Wm4
 
25
{
 
26
 
 
27
template <class Real>
 
28
class WM4_FOUNDATION_ITEM ParametricSurface : public Surface<Real>
 
29
{
 
30
public:
 
31
    // abstract base class
 
32
    virtual ~ParametricSurface ();
 
33
 
 
34
    // The parametric domain is either rectangular or triangular.  Valid (u,v)
 
35
    // values for a rectangular domain satisfy
 
36
    //   umin <= u <= umax,  vmin <= v <= vmax
 
37
    // Valid (u,v) values for a triangular domain satisfy
 
38
    //   umin <= u <= umax,  vmin <= v <= vmax,
 
39
    //   (vmax-vmin)*(u-umin)+(umax-umin)*(v-vmax) <= 0
 
40
    Real GetUMin () const;
 
41
    Real GetUMax () const;
 
42
    Real GetVMin () const;
 
43
    Real GetVMax () const;
 
44
    bool IsRectangular () const;
 
45
 
 
46
    // position and derivatives up to second order
 
47
    virtual Vector3<Real> P (Real fU, Real fV) const = 0;
 
48
    virtual Vector3<Real> PU (Real fU, Real fV) const = 0;
 
49
    virtual Vector3<Real> PV (Real fU, Real fV) const = 0;
 
50
    virtual Vector3<Real> PUU (Real fU, Real fV) const = 0;
 
51
    virtual Vector3<Real> PUV (Real fU, Real fV) const = 0;
 
52
    virtual Vector3<Real> PVV (Real fU, Real fV) const = 0;
 
53
 
 
54
    // Compute a coordinate frame.  The set {T0,T1,N} is a right-handed
 
55
    // orthonormal set.
 
56
    void GetFrame (Real fU, Real fV, Vector3<Real>& rkPosition,
 
57
        Vector3<Real>& rkTangent0, Vector3<Real>& rkTangent1,
 
58
        Vector3<Real>& rkNormal) const;
 
59
 
 
60
    // Differential geometric quantities.  The returned scalars are the
 
61
    // principal curvatures and the returned vectors are the corresponding
 
62
    // principal directions.
 
63
    void ComputePrincipalCurvatureInfo (Real fU, Real fV, Real& rfCurv0,
 
64
        Real& rfCurv1, Vector3<Real>& rkDir0, Vector3<Real>& rkDir1);
 
65
 
 
66
protected:
 
67
    ParametricSurface (Real fUMin, Real fUMax, Real fVMin, Real fVMax,
 
68
        bool bRectangular);
 
69
 
 
70
    Real m_fUMin, m_fUMax, m_fVMin, m_fVMax;
 
71
    bool m_bRectangular;
 
72
};
 
73
 
 
74
typedef ParametricSurface<float> ParametricSurfacef;
 
75
typedef ParametricSurface<double> ParametricSurfaced;
 
76
 
 
77
}
 
78
 
 
79
#endif