opennurbs_surface.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00018 //
00019 //   Definition of virtual parametric surface
00020 //
00022 
00023 #if !defined(OPENNURBS_SURFACE_INC_)
00024 #define OPENNURBS_SURFACE_INC_
00025 
00026 #include <pcl/pcl_exports.h>
00027 
00028 class ON_Curve;
00029 class ON_NurbsSurface;
00030 class ON_SurfaceTree;
00031 
00033 //
00034 //   Definition of virtual parametric surface
00035 //
00037 
00038 class ON_Mesh;
00039 class ON_MeshParameters;
00040 class ON_PolyCurve;
00041 class ON_CurveProxy;
00042 class ON_Surface;
00043 
00044 class PCL_EXPORTS ON_CLASS ON_Surface : public ON_Geometry
00045 {
00046   ON_OBJECT_DECLARE(ON_Surface);
00047 
00048 public:
00049   // virtual ON_Object::DestroyRuntimeCache override
00050   void DestroyRuntimeCache( bool bDelete = true );
00051 
00052   // pure virtual class for surface objects
00053 public:
00054 
00055   // flags for isoparametric curves
00056   // note: odd values are all "x" = constant
00057   // and even values > 0 are all "y" = constant
00058   // ON_BrepTrim::m_iso uses these flags
00059   enum ISO 
00060   {
00061     not_iso = 0, // curve is not an isoparameteric curve
00062     x_iso   = 1, // curve is a "x" = constant (vertical) isoparametric
00063                  // curve in the interior of the surface's domain
00064     y_iso   = 2, // curve is a "y" = constant (horizontal) isoparametric
00065                  // curve in the interior of the surface's domain
00066     W_iso   = 3, // curve is a "x" = constant isoparametric curve
00067                  // along the west side of the surface's domain
00068     S_iso   = 4, // curve is a "y" = constant isoparametric curve
00069                  // along the south side of the surface's domain
00070     E_iso   = 5, // curve is a "x" = constant isoparametric curve
00071                  // along the east side of the surface's domain
00072     N_iso   = 6, // curve is a "y" = constant isoparametric curve
00073                  // along the north side of the surface's domain
00074     iso_count = 7
00075   };
00076 
00077 public:
00078   ON_Surface();
00079   ON_Surface(const ON_Surface&);
00080   ON_Surface& operator=(const ON_Surface&);
00081   virtual ~ON_Surface();
00082 
00083   // virtual ON_Object::SizeOf override
00084   unsigned int SizeOf() const;
00085 
00086   // virtual ON_Geometry override
00087   bool EvaluatePoint( const class ON_ObjRef& objref, ON_3dPoint& P ) const;
00088 
00089   /*
00090   Description:
00091     Get a duplicate of the surface.
00092   Returns:
00093     A duplicate of the surface.  
00094   Remarks:
00095     The caller must delete the returned surface.
00096     For non-ON_SurfaceProxy objects, this simply duplicates the surface using
00097     ON_Object::Duplicate.
00098     For ON_SurfaceProxy objects, this duplicates the actual proxy surface 
00099     geometry and, if necessary, transposes the result to that
00100     the returned surfaces's parameterization and locus match the proxy surface's.
00101   */
00102   virtual
00103   ON_Surface* DuplicateSurface() const;
00104 
00106   // override ON_Object::ObjectType() - returns ON::surface_object
00107   ON::object_type ObjectType() const;
00108 
00109 
00111   //
00112   // virtual ON_Geometry functions
00113   //
00114 
00115   /*
00116   Description:
00117     Overrides virtual ON_Geometry::HasBrepForm and returns true.
00118   Result:
00119     Returns true.
00120   See Also:
00121     ON_Brep::Create( ON_Surface&* )
00122   */
00123   ON_BOOL32 HasBrepForm() const;
00124 
00125   /*
00126   Description:
00127     Overrides virtual ON_Geometry::HasBrepForm.  
00128     Uses ON_Brep::Create( ON_Surface&* ) to create a brep
00129     form.  The surface is copied for use in the returned
00130     brep.
00131   Parameters:
00132     brep - [in] if not NULL, brep is used to store the brep
00133         form of the surface.
00134   Result:
00135     Returns a pointer to on ON_Brep or NULL.  If the brep
00136     parameter is not NULL, then brep is returned if the
00137     surface has a brep form and NULL is returned if the
00138     geometry does not have a brep form.
00139   Remarks:
00140     The caller is responsible for managing the brep memory.
00141   */
00142   ON_Brep* BrepForm( ON_Brep* brep = NULL ) const;
00143 
00145   // surface interface
00146 
00147   ON_BOOL32 GetDomain( 
00148          int dir,              // 0 gets first parameter, 1 gets second parameter
00149          double* t0,
00150          double* t1
00151          ) const;
00152 
00153   bool SetDomain( 
00154     int dir, // 0 sets first parameter's domain, 1 gets second parameter's domain
00155     ON_Interval domain
00156     );
00157 
00158   virtual
00159   ON_BOOL32 SetDomain( 
00160     int dir, // 0 sets first parameter's domain, 1 gets second parameter's domain
00161     double t0, 
00162     double t1
00163     );
00164 
00165   virtual
00166   ON_Interval Domain(
00167     int dir // 0 gets first parameter's domain, 1 gets second parameter's domain
00168     ) const = 0;
00169 
00170   /*
00171   Description:
00172     Get an estimate of the size of the rectangle that would
00173     be created if the 3d surface where flattened into a rectangle.
00174   Parameters:
00175     width - [out]  (corresponds to the first surface parameter)
00176     height - [out] (corresponds to the first surface parameter)
00177   Example:
00178 
00179           // Reparameterize a surface to minimize distortion 
00180           // in the map from parameter space to 3d.
00181           ON_Surface* surf = ...;
00182           double width, height;
00183           if ( surf->GetSurfaceSize( &width, &height ) )
00184           {
00185             srf->SetDomain( 0, ON_Interval( 0.0, width ) );
00186             srf->SetDomain( 1, ON_Interval( 0.0, height ) );
00187           }
00188 
00189   Returns:
00190     true if successful.
00191   */
00192   virtual
00193   ON_BOOL32 GetSurfaceSize( 
00194       double* width, 
00195       double* height 
00196       ) const;
00197 
00198 
00199   virtual 
00200   int SpanCount(
00201     int dir // 0 gets first parameter's domain, 1 gets second parameter's domain
00202     ) const = 0; // number of smooth nonempty spans in the parameter direction
00203 
00204   virtual
00205   ON_BOOL32 GetSpanVector( // span "knots" 
00206         int dir, // 0 gets first parameter's domain, 1 gets second parameter's domain
00207         double* span_vector // array of length SpanCount() + 1 
00208         ) const = 0; // 
00209 
00211   // If t is in the domain of the surface, GetSpanVectorIndex() returns the 
00212   // span vector index "i" such that span_vector[i] <= t <= span_vector[i+1].
00213   // The "side" parameter determines which span is selected when t is at the
00214   // end of a span.
00215   virtual
00216   ON_BOOL32 GetSpanVectorIndex(
00217         int dir , // 0 gets first parameter's domain, 1 gets second parameter's domain
00218         double t,      // [IN] t = evaluation parameter
00219         int side,         // [IN] side 0 = default, -1 = from below, +1 = from above
00220         int* span_vector_index,        // [OUT] span vector index
00221         ON_Interval* span_interval // [OUT] domain of the span containing "t"
00222         ) const;
00223 
00224   virtual 
00225   int Degree( // returns maximum algebraic degree of any span 
00226                   // ( or a good estimate if curve spans are not algebraic )
00227     int dir // 0 gets first parameter's domain, 1 gets second parameter's domain
00228     ) const = 0; 
00229 
00230   virtual ON_BOOL32 GetParameterTolerance( // returns tminus < tplus: parameters tminus <= s <= tplus
00231          int dir,        // 0 gets first parameter, 1 gets second parameter
00232          double t,       // t = parameter in domain
00233          double* tminus, // tminus
00234          double* tplus   // tplus
00235          ) const;
00236 
00237   /*
00238   Description:
00239     Test a 2d curve to see if it is iso parameteric in the surface's
00240     parameter space.
00241   Parameters:
00242     curve - [in] curve to test
00243     curve_domain = [in] optional sub domain of the curve
00244   Returns:
00245     Isoparametric status of the curve.
00246   Remarks:
00247     Because it may transpose domains, ON_SurfaceProxy overrides
00248     this function.  All other surface classes just use
00249     the base class implementation.
00250   */
00251   virtual
00252   ISO IsIsoparametric(
00253         const ON_Curve& curve,
00254         const ON_Interval* curve_domain = NULL
00255         ) const;
00256 
00257   /*
00258   Description:
00259     Test a 2d bounding box to see if it is iso parameteric in the surface's
00260     parameter space.
00261   Parameters:
00262     bbox - [in] bounding box to test
00263   Returns:
00264     Isoparametric status of the bounding box.
00265   Remarks:
00266     Because it may transpose domains, ON_SurfaceProxy overrides
00267     this function.  All other surface classes just use
00268     the base class implementation.
00269   */
00270   virtual
00271   ISO IsIsoparametric(
00272         const ON_BoundingBox& bbox
00273         ) const;
00274 
00275   /*
00276   Description:
00277     Test a surface to see if it is planar.
00278   Parameters:
00279     plane - [out] if not NULL and true is returned,
00280                   the plane parameters are filled in.
00281     tolerance - [in] tolerance to use when checking
00282   Returns:
00283     true if there is a plane such that the maximum distance from
00284     the surface to the plane is <= tolerance.
00285   */
00286   virtual
00287   ON_BOOL32 IsPlanar(
00288         ON_Plane* plane = NULL,
00289         double tolerance = ON_ZERO_TOLERANCE
00290         ) const;
00291 
00292   /*
00293   Description:
00294     Determine if the surface is a portion of a sphere.
00295   Parameters:
00296     sphere - [out] if not NULL and true is returned,
00297       then the sphere definition is returned.
00298     tolerance - [in]
00299       tolerance to use when checking
00300   Returns:
00301     True if the surface is a portion of a sphere.                   
00302   */
00303   bool IsSphere(
00304         ON_Sphere* sphere = NULL,
00305         double tolerance = ON_ZERO_TOLERANCE
00306         ) const;
00307 
00308   /*
00309   Description:
00310     Determine if the surface is a portion of a cylinder.
00311   Parameters:
00312     cylinder - [out] if not NULL and true is returned, 
00313       then the cylinder definition is returned.
00314     tolerance - [in]
00315       tolerance to use when checking
00316   Returns:
00317     True if the surface is a portion of a cylinder.                   
00318   */
00319   bool IsCylinder(
00320         ON_Cylinder* cylinder = NULL,
00321         double tolerance = ON_ZERO_TOLERANCE
00322         ) const;
00323 
00324   /*
00325   Description:
00326     Determine if the surface is a portion of a cone.
00327   Parameters:
00328     cone - [out] if not NULL and true is returned, 
00329       then the cone definition is returned.
00330     tolerance - [in]
00331       tolerance to use when checking
00332   Returns:
00333     True if the surface is a portion of a cone.                   
00334   */
00335   bool IsCone(
00336         ON_Cone* cone = NULL,
00337         double tolerance = ON_ZERO_TOLERANCE
00338         ) const;
00339 
00340   /*
00341   Description:
00342     Determine if the surface is a portion of a torus.
00343   Parameters:
00344     torus - [out] if not NULL and true is returned,
00345       then the torus definition is returned.
00346     tolerance - [in]
00347       tolerance to use when checking
00348   Returns:
00349     True if the surface is a portion of a torus.                   
00350   */
00351   bool IsTorus(
00352         ON_Torus* torus = NULL,
00353         double tolerance = ON_ZERO_TOLERANCE
00354         ) const;
00355 
00356   virtual 
00357   ON_BOOL32 IsClosed(   // true if surface is closed in direction
00358         int        // dir  0 = "s", 1 = "t"
00359         ) const;
00360 
00361   virtual 
00362   ON_BOOL32 IsPeriodic( // true if surface is periodic in direction (default is false)
00363         int        // dir  0 = "s", 1 = "t"
00364         ) const;
00365 
00366   virtual
00367   ON_BOOL32 IsSingular( // true if surface side is collapsed to a point
00368         int        // side of parameter space to test
00369                    // 0 = south, 1 = east, 2 = north, 3 = west
00370         ) const;
00371 
00372   /*
00373   Returns:
00374     True if the surface defines a solid, like a sphere or torus.
00375     False if the surface does not define a solid, like a plane or cone.
00376   */
00377   bool IsSolid() const;
00378 
00379   /*
00380   Description:
00381     Test if a surface parameter value is at a singularity.
00382   Parameters:
00383     s - [in] surface parameter to test
00384     t - [in] surface parameter to test
00385     bExact - [in] if true, test if s,t is exactly at a singularity
00386       if false, test if close enough to cause numerical problems.
00387   Returns:
00388     true if surface is singular at (s,t)
00389   */
00390   bool IsAtSingularity(
00391     double s, 
00392     double t, 
00393     bool bExact = true
00394     ) const;
00395 
00396   /*
00397   Description:
00398     Test if a surface parameter value is at a seam.
00399   Parameters:
00400     s - [in] surface parameter to test
00401     t - [in] surface parameter to test
00402   Returns:
00403     0 if not a seam,
00404     1 if s == Domain(0)[i] and srf(s, t) == srf(Domain(0)[1-i], t)
00405     2 if t == Domain(1)[i] and srf(s, t) == srf(s, Domain(1)[1-i])
00406     3 if 1 and 2 are true.
00407   */
00408   int IsAtSeam(
00409     double s,
00410     double t
00411     ) const;
00412   
00413   /*
00414   Description:
00415     Search for a derivatitive, tangent, or curvature 
00416     discontinuity.
00417   Parameters:
00418     dir - [in] If 0, then "u" parameter is checked.  If 1, then
00419                the "v" parameter is checked.
00420     c - [in] type of continity to test for.
00421     t0 - [in] Search begins at t0. If there is a discontinuity
00422               at t0, it will be ignored.  This makes it 
00423               possible to repeatedly call GetNextDiscontinuity
00424               and step through the discontinuities.
00425     t1 - [in] (t0 != t1)  If there is a discontinuity at t1 is 
00426               will be ingored unless c is a locus discontinuity
00427               type and t1 is at the start or end of the curve.
00428     t - [out] if a discontinuity is found, then *t reports the
00429           parameter at the discontinuity.
00430     hint - [in/out] if GetNextDiscontinuity will be called 
00431        repeatedly, passing a "hint" with initial value *hint=0
00432        will increase the speed of the search.       
00433     dtype - [out] if not NULL, *dtype reports the kind of 
00434         discontinuity found at *t.  A value of 1 means the first 
00435         derivative or unit tangent was discontinuous.  A value 
00436         of 2 means the second derivative or curvature was 
00437         discontinuous.  A value of 0 means teh curve is not
00438         closed, a locus discontinuity test was applied, and
00439         t1 is at the start of end of the curve.
00440     cos_angle_tolerance - [in] default = cos(1 degree) Used only
00441         when c is ON::G1_continuous or ON::G2_continuous.  If the
00442         cosine of the angle between two tangent vectors is 
00443         <= cos_angle_tolerance, then a G1 discontinuity is reported.
00444     curvature_tolerance - [in] (default = ON_SQRT_EPSILON) Used 
00445         only when c is ON::G2_continuous.  If K0 and K1 are 
00446         curvatures evaluated from above and below and 
00447         |K0 - K1| > curvature_tolerance, then a curvature 
00448         discontinuity is reported.
00449   Returns:
00450     Parametric continuity tests c = (C0_continuous, ..., G2_continuous):
00451 
00452       true if a parametric discontinuity was found strictly 
00453       between t0 and t1. Note well that all curves are 
00454       parametrically continuous at the ends of their domains.
00455 
00456     Locus continuity tests c = (C0_locus_continuous, ...,G2_locus_continuous):
00457 
00458       true if a locus discontinuity was found strictly between
00459       t0 and t1 or at t1 is the at the end of a curve.
00460       Note well that all open curves (IsClosed()=false) are locus
00461       discontinuous at the ends of their domains.  All closed 
00462       curves (IsClosed()=true) are at least C0_locus_continuous at 
00463       the ends of their domains.
00464   */
00465   virtual
00466   bool GetNextDiscontinuity( 
00467                   int dir,
00468                   ON::continuity c,
00469                   double t0,
00470                   double t1,
00471                   double* t,
00472                   int* hint=NULL,
00473                   int* dtype=NULL,
00474                   double cos_angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE_COSINE,
00475                   double curvature_tolerance=ON_SQRT_EPSILON
00476                   ) const;
00477 
00478   /*
00479   Description:
00480     Test continuity at a surface parameter value.
00481   Parameters:
00482     c - [in] continuity to test for
00483     s - [in] surface parameter to test
00484     t - [in] surface parameter to test
00485     hint - [in] evaluation hint
00486     point_tolerance - [in] if the distance between two points is
00487         greater than point_tolerance, then the surface is not C0.
00488     d1_tolerance - [in] if the difference between two first derivatives is
00489         greater than d1_tolerance, then the surface is not C1.
00490     d2_tolerance - [in] if the difference between two second derivatives is
00491         greater than d2_tolerance, then the surface is not C2.
00492     cos_angle_tolerance - [in] default = cos(1 degree) Used only when
00493         c is ON::G1_continuous or ON::G2_continuous.  If the cosine
00494         of the angle between two normal vectors 
00495         is <= cos_angle_tolerance, then a G1 discontinuity is reported.
00496     curvature_tolerance - [in] (default = ON_SQRT_EPSILON) Used only when
00497         c is ON::G2_continuous.  If K0 and K1 are curvatures evaluated
00498         from above and below and |K0 - K1| > curvature_tolerance,
00499         then a curvature discontinuity is reported.
00500   Returns:
00501     true if the surface has at least the c type continuity at the parameter t.
00502   */
00503   virtual
00504   bool IsContinuous(
00505     ON::continuity c,
00506     double s, 
00507     double t, 
00508     int* hint = NULL,
00509     double point_tolerance=ON_ZERO_TOLERANCE,
00510     double d1_tolerance=ON_ZERO_TOLERANCE,
00511     double d2_tolerance=ON_ZERO_TOLERANCE,
00512     double cos_angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE_COSINE,
00513     double curvature_tolerance=ON_SQRT_EPSILON
00514     ) const;
00515 
00516   virtual 
00517   ON_BOOL32 Reverse(  // reverse parameterizatrion, Domain changes from [a,b] to [-b,-a]
00518     int // dir  0 = "s", 1 = "t"
00519     ) = 0;
00520 
00521   virtual 
00522   ON_BOOL32 Transpose() = 0; // transpose surface parameterization (swap "s" and "t")
00523 
00524   // simple evaluation interface - no error handling
00525   ON_3dPoint  PointAt( double, double ) const;
00526   ON_3dVector NormalAt( double, double ) const;
00527   ON_BOOL32 FrameAt( double u, double v, ON_Plane& frame) const;
00528 
00529   ON_BOOL32 EvPoint( // returns false if unable to evaluate
00530          double u, double v,   // evaluation parameters
00531          ON_3dPoint& point,    // returns value of surface
00532          int quadrant = 0,     // optional - determines which side to evaluate from
00533                                //         0 = default
00534                                //         1 from NE quadrant
00535                                //         2 from NW quadrant
00536                                //         3 from SW quadrant
00537                                //         4 from SE quadrant
00538          int* hint = 0         // optional - evaluation hint (int[2]) used to speed
00539                                //            repeated evaluations
00540          ) const;
00541 
00542   ON_BOOL32 Ev1Der( // returns false if unable to evaluate
00543          double u, double v,   // evaluation parameters (s,t)
00544          ON_3dPoint& point,    // returns value of surface
00545          ON_3dVector& du,      // first partial derivatives (Ds)
00546          ON_3dVector& dv,      // (Dt)
00547          int quadrant = 0,     // optional - determines which side to evaluate from
00548                                //         0 = default
00549                                //         1 from NE quadrant
00550                                //         2 from NW quadrant
00551                                //         3 from SW quadrant
00552                                //         4 from SE quadrant
00553          int* hint = 0         // optional - evaluation hint (int[2]) used to speed
00554                                //            repeated evaluations
00555          ) const;
00556 
00557   ON_BOOL32 Ev2Der( // returns false if unable to evaluate
00558          double u, double v,   // evaluation parameters (s,t)
00559          ON_3dPoint& point,    // returns value of surface
00560          ON_3dVector& du,      // first partial derivatives (Ds)
00561          ON_3dVector& dv,      // (Dt)
00562          ON_3dVector& duu,     // second partial derivatives (Dss)
00563          ON_3dVector& duv,     // (Dst)
00564          ON_3dVector& dvv,     // (Dtt)
00565          int quadrant= 0,      // optional - determines which side to evaluate from
00566                                //         0 = default
00567                                //         1 from NE quadrant
00568                                //         2 from NW quadrant
00569                                //         3 from SW quadrant
00570                                //         4 from SE quadrant
00571          int* hint = 0         // optional - evaluation hint (int[2]) used to speed
00572                                //            repeated evaluations
00573          ) const;
00574 
00575   ON_BOOL32 EvNormal( // returns false if unable to evaluate
00576          double u, double v,   // evaluation parameters (s,t)
00577          ON_3dPoint& point,    // returns value of surface
00578          ON_3dVector& normal,  // unit normal
00579          int quadrant = 0,     // optional - determines which side to evaluate from
00580                                //         0 = default
00581                                //         1 from NE quadrant
00582                                //         2 from NW quadrant
00583                                //         3 from SW quadrant
00584                                //         4 from SE quadrant
00585          int* hint = 0         // optional - evaluation hint (int[2]) used to speed
00586                                //            repeated evaluations
00587          ) const;
00588 
00589   ON_BOOL32 EvNormal( // returns false if unable to evaluate
00590          double u, double v,   // evaluation parameters (s,t)
00591          ON_3dVector& normal,  // unit normal
00592          int quadrant = 0,     // optional - determines which side to evaluate from
00593                                //         0 = default
00594                                //         1 from NE quadrant
00595                                //         2 from NW quadrant
00596                                //         3 from SW quadrant
00597                                //         4 from SE quadrant
00598          int* hint = 0         // optional - evaluation hint (int[2]) used to speed
00599                                //            repeated evaluations
00600          ) const;
00601 
00602   ON_BOOL32 EvNormal( // returns false if unable to evaluate
00603          double u, double v,   // evaluation parameters (s,t)
00604          ON_3dPoint& point,    // returns value of surface
00605          ON_3dVector& du,      // first partial derivatives (Ds)
00606          ON_3dVector& dv,      // (Dt)
00607          ON_3dVector& normal,  // unit normal
00608          int = 0,              // optional - determines which side to evaluate from
00609                                //         0 = default
00610                                //         1 from NE quadrant
00611                                //         2 from NW quadrant
00612                                //         3 from SW quadrant
00613                                //         4 from SE quadrant
00614          int* = 0              // optional - evaluation hint (int[2]) used to speed
00615                                //            repeated evaluations
00616          ) const;
00617 
00618   // work horse evaluator
00619   virtual 
00620   ON_BOOL32 Evaluate( // returns false if unable to evaluate
00621          double u, double v,   // evaluation parameters
00622          int num_der,          // number of derivatives (>=0)
00623          int array_stride,     // array stride (>=Dimension())
00624          double* der_array,    // array of length stride*(ndir+1)*(ndir+2)/2
00625          int quadrant = 0,     // optional - determines which quadrant to evaluate from
00626                                //         0 = default
00627                                //         1 from NE quadrant
00628                                //         2 from NW quadrant
00629                                //         3 from SW quadrant
00630                                //         4 from SE quadrant
00631          int* hint = 0         // optional - evaluation hint (int[2]) used to speed
00632                                //            repeated evaluations
00633          ) const = 0;
00634 
00635   /*
00636   Description:
00637     Get isoparametric curve.
00638   Parameters:
00639     dir - [in] 0 first parameter varies and second parameter is constant
00640                  e.g., point on IsoCurve(0,c) at t is srf(t,c)
00641                  This is a horizontal line from left to right
00642                1 first parameter is constant and second parameter varies
00643                  e.g., point on IsoCurve(1,c) at t is srf(c,t
00644                  This is a vertical line from bottom to top
00645 
00646     c - [in] value of constant parameter 
00647   Returns:
00648     Isoparametric curve.
00649   Remarks:
00650     In this function "dir" indicates which direction the resulting
00651     curve runs.  0: horizontal, 1: vertical
00652     In the other ON_Surface functions that take a "dir"
00653     argument, "dir" indicates if "c" is a "u" or "v" parameter.
00654   */
00655   virtual
00656   ON_Curve* IsoCurve(
00657          int dir,
00658          double c
00659          ) const;
00660 
00661   /*
00662   Description:
00663     Removes the portions of the surface outside of the specified interval.
00664 
00665   Parameters:
00666     dir - [in] 0  The domain specifies an sub-interval of Domain(0)
00667                   (the first surface parameter).
00668                1  The domain specifies an sub-interval of Domain(1)
00669                   (the second surface parameter).
00670     domain - [in] interval of the surface to keep. If dir is 0, then
00671         the portions of the surface with parameters (s,t) satisfying
00672         s < Domain(0).Min() or s > Domain(0).Max() are trimmed away.
00673         If dir is 1, then the portions of the surface with parameters
00674         (s,t) satisfying t < Domain(1).Min() or t > Domain(1).Max() 
00675         are trimmed away.
00676   */
00677   virtual
00678   ON_BOOL32 Trim(
00679          int dir,
00680          const ON_Interval& domain
00681          );
00682 
00683   /*
00684    Description:
00685      Pure virtual function. Default returns false.
00686      Where possible, analytically extends surface to include domain.
00687    Parameters:
00688      dir - [in] 0  new Domain(0) will include domain.
00689                    (the first surface parameter).
00690                 1  new Domain(1) will include domain.
00691                    (the second surface parameter).
00692      domain - [in] if domain is not included in surface domain, 
00693      surface will be extended so that its domain includes domain.  
00694      Will not work if surface is closed in direction dir. 
00695      Original surface is identical to the restriction of the
00696      resulting surface to the original surface domain, 
00697    Returns:
00698      true if successful.
00699      */
00700   virtual
00701   bool Extend(
00702     int dir,
00703     const ON_Interval& domain
00704     );
00705 
00706 
00707   /*
00708   Description:
00709     Splits (divides) the surface into two parts at the 
00710     specified parameter.
00711 
00712   Parameters:
00713     dir - [in] 0  The surface is split vertically.  The "west" side
00714                   is returned in "west_or_south_side" and the "east"
00715                   side is returned in "east_or_north_side".
00716                1  The surface is split horizontally.  The "south" side
00717                   is returned in "west_or_south_side" and the "north"
00718                   side is returned in "east_or_north_side".
00719     c - [in] value of constant parameter in interval returned
00720                by Domain(dir)
00721     west_or_south_side - [out] west/south portion of surface returned here
00722     east_or_north_side - [out] east/north portion of surface returned here
00723 
00724   Example:
00725 
00726           ON_NurbsSurface srf = ...;
00727           int dir = 1;
00728           ON_NurbsSurface* south_side = 0;
00729           ON_NurbsSurface* north_side = 0;
00730           srf.Split( dir, srf.Domain(dir).Mid() south_side, north_side );
00731 
00732   */
00733   virtual
00734   ON_BOOL32 Split(
00735          int dir,
00736          double c,
00737          ON_Surface*& west_or_south_side,
00738          ON_Surface*& east_or_north_side
00739          ) const;
00740 
00741   /*
00742   Description:
00743     Get a NURBS surface representation of this surface.
00744   Parameters:
00745     nurbs_surface - [out] NURBS representation returned here
00746     tolerance - [in] tolerance to use when creating NURBS
00747         representation.
00748     s_subdomain - [in] if not NULL, then the NURBS representation
00749         for this portion of the surface is returned.
00750     t_subdomain - [in] if not NULL, then the NURBS representation
00751         for this portion of the surface is returned.
00752   Returns:
00753     0   unable to create NURBS representation
00754         with desired accuracy.
00755     1   success - returned NURBS parameterization
00756         matches the surface's to wthe desired accuracy
00757     2   success - returned NURBS point locus matches
00758         the surface's to the desired accuracy and the
00759         domain of the NURBS surface is correct.  On
00760         However, This surface's parameterization and
00761         the NURBS surface parameterization may not 
00762         match to the desired accuracy.  This situation
00763         happens when getting NURBS representations of
00764         surfaces that have a transendental parameterization
00765         like spheres, cylinders, and cones.
00766   Remarks:
00767     This is a low-level virtual function.  If you do not need
00768     the parameterization information provided by the return code,
00769     then ON_Surface::NurbsSurface may be easier to use.
00770   See Also:
00771     ON_Surface::NurbsSurface
00772   */
00773   virtual
00774   int GetNurbForm(
00775         ON_NurbsSurface& nurbs_surface,
00776         double tolerance = 0.0
00777         ) const;
00778 
00779 
00780   /*
00781   Description:
00782     Is there a NURBS surface representation of this surface.
00783   Parameters:
00784   Returns:
00785     0   unable to create NURBS representation
00786         with desired accuracy.
00787     1   success - NURBS parameterization
00788         matches the surface's
00789     2   success - NURBS point locus matches
00790         the surface's and the
00791         domain of the NURBS surface is correct.  
00792         However, This surface's parameterization and
00793         the NURBS surface parameterization may not 
00794         match.  This situation
00795         happens when getting NURBS representations of
00796         surfaces that have a transendental parameterization
00797         like spheres, cylinders, and cones.
00798   Remarks:
00799     This is a low-level virtual function. 
00800   See Also:
00801     ON_Surface::GetNurbForm
00802     ON_Surface::NurbsSurface
00803   */
00804   virtual
00805   int HasNurbForm() const;
00806 
00807   // Description:
00808   //   Get a NURBS surface representation of this surface.
00809   // Parameters:
00810   //   pNurbsSurface - [in/out] if not NULL, this pNurbsSurface
00811   //   will be used to store the NURBS representation
00812   //   of the surface and will be returned.
00813   //   tolerance - [in] tolerance to use when creating NURBS
00814   //       surface representation.
00815   //   s_subdomain - [in] if not NULL, then the NURBS representation
00816   //       for this portion of the surface is returned.
00817   //   t_subdomain - [in] if not NULL, then the NURBS representation
00818   //       for this portion of the surface is returned.
00819   // Returns:
00820   //   NULL or a NURBS representation of the surface.
00821   // Remarks:
00822   //   See ON_Surface::GetNurbForm for important details about
00823   //   the NURBS surface parameterization.
00824   // See Also:
00825   //   ON_Surface::GetNurbForm
00826   ON_NurbsSurface* NurbsSurface(
00827         ON_NurbsSurface* pNurbsSurface = NULL,
00828         double tolerance = 0.0,
00829         const ON_Interval* s_subdomain = NULL,
00830         const ON_Interval* t_subdomain = NULL
00831         ) const;
00832 
00833   virtual
00834   bool GetSurfaceParameterFromNurbFormParameter(
00835         double nurbs_s, double nurbs_t,
00836         double* surface_s, double* surface_t
00837         ) const;
00838 
00839   virtual
00840   bool GetNurbFormParameterFromSurfaceParameter(
00841         double surface_s, double surface_t,
00842         double* nurbs_s,  double* nurbs_t
00843         ) const;
00844 
00845 
00846   // If the geometry surface is modified in any way, then
00847   // call DestroySurfaceTree().
00848   void DestroySurfaceTree();
00849 };
00850 
00851 class ON_CLASS ON_SurfaceProperties
00852 {
00853   // Surface properties
00854 public:
00855   // The constructor sets all fields to zero.
00856   ON_SurfaceProperties();
00857 
00858   /*
00859   Parameters:
00860     surface - [in]
00861       If surface is not null, then it is used to set the surface properties.
00862       If surface is null, then all surface properties are set to to zero.
00863   Remarks:
00864     Does not modify the value of m_tag.
00865   */
00866   void Set( const ON_Surface* surface );
00867 
00868   bool m_bIsSet;           // True if Set() has been callled with a non-null surface.
00869 
00870   bool m_bHasSingularity;  // true if at least one m_bSingular[] setting is true.
00871   bool m_bIsSingular[4];   // m_bSingular[i] = ON_Surface::IsSingular(i)
00872 
00873   bool m_bHasSeam;         // true if at least one m_bClosed[] setting is true.
00874   bool m_bIsClosed[2];     // m_bClosed[i] = ON_Surface::IsClosed(i)
00875 
00876 private:
00877   bool m_bReserved[7];
00878 
00879 public:
00880   ON_Interval m_domain[2]; // m_domain[i] = ON_Surface.Domain(i)
00881 
00882 private:
00883   unsigned char m_reserved[16];
00884 
00885 public:
00886   // Last pointer passed to ON_SurfaceProperties::Set().
00887   const ON_Surface* m_surface;
00888 
00889   // The constructor sets this value to zero.
00890   // Nothing in opennurbs modifies or uses this value.
00891   ON__INT_PTR m_tag;
00892 };
00893 
00894 #if defined(ON_DLL_TEMPLATE)
00895 // This stuff is here because of a limitation in the way Microsoft
00896 // handles templates and DLLs.  See Microsoft's knowledge base 
00897 // article ID Q168958 for details.
00898 #pragma warning( push )
00899 #pragma warning( disable : 4231 )
00900 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_Surface*>;
00901 #pragma warning( pop )
00902 #endif
00903 
00904 class ON_CLASS ON_SurfaceArray : public ON_SimpleArray<ON_Surface*>
00905 {
00906 public:
00907   ON_SurfaceArray( int = 0 );
00908   ~ON_SurfaceArray();
00909 
00910   ON_BOOL32 Write( ON_BinaryArchive& ) const;
00911   ON_BOOL32 Read( ON_BinaryArchive& );
00912 
00913   void Destroy(); // deletes surfaces in array and sets count to 0
00914 
00915   ON_BOOL32 Duplicate( ON_SurfaceArray& ) const; // operator= copies the pointer values
00916                                      // duplicate copies the surfaces themselves
00917 };
00918 
00919 
00920 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:03