1
// Wild Magic Source Code
3
// http://www.geometrictools.com
4
// Copyright (c) 1998-2007
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.
15
// Version: 4.0.0 (2006/06/28)
17
#ifndef WM4PARAMETRICSURFACE_H
18
#define WM4PARAMETRICSURFACE_H
20
#include "Wm4FoundationLIB.h"
21
#include "Wm4Surface.h"
22
#include "Wm4Vector3.h"
28
class WM4_FOUNDATION_ITEM ParametricSurface : public Surface<Real>
31
// abstract base class
32
virtual ~ParametricSurface ();
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;
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;
54
// Compute a coordinate frame. The set {T0,T1,N} is a right-handed
56
void GetFrame (Real fU, Real fV, Vector3<Real>& rkPosition,
57
Vector3<Real>& rkTangent0, Vector3<Real>& rkTangent1,
58
Vector3<Real>& rkNormal) const;
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);
67
ParametricSurface (Real fUMin, Real fUMax, Real fVMin, Real fVMax,
70
Real m_fUMin, m_fUMax, m_fVMin, m_fVMax;
74
typedef ParametricSurface<float> ParametricSurfacef;
75
typedef ParametricSurface<double> ParametricSurfaced;