GteParametricSurface.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <Mathematics/GteVector.h>
11 
12 namespace gte
13 {
14 
15 template <int N, typename Real>
17 {
18 protected:
19  // Abstract base class for a parameterized surface X(u,v). The parametric
20  // domain is either rectangular or triangular. Valid (u,v) values for a
21  // rectangular domain satisfy
22  // umin <= u <= umax, vmin <= v <= vmax
23  // and valid (u,v) values for a triangular domain satisfy
24  // umin <= u <= umax, vmin <= v <= vmax,
25  // (vmax-vmin)*(u-umin)+(umax-umin)*(v-vmax) <= 0
26  ParametricSurface(Real umin, Real umax, Real vmin, Real vmax,
27  bool rectangular);
28 public:
29  virtual ~ParametricSurface();
30 
31  // To validate construction, create an object as shown:
32  // DerivedClassSurface<Real> surface(parameters);
33  // if (!surface) { <constructor failed, handle accordingly>; }
34  inline operator bool() const;
35 
36  // Member access.
37  inline Real GetUMin() const;
38  inline Real GetUMax() const;
39  inline Real GetVMin() const;
40  inline Real GetVMax() const;
41  inline bool IsRectangular() const;
42 
43  // Evaluation of the surface. The function supports derivative
44  // calculation through order 2; that is, maxOrder <= 2 is required. If
45  // you want only the position, pass in maxOrder of 0. If you want the
46  // position and first-order derivatives, pass in maxOrder of 1, and so on.
47  // The output 'values' are ordered as: position X; first-order derivatives
48  // dX/du, dX/dv; second-order derivatives d2X/du2, d2X/dudv, d2X/dv2.
49  virtual void Evaluate(Real u, Real v, unsigned int maxOrder,
50  Vector<N, Real> values[6]) const = 0;
51 
52  // Differential geometric quantities.
53  Vector<N, Real> GetPosition(Real u, Real v) const;
54  Vector<N, Real> GetUTangent(Real u, Real v) const;
55  Vector<N, Real> GetVTangent(Real u, Real v) const;
56 
57 protected:
61 };
62 
63 
64 template <int N, typename Real>
66  Real vmin, Real vmax, bool rectangular)
67  :
68  mUMin(umin),
69  mUMax(umax),
70  mVMin(vmin),
71  mVMax(vmax),
72  mRectangular(rectangular)
73 {
74 }
75 
76 template <int N, typename Real>
78 {
79 }
80 
81 template <int N, typename Real>
83 {
84  return mConstructed;
85 }
86 
87 template <int N, typename Real> inline
89 {
90  return mUMin;
91 }
92 
93 template <int N, typename Real> inline
95 {
96  return mUMax;
97 }
98 
99 template <int N, typename Real> inline
101 {
102  return mVMin;
103 }
104 
105 template <int N, typename Real> inline
107 {
108  return mVMax;
109 }
110 
111 template <int N, typename Real> inline
113 {
114  return mRectangular;
115 }
116 
117 template <int N, typename Real> inline
119 {
121  Evaluate(u, v, 0, values);
122  return values[0];
123 }
124 
125 template <int N, typename Real> inline
127 {
129  Evaluate(u, v, 1, values);
130  Normalize(values[1]);
131  return values[1];
132 }
133 
134 template <int N, typename Real> inline
136 {
138  Evaluate(u, v, 1, values);
139  Normalize(values[2]);
140  return values[2];
141 }
142 
143 
144 }
virtual void Evaluate(Real u, Real v, unsigned int maxOrder, Vector< N, Real > values[6]) const =0
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1597
Vector< N, Real > GetUTangent(Real u, Real v) const
ParametricSurface(Real umin, Real umax, Real vmin, Real vmax, bool rectangular)
Vector< N, Real > GetPosition(Real u, Real v) const
Real Normalize(GVector< Real > &v, bool robust=false)
Definition: GteGVector.h:454
const GLdouble * v
Definition: glcorearb.h:832
Vector< N, Real > GetVTangent(Real u, Real v) const


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:01