Point Cloud Library (PCL)  1.9.1-dev
opennurbs_surface.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 ////////////////////////////////////////////////////////////////
18 //
19 // Definition of virtual parametric surface
20 //
21 ////////////////////////////////////////////////////////////////
22 
23 #if !defined(OPENNURBS_SURFACE_INC_)
24 #define OPENNURBS_SURFACE_INC_
25 
26 #include <pcl/pcl_exports.h>
27 
28 class ON_Curve;
29 class ON_NurbsSurface;
30 class ON_SurfaceTree;
31 
32 ////////////////////////////////////////////////////////////////
33 //
34 // Definition of virtual parametric surface
35 //
36 ////////////////////////////////////////////////////////////////
37 
38 class ON_Mesh;
39 class ON_MeshParameters;
40 class ON_PolyCurve;
41 class ON_CurveProxy;
42 class ON_Surface;
43 
44 class PCL_EXPORTS ON_CLASS ON_Surface : public ON_Geometry
45 {
46  ON_OBJECT_DECLARE(ON_Surface);
47 
48 public:
49  // virtual ON_Object::DestroyRuntimeCache override
50  void DestroyRuntimeCache( bool bDelete = true );
51 
52  // pure virtual class for surface objects
53 public:
54 
55  // flags for isoparametric curves
56  // note: odd values are all "x" = constant
57  // and even values > 0 are all "y" = constant
58  // ON_BrepTrim::m_iso uses these flags
59  enum ISO
60  {
61  not_iso = 0, // curve is not an isoparameteric curve
62  x_iso = 1, // curve is a "x" = constant (vertical) isoparametric
63  // curve in the interior of the surface's domain
64  y_iso = 2, // curve is a "y" = constant (horizontal) isoparametric
65  // curve in the interior of the surface's domain
66  W_iso = 3, // curve is a "x" = constant isoparametric curve
67  // along the west side of the surface's domain
68  S_iso = 4, // curve is a "y" = constant isoparametric curve
69  // along the south side of the surface's domain
70  E_iso = 5, // curve is a "x" = constant isoparametric curve
71  // along the east side of the surface's domain
72  N_iso = 6, // curve is a "y" = constant isoparametric curve
73  // along the north side of the surface's domain
74  iso_count = 7
75  };
76 
77 public:
78  ON_Surface();
79  ON_Surface(const ON_Surface&);
81  virtual ~ON_Surface();
82 
83  // virtual ON_Object::SizeOf override
84  unsigned int SizeOf() const;
85 
86  // virtual ON_Geometry override
87  bool EvaluatePoint( const class ON_ObjRef& objref, ON_3dPoint& P ) const;
88 
89  /*
90  Description:
91  Get a duplicate of the surface.
92  Returns:
93  A duplicate of the surface.
94  Remarks:
95  The caller must delete the returned surface.
96  For non-ON_SurfaceProxy objects, this simply duplicates the surface using
97  ON_Object::Duplicate.
98  For ON_SurfaceProxy objects, this duplicates the actual proxy surface
99  geometry and, if necessary, transposes the result to that
100  the returned surfaces's parameterization and locus match the proxy surface's.
101  */
102  virtual
103  ON_Surface* DuplicateSurface() const;
104 
105  //////////
106  // override ON_Object::ObjectType() - returns ON::surface_object
107  ON::object_type ObjectType() const;
108 
109 
110  /////////////////////////////
111  //
112  // virtual ON_Geometry functions
113  //
114 
115  /*
116  Description:
117  Overrides virtual ON_Geometry::HasBrepForm and returns true.
118  Result:
119  Returns true.
120  See Also:
121  ON_Brep::Create( ON_Surface&* )
122  */
123  ON_BOOL32 HasBrepForm() const;
124 
125  /*
126  Description:
127  Overrides virtual ON_Geometry::HasBrepForm.
128  Uses ON_Brep::Create( ON_Surface&* ) to create a brep
129  form. The surface is copied for use in the returned
130  brep.
131  Parameters:
132  brep - [in] if not NULL, brep is used to store the brep
133  form of the surface.
134  Result:
135  Returns a pointer to on ON_Brep or NULL. If the brep
136  parameter is not NULL, then brep is returned if the
137  surface has a brep form and NULL is returned if the
138  geometry does not have a brep form.
139  Remarks:
140  The caller is responsible for managing the brep memory.
141  */
142  ON_Brep* BrepForm( ON_Brep* brep = NULL ) const;
143 
144  ////////////////////////////////////////////////////////////////////
145  // surface interface
146 
147  ON_BOOL32 GetDomain(
148  int dir, // 0 gets first parameter, 1 gets second parameter
149  double* t0,
150  double* t1
151  ) const;
152 
153  bool SetDomain(
154  int dir, // 0 sets first parameter's domain, 1 gets second parameter's domain
155  ON_Interval domain
156  );
157 
158  virtual
159  ON_BOOL32 SetDomain(
160  int dir, // 0 sets first parameter's domain, 1 gets second parameter's domain
161  double t0,
162  double t1
163  );
164 
165  virtual
166  ON_Interval Domain(
167  int dir // 0 gets first parameter's domain, 1 gets second parameter's domain
168  ) const = 0;
169 
170  /*
171  Description:
172  Get an estimate of the size of the rectangle that would
173  be created if the 3d surface where flattened into a rectangle.
174  Parameters:
175  width - [out] (corresponds to the first surface parameter)
176  height - [out] (corresponds to the first surface parameter)
177  Example:
178 
179  // Reparameterize a surface to minimize distortion
180  // in the map from parameter space to 3d.
181  ON_Surface* surf = ...;
182  double width, height;
183  if ( surf->GetSurfaceSize( &width, &height ) )
184  {
185  srf->SetDomain( 0, ON_Interval( 0.0, width ) );
186  srf->SetDomain( 1, ON_Interval( 0.0, height ) );
187  }
188 
189  Returns:
190  true if successful.
191  */
192  virtual
193  ON_BOOL32 GetSurfaceSize(
194  double* width,
195  double* height
196  ) const;
197 
198 
199  virtual
200  int SpanCount(
201  int dir // 0 gets first parameter's domain, 1 gets second parameter's domain
202  ) const = 0; // number of smooth nonempty spans in the parameter direction
203 
204  virtual
205  ON_BOOL32 GetSpanVector( // span "knots"
206  int dir, // 0 gets first parameter's domain, 1 gets second parameter's domain
207  double* span_vector // array of length SpanCount() + 1
208  ) const = 0; //
209 
210  //////////
211  // If t is in the domain of the surface, GetSpanVectorIndex() returns the
212  // span vector index "i" such that span_vector[i] <= t <= span_vector[i+1].
213  // The "side" parameter determines which span is selected when t is at the
214  // end of a span.
215  virtual
216  ON_BOOL32 GetSpanVectorIndex(
217  int dir , // 0 gets first parameter's domain, 1 gets second parameter's domain
218  double t, // [IN] t = evaluation parameter
219  int side, // [IN] side 0 = default, -1 = from below, +1 = from above
220  int* span_vector_index, // [OUT] span vector index
221  ON_Interval* span_interval // [OUT] domain of the span containing "t"
222  ) const;
223 
224  virtual
225  int Degree( // returns maximum algebraic degree of any span
226  // ( or a good estimate if curve spans are not algebraic )
227  int dir // 0 gets first parameter's domain, 1 gets second parameter's domain
228  ) const = 0;
229 
230  virtual ON_BOOL32 GetParameterTolerance( // returns tminus < tplus: parameters tminus <= s <= tplus
231  int dir, // 0 gets first parameter, 1 gets second parameter
232  double t, // t = parameter in domain
233  double* tminus, // tminus
234  double* tplus // tplus
235  ) const;
236 
237  /*
238  Description:
239  Test a 2d curve to see if it is iso parameteric in the surface's
240  parameter space.
241  Parameters:
242  curve - [in] curve to test
243  curve_domain = [in] optional sub domain of the curve
244  Returns:
245  Isoparametric status of the curve.
246  Remarks:
247  Because it may transpose domains, ON_SurfaceProxy overrides
248  this function. All other surface classes just use
249  the base class implementation.
250  */
251  virtual
252  ISO IsIsoparametric(
253  const ON_Curve& curve,
254  const ON_Interval* curve_domain = NULL
255  ) const;
256 
257  /*
258  Description:
259  Test a 2d bounding box to see if it is iso parameteric in the surface's
260  parameter space.
261  Parameters:
262  bbox - [in] bounding box to test
263  Returns:
264  Isoparametric status of the bounding box.
265  Remarks:
266  Because it may transpose domains, ON_SurfaceProxy overrides
267  this function. All other surface classes just use
268  the base class implementation.
269  */
270  virtual
271  ISO IsIsoparametric(
272  const ON_BoundingBox& bbox
273  ) const;
274 
275  /*
276  Description:
277  Test a surface to see if it is planar.
278  Parameters:
279  plane - [out] if not NULL and true is returned,
280  the plane parameters are filled in.
281  tolerance - [in] tolerance to use when checking
282  Returns:
283  true if there is a plane such that the maximum distance from
284  the surface to the plane is <= tolerance.
285  */
286  virtual
287  ON_BOOL32 IsPlanar(
288  ON_Plane* plane = NULL,
289  double tolerance = ON_ZERO_TOLERANCE
290  ) const;
291 
292  /*
293  Description:
294  Determine if the surface is a portion of a sphere.
295  Parameters:
296  sphere - [out] if not NULL and true is returned,
297  then the sphere definition is returned.
298  tolerance - [in]
299  tolerance to use when checking
300  Returns:
301  True if the surface is a portion of a sphere.
302  */
303  bool IsSphere(
304  ON_Sphere* sphere = NULL,
305  double tolerance = ON_ZERO_TOLERANCE
306  ) const;
307 
308  /*
309  Description:
310  Determine if the surface is a portion of a cylinder.
311  Parameters:
312  cylinder - [out] if not NULL and true is returned,
313  then the cylinder definition is returned.
314  tolerance - [in]
315  tolerance to use when checking
316  Returns:
317  True if the surface is a portion of a cylinder.
318  */
319  bool IsCylinder(
320  ON_Cylinder* cylinder = NULL,
321  double tolerance = ON_ZERO_TOLERANCE
322  ) const;
323 
324  /*
325  Description:
326  Determine if the surface is a portion of a cone.
327  Parameters:
328  cone - [out] if not NULL and true is returned,
329  then the cone definition is returned.
330  tolerance - [in]
331  tolerance to use when checking
332  Returns:
333  True if the surface is a portion of a cone.
334  */
335  bool IsCone(
336  ON_Cone* cone = NULL,
337  double tolerance = ON_ZERO_TOLERANCE
338  ) const;
339 
340  /*
341  Description:
342  Determine if the surface is a portion of a torus.
343  Parameters:
344  torus - [out] if not NULL and true is returned,
345  then the torus definition is returned.
346  tolerance - [in]
347  tolerance to use when checking
348  Returns:
349  True if the surface is a portion of a torus.
350  */
351  bool IsTorus(
352  ON_Torus* torus = NULL,
353  double tolerance = ON_ZERO_TOLERANCE
354  ) const;
355 
356  virtual
357  ON_BOOL32 IsClosed( // true if surface is closed in direction
358  int // dir 0 = "s", 1 = "t"
359  ) const;
360 
361  virtual
362  ON_BOOL32 IsPeriodic( // true if surface is periodic in direction (default is false)
363  int // dir 0 = "s", 1 = "t"
364  ) const;
365 
366  virtual
367  ON_BOOL32 IsSingular( // true if surface side is collapsed to a point
368  int // side of parameter space to test
369  // 0 = south, 1 = east, 2 = north, 3 = west
370  ) const;
371 
372  /*
373  Returns:
374  True if the surface defines a solid, like a sphere or torus.
375  False if the surface does not define a solid, like a plane or cone.
376  */
377  bool IsSolid() const;
378 
379  /*
380  Description:
381  Test if a surface parameter value is at a singularity.
382  Parameters:
383  s - [in] surface parameter to test
384  t - [in] surface parameter to test
385  bExact - [in] if true, test if s,t is exactly at a singularity
386  if false, test if close enough to cause numerical problems.
387  Returns:
388  true if surface is singular at (s,t)
389  */
390  bool IsAtSingularity(
391  double s,
392  double t,
393  bool bExact = true
394  ) const;
395 
396  /*
397  Description:
398  Test if a surface parameter value is at a seam.
399  Parameters:
400  s - [in] surface parameter to test
401  t - [in] surface parameter to test
402  Returns:
403  0 if not a seam,
404  1 if s == Domain(0)[i] and srf(s, t) == srf(Domain(0)[1-i], t)
405  2 if t == Domain(1)[i] and srf(s, t) == srf(s, Domain(1)[1-i])
406  3 if 1 and 2 are true.
407  */
408  int IsAtSeam(
409  double s,
410  double t
411  ) const;
412 
413  /*
414  Description:
415  Search for a derivatitive, tangent, or curvature
416  discontinuity.
417  Parameters:
418  dir - [in] If 0, then "u" parameter is checked. If 1, then
419  the "v" parameter is checked.
420  c - [in] type of continity to test for.
421  t0 - [in] Search begins at t0. If there is a discontinuity
422  at t0, it will be ignored. This makes it
423  possible to repeatedly call GetNextDiscontinuity
424  and step through the discontinuities.
425  t1 - [in] (t0 != t1) If there is a discontinuity at t1 is
426  will be ingored unless c is a locus discontinuity
427  type and t1 is at the start or end of the curve.
428  t - [out] if a discontinuity is found, then *t reports the
429  parameter at the discontinuity.
430  hint - [in/out] if GetNextDiscontinuity will be called
431  repeatedly, passing a "hint" with initial value *hint=0
432  will increase the speed of the search.
433  dtype - [out] if not NULL, *dtype reports the kind of
434  discontinuity found at *t. A value of 1 means the first
435  derivative or unit tangent was discontinuous. A value
436  of 2 means the second derivative or curvature was
437  discontinuous. A value of 0 means teh curve is not
438  closed, a locus discontinuity test was applied, and
439  t1 is at the start of end of the curve.
440  cos_angle_tolerance - [in] default = cos(1 degree) Used only
441  when c is ON::G1_continuous or ON::G2_continuous. If the
442  cosine of the angle between two tangent vectors is
443  <= cos_angle_tolerance, then a G1 discontinuity is reported.
444  curvature_tolerance - [in] (default = ON_SQRT_EPSILON) Used
445  only when c is ON::G2_continuous. If K0 and K1 are
446  curvatures evaluated from above and below and
447  |K0 - K1| > curvature_tolerance, then a curvature
448  discontinuity is reported.
449  Returns:
450  Parametric continuity tests c = (C0_continuous, ..., G2_continuous):
451 
452  true if a parametric discontinuity was found strictly
453  between t0 and t1. Note well that all curves are
454  parametrically continuous at the ends of their domains.
455 
456  Locus continuity tests c = (C0_locus_continuous, ...,G2_locus_continuous):
457 
458  true if a locus discontinuity was found strictly between
459  t0 and t1 or at t1 is the at the end of a curve.
460  Note well that all open curves (IsClosed()=false) are locus
461  discontinuous at the ends of their domains. All closed
462  curves (IsClosed()=true) are at least C0_locus_continuous at
463  the ends of their domains.
464  */
465  virtual
466  bool GetNextDiscontinuity(
467  int dir,
468  ON::continuity c,
469  double t0,
470  double t1,
471  double* t,
472  int* hint=NULL,
473  int* dtype=NULL,
474  double cos_angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE_COSINE,
475  double curvature_tolerance=ON_SQRT_EPSILON
476  ) const;
477 
478  /*
479  Description:
480  Test continuity at a surface parameter value.
481  Parameters:
482  c - [in] continuity to test for
483  s - [in] surface parameter to test
484  t - [in] surface parameter to test
485  hint - [in] evaluation hint
486  point_tolerance - [in] if the distance between two points is
487  greater than point_tolerance, then the surface is not C0.
488  d1_tolerance - [in] if the difference between two first derivatives is
489  greater than d1_tolerance, then the surface is not C1.
490  d2_tolerance - [in] if the difference between two second derivatives is
491  greater than d2_tolerance, then the surface is not C2.
492  cos_angle_tolerance - [in] default = cos(1 degree) Used only when
493  c is ON::G1_continuous or ON::G2_continuous. If the cosine
494  of the angle between two normal vectors
495  is <= cos_angle_tolerance, then a G1 discontinuity is reported.
496  curvature_tolerance - [in] (default = ON_SQRT_EPSILON) Used only when
497  c is ON::G2_continuous. If K0 and K1 are curvatures evaluated
498  from above and below and |K0 - K1| > curvature_tolerance,
499  then a curvature discontinuity is reported.
500  Returns:
501  true if the surface has at least the c type continuity at the parameter t.
502  */
503  virtual
504  bool IsContinuous(
505  ON::continuity c,
506  double s,
507  double t,
508  int* hint = NULL,
509  double point_tolerance=ON_ZERO_TOLERANCE,
510  double d1_tolerance=ON_ZERO_TOLERANCE,
511  double d2_tolerance=ON_ZERO_TOLERANCE,
512  double cos_angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE_COSINE,
513  double curvature_tolerance=ON_SQRT_EPSILON
514  ) const;
515 
516  virtual
517  ON_BOOL32 Reverse( // reverse parameterizatrion, Domain changes from [a,b] to [-b,-a]
518  int // dir 0 = "s", 1 = "t"
519  ) = 0;
520 
521  virtual
522  ON_BOOL32 Transpose() = 0; // transpose surface parameterization (swap "s" and "t")
523 
524  // simple evaluation interface - no error handling
525  ON_3dPoint PointAt( double, double ) const;
526  ON_3dVector NormalAt( double, double ) const;
527  ON_BOOL32 FrameAt( double u, double v, ON_Plane& frame) const;
528 
529  ON_BOOL32 EvPoint( // returns false if unable to evaluate
530  double u, double v, // evaluation parameters
531  ON_3dPoint& point, // returns value of surface
532  int quadrant = 0, // optional - determines which side to evaluate from
533  // 0 = default
534  // 1 from NE quadrant
535  // 2 from NW quadrant
536  // 3 from SW quadrant
537  // 4 from SE quadrant
538  int* hint = 0 // optional - evaluation hint (int[2]) used to speed
539  // repeated evaluations
540  ) const;
541 
542  ON_BOOL32 Ev1Der( // returns false if unable to evaluate
543  double u, double v, // evaluation parameters (s,t)
544  ON_3dPoint& point, // returns value of surface
545  ON_3dVector& du, // first partial derivatives (Ds)
546  ON_3dVector& dv, // (Dt)
547  int quadrant = 0, // optional - determines which side to evaluate from
548  // 0 = default
549  // 1 from NE quadrant
550  // 2 from NW quadrant
551  // 3 from SW quadrant
552  // 4 from SE quadrant
553  int* hint = 0 // optional - evaluation hint (int[2]) used to speed
554  // repeated evaluations
555  ) const;
556 
557  ON_BOOL32 Ev2Der( // returns false if unable to evaluate
558  double u, double v, // evaluation parameters (s,t)
559  ON_3dPoint& point, // returns value of surface
560  ON_3dVector& du, // first partial derivatives (Ds)
561  ON_3dVector& dv, // (Dt)
562  ON_3dVector& duu, // second partial derivatives (Dss)
563  ON_3dVector& duv, // (Dst)
564  ON_3dVector& dvv, // (Dtt)
565  int quadrant= 0, // optional - determines which side to evaluate from
566  // 0 = default
567  // 1 from NE quadrant
568  // 2 from NW quadrant
569  // 3 from SW quadrant
570  // 4 from SE quadrant
571  int* hint = 0 // optional - evaluation hint (int[2]) used to speed
572  // repeated evaluations
573  ) const;
574 
575  ON_BOOL32 EvNormal( // returns false if unable to evaluate
576  double u, double v, // evaluation parameters (s,t)
577  ON_3dPoint& point, // returns value of surface
578  ON_3dVector& normal, // unit normal
579  int quadrant = 0, // optional - determines which side to evaluate from
580  // 0 = default
581  // 1 from NE quadrant
582  // 2 from NW quadrant
583  // 3 from SW quadrant
584  // 4 from SE quadrant
585  int* hint = 0 // optional - evaluation hint (int[2]) used to speed
586  // repeated evaluations
587  ) const;
588 
589  ON_BOOL32 EvNormal( // returns false if unable to evaluate
590  double u, double v, // evaluation parameters (s,t)
591  ON_3dVector& normal, // unit normal
592  int quadrant = 0, // optional - determines which side to evaluate from
593  // 0 = default
594  // 1 from NE quadrant
595  // 2 from NW quadrant
596  // 3 from SW quadrant
597  // 4 from SE quadrant
598  int* hint = 0 // optional - evaluation hint (int[2]) used to speed
599  // repeated evaluations
600  ) const;
601 
602  ON_BOOL32 EvNormal( // returns false if unable to evaluate
603  double u, double v, // evaluation parameters (s,t)
604  ON_3dPoint& point, // returns value of surface
605  ON_3dVector& du, // first partial derivatives (Ds)
606  ON_3dVector& dv, // (Dt)
607  ON_3dVector& normal, // unit normal
608  int = 0, // optional - determines which side to evaluate from
609  // 0 = default
610  // 1 from NE quadrant
611  // 2 from NW quadrant
612  // 3 from SW quadrant
613  // 4 from SE quadrant
614  int* = 0 // optional - evaluation hint (int[2]) used to speed
615  // repeated evaluations
616  ) const;
617 
618  // work horse evaluator
619  virtual
620  ON_BOOL32 Evaluate( // returns false if unable to evaluate
621  double u, double v, // evaluation parameters
622  int num_der, // number of derivatives (>=0)
623  int array_stride, // array stride (>=Dimension())
624  double* der_array, // array of length stride*(ndir+1)*(ndir+2)/2
625  int quadrant = 0, // optional - determines which quadrant to evaluate from
626  // 0 = default
627  // 1 from NE quadrant
628  // 2 from NW quadrant
629  // 3 from SW quadrant
630  // 4 from SE quadrant
631  int* hint = 0 // optional - evaluation hint (int[2]) used to speed
632  // repeated evaluations
633  ) const = 0;
634 
635  /*
636  Description:
637  Get isoparametric curve.
638  Parameters:
639  dir - [in] 0 first parameter varies and second parameter is constant
640  e.g., point on IsoCurve(0,c) at t is srf(t,c)
641  This is a horizontal line from left to right
642  1 first parameter is constant and second parameter varies
643  e.g., point on IsoCurve(1,c) at t is srf(c,t
644  This is a vertical line from bottom to top
645 
646  c - [in] value of constant parameter
647  Returns:
648  Isoparametric curve.
649  Remarks:
650  In this function "dir" indicates which direction the resulting
651  curve runs. 0: horizontal, 1: vertical
652  In the other ON_Surface functions that take a "dir"
653  argument, "dir" indicates if "c" is a "u" or "v" parameter.
654  */
655  virtual
656  ON_Curve* IsoCurve(
657  int dir,
658  double c
659  ) const;
660 
661  /*
662  Description:
663  Removes the portions of the surface outside of the specified interval.
664 
665  Parameters:
666  dir - [in] 0 The domain specifies an sub-interval of Domain(0)
667  (the first surface parameter).
668  1 The domain specifies an sub-interval of Domain(1)
669  (the second surface parameter).
670  domain - [in] interval of the surface to keep. If dir is 0, then
671  the portions of the surface with parameters (s,t) satisfying
672  s < Domain(0).Min() or s > Domain(0).Max() are trimmed away.
673  If dir is 1, then the portions of the surface with parameters
674  (s,t) satisfying t < Domain(1).Min() or t > Domain(1).Max()
675  are trimmed away.
676  */
677  virtual
678  ON_BOOL32 Trim(
679  int dir,
680  const ON_Interval& domain
681  );
682 
683  /*
684  Description:
685  Pure virtual function. Default returns false.
686  Where possible, analytically extends surface to include domain.
687  Parameters:
688  dir - [in] 0 new Domain(0) will include domain.
689  (the first surface parameter).
690  1 new Domain(1) will include domain.
691  (the second surface parameter).
692  domain - [in] if domain is not included in surface domain,
693  surface will be extended so that its domain includes domain.
694  Will not work if surface is closed in direction dir.
695  Original surface is identical to the restriction of the
696  resulting surface to the original surface domain,
697  Returns:
698  true if successful.
699  */
700  virtual
701  bool Extend(
702  int dir,
703  const ON_Interval& domain
704  );
705 
706 
707  /*
708  Description:
709  Splits (divides) the surface into two parts at the
710  specified parameter.
711 
712  Parameters:
713  dir - [in] 0 The surface is split vertically. The "west" side
714  is returned in "west_or_south_side" and the "east"
715  side is returned in "east_or_north_side".
716  1 The surface is split horizontally. The "south" side
717  is returned in "west_or_south_side" and the "north"
718  side is returned in "east_or_north_side".
719  c - [in] value of constant parameter in interval returned
720  by Domain(dir)
721  west_or_south_side - [out] west/south portion of surface returned here
722  east_or_north_side - [out] east/north portion of surface returned here
723 
724  Example:
725 
726  ON_NurbsSurface srf = ...;
727  int dir = 1;
728  ON_NurbsSurface* south_side = 0;
729  ON_NurbsSurface* north_side = 0;
730  srf.Split( dir, srf.Domain(dir).Mid() south_side, north_side );
731 
732  */
733  virtual
734  ON_BOOL32 Split(
735  int dir,
736  double c,
737  ON_Surface*& west_or_south_side,
738  ON_Surface*& east_or_north_side
739  ) const;
740 
741  /*
742  Description:
743  Get a NURBS surface representation of this surface.
744  Parameters:
745  nurbs_surface - [out] NURBS representation returned here
746  tolerance - [in] tolerance to use when creating NURBS
747  representation.
748  s_subdomain - [in] if not NULL, then the NURBS representation
749  for this portion of the surface is returned.
750  t_subdomain - [in] if not NULL, then the NURBS representation
751  for this portion of the surface is returned.
752  Returns:
753  0 unable to create NURBS representation
754  with desired accuracy.
755  1 success - returned NURBS parameterization
756  matches the surface's to wthe desired accuracy
757  2 success - returned NURBS point locus matches
758  the surface's to the desired accuracy and the
759  domain of the NURBS surface is correct. On
760  However, This surface's parameterization and
761  the NURBS surface parameterization may not
762  match to the desired accuracy. This situation
763  happens when getting NURBS representations of
764  surfaces that have a transendental parameterization
765  like spheres, cylinders, and cones.
766  Remarks:
767  This is a low-level virtual function. If you do not need
768  the parameterization information provided by the return code,
769  then ON_Surface::NurbsSurface may be easier to use.
770  See Also:
771  ON_Surface::NurbsSurface
772  */
773  virtual
774  int GetNurbForm(
775  ON_NurbsSurface& nurbs_surface,
776  double tolerance = 0.0
777  ) const;
778 
779 
780  /*
781  Description:
782  Is there a NURBS surface representation of this surface.
783  Parameters:
784  Returns:
785  0 unable to create NURBS representation
786  with desired accuracy.
787  1 success - NURBS parameterization
788  matches the surface's
789  2 success - NURBS point locus matches
790  the surface's and the
791  domain of the NURBS surface is correct.
792  However, This surface's parameterization and
793  the NURBS surface parameterization may not
794  match. This situation
795  happens when getting NURBS representations of
796  surfaces that have a transendental parameterization
797  like spheres, cylinders, and cones.
798  Remarks:
799  This is a low-level virtual function.
800  See Also:
801  ON_Surface::GetNurbForm
802  ON_Surface::NurbsSurface
803  */
804  virtual
805  int HasNurbForm() const;
806 
807  // Description:
808  // Get a NURBS surface representation of this surface.
809  // Parameters:
810  // pNurbsSurface - [in/out] if not NULL, this pNurbsSurface
811  // will be used to store the NURBS representation
812  // of the surface and will be returned.
813  // tolerance - [in] tolerance to use when creating NURBS
814  // surface representation.
815  // s_subdomain - [in] if not NULL, then the NURBS representation
816  // for this portion of the surface is returned.
817  // t_subdomain - [in] if not NULL, then the NURBS representation
818  // for this portion of the surface is returned.
819  // Returns:
820  // NULL or a NURBS representation of the surface.
821  // Remarks:
822  // See ON_Surface::GetNurbForm for important details about
823  // the NURBS surface parameterization.
824  // See Also:
825  // ON_Surface::GetNurbForm
826  ON_NurbsSurface* NurbsSurface(
827  ON_NurbsSurface* pNurbsSurface = NULL,
828  double tolerance = 0.0,
829  const ON_Interval* s_subdomain = NULL,
830  const ON_Interval* t_subdomain = NULL
831  ) const;
832 
833  virtual
834  bool GetSurfaceParameterFromNurbFormParameter(
835  double nurbs_s, double nurbs_t,
836  double* surface_s, double* surface_t
837  ) const;
838 
839  virtual
840  bool GetNurbFormParameterFromSurfaceParameter(
841  double surface_s, double surface_t,
842  double* nurbs_s, double* nurbs_t
843  ) const;
844 
845 
846  // If the geometry surface is modified in any way, then
847  // call DestroySurfaceTree().
848  void DestroySurfaceTree();
849 };
850 
851 class ON_CLASS ON_SurfaceProperties
852 {
853  // Surface properties
854 public:
855  // The constructor sets all fields to zero.
857 
858  /*
859  Parameters:
860  surface - [in]
861  If surface is not null, then it is used to set the surface properties.
862  If surface is null, then all surface properties are set to to zero.
863  Remarks:
864  Does not modify the value of m_tag.
865  */
866  void Set( const ON_Surface* surface );
867 
868  bool m_bIsSet; // True if Set() has been callled with a non-null surface.
869 
870  bool m_bHasSingularity; // true if at least one m_bSingular[] setting is true.
871  bool m_bIsSingular[4]; // m_bSingular[i] = ON_Surface::IsSingular(i)
872 
873  bool m_bHasSeam; // true if at least one m_bClosed[] setting is true.
874  bool m_bIsClosed[2]; // m_bClosed[i] = ON_Surface::IsClosed(i)
875 
876 private:
877  bool m_bReserved[7];
878 
879 public:
880  ON_Interval m_domain[2]; // m_domain[i] = ON_Surface.Domain(i)
881 
882 private:
883  unsigned char m_reserved[16];
884 
885 public:
886  // Last pointer passed to ON_SurfaceProperties::Set().
888 
889  // The constructor sets this value to zero.
890  // Nothing in opennurbs modifies or uses this value.
891  ON__INT_PTR m_tag;
892 };
893 
894 #if defined(ON_DLL_TEMPLATE)
895 // This stuff is here because of a limitation in the way Microsoft
896 // handles templates and DLLs. See Microsoft's knowledge base
897 // article ID Q168958 for details.
898 #pragma warning( push )
899 #pragma warning( disable : 4231 )
900 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_Surface*>;
901 #pragma warning( pop )
902 #endif
903 
905 {
906 public:
907  ON_SurfaceArray( int = 0 );
908  ~ON_SurfaceArray();
909 
910  ON_BOOL32 Write( ON_BinaryArchive& ) const;
911  ON_BOOL32 Read( ON_BinaryArchive& );
912 
913  void Destroy(); // deletes surfaces in array and sets count to 0
914 
915  ON_BOOL32 Duplicate( ON_SurfaceArray& ) const; // operator= copies the pointer values
916  // duplicate copies the surfaces themselves
917 };
918 
919 
920 #endif
const ON_Surface * m_surface
virtual ON_Brep * BrepForm(ON_Brep *brep=NULL) const
virtual void DestroyRuntimeCache(bool bDelete=true)
virtual bool EvaluatePoint(const class ON_ObjRef &objref, ON_3dPoint &P) const
virtual ON::object_type ObjectType() const
ON_Geometry & operator=(const ON_Geometry &)
virtual unsigned int SizeOf() const
virtual ON_BOOL32 HasBrepForm() const
#define PCL_EXPORTS
Definition: pcl_macros.h:241