Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00015
00016
00017 #if !defined(ON_OFFSETSURFACE_INC_)
00018 #define ON_OFFSETSURFACE_INC_
00019
00020
00021
00022
00023
00024 class ON_BumpFunction
00025 {
00026 public:
00027 ON_BumpFunction();
00028
00029 bool operator==(const ON_BumpFunction& other) const;
00030 bool operator<(const ON_BumpFunction& other) const;
00031 bool operator>(const ON_BumpFunction& other) const;
00032
00033 double ValueAt(
00034 double s,
00035 double t
00036 ) const;
00037
00038 void Evaluate(
00039 double s,
00040 double t,
00041 int der_count,
00042 double* value
00043 ) const;
00044
00045 ON_2dPoint m_point;
00046 int m_type[2];
00047
00048
00049 double m_x0;
00050 double m_y0;
00051 double m_sx[2];
00052 double m_sy[2];
00053 double m_a;
00054
00055 void EvaluateHelperLinearBump(double t, double dt, int der_count, double* value) const;
00056 void EvaluateHelperQuinticBump(double t, double dt, int der_count, double* value) const;
00057 };
00058
00059
00060 class ON_OffsetSurfaceValue
00061 {
00062 public:
00063 double m_s;
00064 double m_t;
00065 double m_distance;
00066 double m_radius;
00067 int m_index;
00068 };
00069
00070
00071 #if defined(ON_DLL_TEMPLATE)
00072
00073
00074
00075 #pragma warning( push )
00076 #pragma warning( disable : 4231 )
00077 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_BumpFunction>;
00078 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_OffsetSurfaceValue>;
00079 #pragma warning( pop )
00080 #endif
00081
00082
00083 class ON_CLASS ON_OffsetSurfaceFunction
00084 {
00085 public:
00086 ON_OffsetSurfaceFunction();
00087 ~ON_OffsetSurfaceFunction();
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 bool SetBaseSurface(
00100 const ON_Surface* srf
00101 );
00102
00103
00104
00105
00106
00107 const ON_Surface* BaseSurface() const;
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 bool SetSideTangency(
00127 int side,
00128 bool bEnable
00129 );
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 bool SideTangency(int side) const;
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 bool SetOffsetPoint(
00155 double s,
00156 double t,
00157 double distance,
00158 double radius = 0.0
00159 );
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 bool SetPoint(
00170 int index,
00171 double s,
00172 double t
00173 );
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 bool SetDistance(
00184 int index,
00185 double distance);
00186
00187
00188
00189
00190
00191
00192 int OffsetPointCount() const;
00193
00194
00195
00196
00197
00198
00199
00200 ON_2dPoint OffsetSurfaceParameter(int i) const;
00201
00202
00203
00204
00205
00206
00207
00208 double OffsetDistance(int i) const;
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 double DistanceAt(
00220 double s,
00221 double t
00222 ) const;
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237 bool EvaluateDistance(
00238 double s,
00239 double t,
00240 int num_der,
00241 double* value
00242 ) const;
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 ON_3dPoint PointAt(
00254 double s,
00255 double t
00256 ) const;
00257
00258
00259
00260
00261
00262 void Destroy();
00263
00264 private:
00265 friend class ON_OffsetSurface;
00266 bool Initialize();
00267
00268 const ON_Surface* m_srf;
00269
00270 ON_Interval m_domain[2];
00271
00272 bool m_bZeroSideDerivative[4];
00273
00274 ON_SimpleArray<ON_OffsetSurfaceValue> m_offset_value;
00275
00276
00277 ON_SimpleArray<class ON_BumpFunction> m_bumps;
00278
00279 bool m_bValid;
00280 };
00281
00282 class ON_CLASS ON_OffsetSurface : public ON_SurfaceProxy
00283 {
00284
00285
00286
00287
00288
00289
00290
00291
00292 ON_OBJECT_DECLARE(ON_OffsetSurface);
00293 public:
00294 ON_OffsetSurface();
00295 ~ON_OffsetSurface();
00296 ON_OffsetSurface( const ON_OffsetSurface& src);
00297 ON_OffsetSurface& operator=(const ON_OffsetSurface& src);
00298
00299 ON_BOOL32 GetBBox(
00300 double* bbox_min,
00301 double* bbox_max,
00302 int bGrowBox = false
00303 ) const;
00304
00305 ON_BOOL32 Evaluate(
00306 double, double,
00307 int,
00308 int,
00309 double*,
00310 int = 0,
00311
00312
00313
00314
00315
00316 int* = 0
00317
00318 ) const;
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 bool SetBaseSurface(
00332 const ON_Surface* base_surface
00333 );
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 bool SetBaseSurface(
00350 ON_Surface* base_surface,
00351 bool bManage
00352 );
00353
00354
00355
00356
00357
00358 const ON_Surface* BaseSurface() const;
00359
00360 ON_OffsetSurfaceFunction& OffsetFunction();
00361 const ON_OffsetSurfaceFunction& OffsetFunction() const;
00362
00363 private:
00364
00365 ON_Surface* m__pSrf;
00366 ON_OffsetSurfaceFunction m_offset_function;
00367 };
00368
00369
00370 #endif