opennurbs_beam.h
Go to the documentation of this file.
00001 #if !defined(OPENNURBS_EXTRUSION_INC_)
00002 #define OPENNURBS_EXTRUSION_INC_
00003 
00004 /*
00005 Description:
00006   Get the transformation that maps the ON_Extrusion 
00007   2d xy profile to 3d world space.
00008 Parameters:
00009   P - [in] start or end of path
00010   T - [in] unit tanget to path
00011   U - [in] unit up vector perpendicular to T
00012   Normal - [in] optional unit vector with Normal->z > 0 that
00013      defines the unit normal to the miter plane.
00014   xform - [out]
00015     transformation that maps the profile curve to 3d world space
00016   scale2d - [out]
00017     If not NULL, this is the scale part of the transformation.
00018     If there is no mitering, then this is the identity.
00019   rot2d - [out]
00020     If not null, this is the part of the transformation
00021     that rotates the xy plane into its 3d world location.
00022 Returns:
00023   true if successful.
00024 */
00025 ON_DECL
00026 bool ON_GetEndCapTransformation(
00027           ON_3dPoint P, 
00028           ON_3dVector T, 
00029           ON_3dVector U, 
00030           const ON_3dVector* Normal,
00031           ON_Xform& xform, // = rot3d*scale2d
00032           ON_Xform* scale2d,
00033           ON_Xform* rot2d
00034           );
00035 
00036 class ON_CLASS ON_Extrusion : public ON_Surface
00037 {
00038   ON_OBJECT_DECLARE(ON_Extrusion);
00039 public:
00040   ON_Extrusion();
00041   ON_Extrusion(const ON_Extrusion& src);
00042   ~ON_Extrusion();
00043 
00044   ON_Extrusion& operator=(const ON_Extrusion&);
00045 
00047   //
00048   // overrides of virtual ON_Object functions
00049   // 
00050   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00051   void Dump( ON_TextLog& ) const;
00052   unsigned int SizeOf() const;
00053   ON__UINT32 DataCRC( ON__UINT32 current_remainder ) const;
00054   ON_BOOL32 Write( ON_BinaryArchive& binary_archive) const;
00055   ON_BOOL32 Read( ON_BinaryArchive& binary_archive );
00056   ON::object_type ObjectType() const;
00057 
00059   //
00060   // overrides of virtual ON_Geometry functions
00061   // 
00062   int Dimension() const;
00063   ON_BOOL32 GetBBox(
00064         double* boxmin,
00065         double* boxmax,
00066         int bGrowBox = false
00067         ) const;
00068         bool GetTightBoundingBox( 
00069         ON_BoundingBox& tight_bbox, 
00070         int bGrowBox = false,
00071         const ON_Xform* xform = 0
00072         ) const;
00073   ON_BOOL32 Transform( 
00074         const ON_Xform& xform
00075         );
00076 
00077   /*
00078   Description:
00079     Build a brep form of the extrusion.  The outer profile is always 
00080     the first face in the brep.  If there are inner profiles, 
00081     additional brep faces are created for each profile.  If the
00082     outer profile is closed, then end caps are added as the last
00083     two faces in the brep.
00084   Parameters:
00085     brep - [in]
00086       If the brep pointer is not null, then the brep form is constructed
00087       in brep.  If the brep pointer is null, then an ON_Brep is allocated
00088       on the heap.
00089   Returns:
00090     If successful, a pointer to the brep form.  If unsuccessful, null.
00091   */
00092   ON_Brep* BrepForm(
00093         ON_Brep* brep = NULL 
00094         ) const;
00095 
00096   /*
00097   Description:
00098     Build a brep form of the extrusion.  The outer profile is always 
00099     the first face in the brep.  If there are inner profiles, 
00100     additional brep faces are created for each profile.  If the
00101     outer profile is closed, then end caps are added as the last
00102     two faces in the brep.
00103   Parameters:
00104     brep - [in]
00105       If the brep pointer is not null, then the brep form is constructed
00106       in brep.  If the brep pointer is null, then an ON_Brep is allocated
00107       on the heap.
00108     bSmoothFaces - [in]
00109       If true and the profiles have kinks, then the faces corresponding
00110       to those profiles are split so they will be G1.
00111   Returns:
00112     If successful, a pointer to the brep form.  If unsuccessful, null.
00113   */
00114   ON_Brep* BrepForm(
00115     ON_Brep* brep,
00116     bool bSmoothFaces 
00117     ) const;
00118 
00119   /*
00120   Description:
00121     Build a sum surface form of the extrusion.
00122   Parameters:
00123     sum_surface - [in]
00124       If the sum_surface pointer is not null, then the sum surface 
00125       form is constructed in sum_surface.  If the sum_surface pointer 
00126       is null, then an ON_SumSurface is allocated on the heap.
00127   Returns:
00128     If successful, a pointer to the sum surface form.
00129     If unsuccessful, null. In particular, extrusions with
00130     mitered ends do not have sum surface forms.
00131   */
00132   ON_SumSurface* SumSurfaceForm( 
00133     ON_SumSurface* sum_surface 
00134     ) const;
00135 
00136   /*
00137   Description:
00138     Convert a component index that identifies a part of this extrusion
00139     to a component index that identifies a part of the brep created
00140     by BrepForm(...,false).
00141   Parameters:
00142     extrusion_ci - [in]
00143     extrusion_profile_parameter - [in]
00144     brep_form - [in]
00145       brep created by ON_Extrusion::BrepForm()
00146     brep_ci - [out]
00147   Returns:
00148     True if successful.  False if input is not valid, in which case brep_ci
00149     is set by calling ON_COMPONENT_INDEX::UnSet().
00150   Remarks:
00151     If the wall surfaces have creases, then this function cannot
00152     be used to identify brep components created by BrepForm(...,true).
00153   */
00154   bool GetBrepFormComponentIndex(
00155     ON_COMPONENT_INDEX extrusion_ci,
00156     ON_COMPONENT_INDEX& brep_ci
00157     ) const;
00158 
00159   bool GetBrepFormComponentIndex(
00160     ON_COMPONENT_INDEX extrusion_ci,
00161     double extrusion_profile_parameter,
00162     const ON_Brep& brep_form,
00163     ON_COMPONENT_INDEX& brep_ci
00164     ) const;
00165 
00167   //
00168   // overrides of virtual ON_Surface functions
00169   // 
00170   ON_BOOL32 SetDomain( 
00171         int dir,
00172         double t0, 
00173         double t1
00174         );
00175   ON_Interval Domain(
00176         int dir
00177         ) const;
00178   ON_BOOL32 GetSurfaceSize( 
00179         double* width, 
00180         double* height 
00181         ) const;
00182   int SpanCount(
00183         int dir
00184         ) const;
00185   ON_BOOL32 GetSpanVector(
00186         int dir,
00187         double* span_vector
00188         ) const;
00189   ON_BOOL32 GetSpanVectorIndex(
00190         int dir,
00191         double t,
00192         int side,
00193         int* span_vector_index,
00194         ON_Interval* span_interval
00195         ) const;
00196   int Degree(
00197         int dir
00198         ) const; 
00199   ON_BOOL32 GetParameterTolerance(
00200          int dir,
00201          double t,
00202          double* tminus,
00203          double* tplus
00204          ) const;
00205   ISO IsIsoparametric(
00206         const ON_Curve& curve,
00207         const ON_Interval* curve_domain = NULL
00208         ) const;
00209   ON_BOOL32 IsPlanar(
00210         ON_Plane* plane = NULL,
00211         double tolerance = ON_ZERO_TOLERANCE
00212         ) const;
00213   ON_BOOL32 IsClosed(
00214         int
00215         ) const;
00216   ON_BOOL32 IsPeriodic(
00217         int
00218         ) const;
00219   bool GetNextDiscontinuity( 
00220                   int dir,
00221                   ON::continuity c,
00222                   double t0,
00223                   double t1,
00224                   double* t,
00225                   int* hint=NULL,
00226                   int* dtype=NULL,
00227                   double cos_angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE_COSINE,
00228                   double curvature_tolerance=ON_SQRT_EPSILON
00229                   ) const;
00230   bool IsContinuous(
00231     ON::continuity c,
00232     double s, 
00233     double t, 
00234     int* hint = NULL,
00235     double point_tolerance=ON_ZERO_TOLERANCE,
00236     double d1_tolerance=ON_ZERO_TOLERANCE,
00237     double d2_tolerance=ON_ZERO_TOLERANCE,
00238     double cos_angle_tolerance=ON_DEFAULT_ANGLE_TOLERANCE_COSINE,
00239     double curvature_tolerance=ON_SQRT_EPSILON
00240     ) const;
00241   ISO IsIsoparametric(
00242         const ON_BoundingBox& bbox
00243         ) const;
00244   ON_BOOL32 Reverse( int dir );
00245   ON_BOOL32 Transpose();
00246   ON_BOOL32 Evaluate(
00247          double u, double v,
00248          int num_der,
00249          int array_stride,
00250          double* der_array,
00251          int quadrant = 0,
00252          int* hint = 0
00253          ) const;
00254   ON_Curve* IsoCurve(
00255          int dir,
00256          double c
00257          ) const;
00258 
00259   ON_BOOL32 Trim(
00260          int dir,
00261          const ON_Interval& domain
00262          );
00263   bool Extend(
00264     int dir,
00265     const ON_Interval& domain
00266     );
00267   ON_BOOL32 Split(
00268          int dir,
00269          double c,
00270          ON_Surface*& west_or_south_side,
00271          ON_Surface*& east_or_north_side
00272          ) const;
00273 
00274   bool GetClosestPoint( 
00275           const ON_3dPoint& P,
00276           double* s,
00277           double* t,
00278           double maximum_distance = 0.0,
00279           const ON_Interval* sdomain = 0,
00280           const ON_Interval* tdomain = 0
00281           ) const;
00282 
00283   ON_BOOL32 GetLocalClosestPoint( const ON_3dPoint&, // test_point
00284           double,double,     // seed_parameters
00285           double*,double*,   // parameters of local closest point returned here
00286           const ON_Interval* = NULL, // first parameter sub_domain
00287           const ON_Interval* = NULL  // second parameter sub_domain
00288           ) const;
00289 
00290   //ON_Surface* Offset(
00291   //      double offset_distance, 
00292   //      double tolerance, 
00293   //      double* max_deviation = NULL
00294   //      ) const;
00295 
00296   int GetNurbForm(
00297         ON_NurbsSurface& nurbs_surface,
00298         double tolerance = 0.0
00299         ) const;
00300   int HasNurbForm() const;
00301   bool GetSurfaceParameterFromNurbFormParameter(
00302         double nurbs_s, double nurbs_t,
00303         double* surface_s, double* surface_t
00304         ) const;
00305   bool GetNurbFormParameterFromSurfaceParameter(
00306         double surface_s, double surface_t,
00307         double* nurbs_s,  double* nurbs_t
00308         ) const;
00309 
00311   //
00312   // ON_Extrusion interface
00313   // 
00314   void Destroy();
00315 
00316   /*
00317   Description:
00318     Sets m_path to (A,B), m_path_domain to [0,Length(AB)],
00319     and m_t to [0,1].
00320   Parameters:
00321     A - [in] path start
00322     B - [in] path end
00323   Returns:
00324     true  A and B are valid, the distance from A to B is larger
00325           than ON_ZERO_TOLERANCE, and the path was set.
00326     false A or B is not valid or the distance from A to B is
00327           at most ON_ZERO_TOLERANCE. In this case nothing is set.
00328   Remark:
00329     You must also set the up direction to be perpendicular to the path.
00330   */
00331   bool SetPath(ON_3dPoint A, ON_3dPoint B);
00332 
00333   /*
00334   Description:
00335     Sets m_path to (A,B), m_path_domain to [0,Length(AB)],
00336     m_t to [0,1], and m_up.
00337   Parameters:
00338     A - [in] path start
00339     B - [in] path end
00340     up - [in] up direction
00341       If up is a unit vector and perpendicular to the line 
00342       segment from A to B, then m_up is set to up.
00343       Otherwise up will be adjusted so it is perpendicular
00344       to the line segment from A to B and unitized.
00345   Returns:
00346     true  A and B are valid, the distance from A to B is larger
00347           than ON_ZERO_TOLERANCE, and the path was set.
00348     false A or B is not valid, or the distance from A to B is
00349           at most ON_ZERO_TOLERANCE, or up is invalid, or up
00350           is zero, or up is parallel to the line segment.
00351           In this case nothing is set.
00352   */
00353   bool SetPathAndUp(ON_3dPoint A, ON_3dPoint B, ON_3dVector up );
00354 
00355   /*
00356   Description:
00357     Get the surface parameter for the path.
00358   Returns:
00359     0: The first surface parameter corresponds to the path direction.
00360        (m_bTransposed = true)
00361     1: The second surface parameter corresponds to the path direction.
00362        (m_bTransposed = false)
00363   Remarks:
00364     The default ON_Extrusion constructor sets 
00365     m_bTransposed = false which corresponds to the 1 = PathParameter().
00366   */
00367   int PathParameter() const;
00368 
00369   ON_3dPoint PathStart() const;
00370   ON_3dPoint PathEnd() const;
00371   ON_3dVector PathTangent() const;
00372 
00373   /*
00374   Description:
00375     Set miter plane normal.
00376   Parameters:
00377     N - [in] If ON_UNSET_VECTOR or N is parallel to the z-axis,
00378              then the miter plane is the default plane 
00379              perpendicular to the path.
00380              If N is valid and the z coordinate of a unitized
00381              N is greater than m_Nz_tol, then the miter plane 
00382              normal is set.
00383     end - [in] 0 = set miter plane at the start of the path.
00384                1 = set miter plane at the end of the path.
00385   */
00386   bool SetMiterPlaneNormal(ON_3dVector N, int end);
00387 
00388   void GetMiterPlaneNormal(int end, ON_3dVector& N) const;
00389 
00390   /*
00391   Returns:
00392     0: not mitered.
00393     1: start of path is mitered.
00394     2: end of path is mitered.
00395     3: start and end are mitered.
00396   */
00397   int IsMitered() const;
00398 
00399   /*
00400   Returns:
00401     True if extrusion object is a capped solid.
00402   */
00403   bool IsSolid() const;
00404 
00405   /*
00406   Returns:
00407     0: no or profile is open
00408     1: bottom cap
00409     2: top cap
00410     3: both ends capped.
00411   */
00412   int IsCapped() const;
00413 
00414   /*
00415   Returns:
00416     0: no caps
00417     1: exrusion has either a top cap or a bottom cap
00418     2: both ends are capped.
00419   See Also:
00420     ON_Extrusion::ProfileCount()
00421     ON_Extrusion::ProfileSmoothSegmentCount()
00422   */
00423   int CapCount() const;
00424 
00425   /*
00426   Description:
00427     Deprecated function.
00428 
00429     Use CapCount() to determine how many end caps there are.
00430     Use ProfileCount() to determine how many profiles there are.
00431     Use ProfileSmoothSegmentCount() to determine how many 
00432     smooth subsegments are in a profile. Each smooth subsegment
00433     becomes a wall face in the brep form.
00434 
00435   Returns:
00436     Number of "faces" the extrusion has.
00437     0: extrusion is not valid
00438     1: extrusion is not capped
00439     2: extrusion has a closed outer profile and one cap
00440     3: extrusion has a closed outer profile and two caps
00441 
00442   Remarks:
00443     This function was written before extrusions supported "holes"
00444     and before the brep form was divided at profile creases.
00445     At this point it simply leads to confusion. See the Description
00446     function replacements.
00447   */
00448   ON_DEPRECATED int FaceCount() const;
00449 
00450   /*
00451   Description:
00452     Get the transformation that maps the xy profile curve
00453     to its 3d location.
00454   Parameters:
00455     s - [in] 0.0 = starting profile
00456              1.0 = ending profile
00457   */
00458   bool GetProfileTransformation( double s, ON_Xform& xform ) const;
00459 
00460   /*
00461   Description:
00462     Get the the 3d plane containing the profile curve at a
00463     normalized path parameter.
00464   Parameters:
00465     s - [in] 0.0 = starting plane
00466              1.0 = ending plane
00467     plane - [out]
00468       Plane containing profile is returned in plane.  If
00469       false is returned, then the input value of plane
00470       is not changed.
00471   Returns:
00472     true if plane was set.  False if this is invalid and plane
00473     could not be set.
00474   Remarks:
00475     When no mitering is happening, GetPathPlane() and
00476     GetProfilePlane() return the same plane.
00477   */
00478   bool GetProfilePlane( double s, ON_Plane& plane ) const;
00479 
00480 
00481   /*
00482   Description:
00483     Get the the 3d plane perpendicular to the path at a
00484     normalized path parameter.
00485   Parameters:
00486     s - [in] 0.0 = starting plane
00487              1.0 = ending plane
00488     plane - [out]
00489       Plane is returned here.  If
00490       false is returned, then the input value of plane
00491       is not changed.
00492   Returns:
00493     true if plane was set.  False if this is invalid and plane
00494     could not be set.
00495   Remarks:
00496     When no mitering is happening, GetPathPlane() and
00497     GetProfilePlane() return the same plane.
00498   */
00499   bool GetPathPlane( double s, ON_Plane& plane ) const;
00500 
00501   /*
00502   Description:
00503     Set the outer profile of the extrusion.
00504   Paramters:
00505     outer_profile - [in] 
00506       curve in the xy plane or a 2d curve.
00507     bCap - [in]
00508       If outer_profile is a closed curve, then bCap
00509       determines if the extrusion has end caps.
00510       If outer_profile is an open curve, bCap is ignored.
00511   Returns:
00512     True if the profile was set. In this case the ON_Extrusion class
00513     manages the curve and ~ON_Extrusion will delete it.  If the outer
00514     profile is closed, then the extrusion may also have inner profiles.
00515     If the outer profile is open, the extrusion may not have inner
00516     profiles. If the extrusion already has a profile, the set will
00517     fail.
00518   Remarks:
00519     If needed, outer_profile will be converted to a 2d
00520     curve. If outer_curve is closed but not correctly oriented,
00521     it will reversed so it has a counter-clockwise orientation.
00522   */
00523   bool SetOuterProfile( ON_Curve* outer_profile, bool bCap );
00524 
00525   /*
00526   Description:
00527     Add an inner profile.
00528   Paramters:
00529     inner_profile - [in]
00530       closed curve in the xy plane or a 2d curve.
00531   Returns:
00532     True if the profile was set. In this case the 
00533     ON_Extrusion class  manages the curve and ~ON_Extrusion will 
00534     delete it. The extrusion must already have an outer profile.
00535     If the extrusion already has a profile, the set will
00536     fail.
00537   Remarks:
00538     If needed, innter_profile will be converted to a 2d
00539     curve. If inner_profile is not correctly oriented, it
00540     will be reversed so it has a clockwise orientation.
00541   */
00542   bool AddInnerProfile( ON_Curve* inner_profile );
00543 
00544   /*
00545   Returns:
00546     Number of profile curves.
00547   See Also:
00548     ON_Extrusion::CapCount()
00549     ON_Extrusion::ProfileSmoothSegmentCount()
00550   */
00551   int ProfileCount() const;
00552 
00553   /*
00554   Parameter:
00555     profile_index - [in]
00556       0 <= profile_index < ProfileCount().
00557       The outer profile has index 0.
00558   Returns:
00559     Number of smooth segments in the profile curve.
00560   See Also:
00561     ON_Extrusion::CapCount()
00562     ON_Extrusion::GetProfileKinkParameters()
00563     ON_Extrusion::ProfileCount()
00564   */
00565   int ProfileSmoothSegmentCount( int profile_index ) const;
00566 
00567   /*
00568   Description:
00569     Get the surface parameter for the profile.
00570   Returns:
00571     0: The first surface parameter corresponds to the profile direction.
00572        (m_bTransposed = false)
00573     1: The second surface parameter corresponds to the profile direction.
00574        (m_bTransposed = true)
00575   Remarks:
00576     The default ON_Extrusion constructor sets 
00577     m_bTransposed = false which corresponds to the 0 = ProfileParameter().
00578   */
00579   int ProfileParameter() const;
00580 
00581   /*
00582   Paramters:
00583     profile_index - [in]
00584       0 <= profile_index < ProfileCount().
00585       The outer profile has index 0.
00586   Returns:
00587     Pointer to the i-th 2d profile.  The ON_Extrusion
00588     class manages this curve.  Do not delete it
00589     and do not use the pointer if the ON_Extrusion
00590     class changes.
00591   */
00592   const ON_Curve* Profile(int profile_index) const;
00593 
00594   /*
00595   Paramters:
00596     profile_index - [in]
00597       0 <= profile_index < ProfileCount().
00598       The outer profile has index 0.
00599     s - [in] ( 0.0 <= s <= 1.0 )
00600       A relative parameter controling which priofile
00601       is returned. s = 0.0 returns the bottom profile
00602       and s = 1.0 returns the top profile.
00603   Returns:
00604     NULL if the input parameters or the ON_Extrusion class is
00605     not valid.  Otherwise a pointer to a 3d curve for 
00606     the requested profile. This curve is on the heap and
00607     the caller is responsible for deleting this curve.
00608   */
00609   ON_Curve* Profile3d(int profile_index, double s ) const;
00610 
00611   /*
00612   Paramters:
00613     ci - [in]
00614       component index identifying a 3d extrusion profile curve.
00615   Returns:
00616     NULL if the component index or the ON_Extrusion class is
00617     not valid.  Otherwise a pointer to a 3d curve for 
00618     the requested profile. This curve is on the heap and
00619     the caller is responsible for deleting this curve.
00620   */
00621   ON_Curve* Profile3d( ON_COMPONENT_INDEX ci ) const;
00622 
00623   /*
00624   Paramters:
00625     ci - [in]
00626       component index identifying a wall edge curve.
00627   Returns:
00628     NULL if the component index or the ON_Extrusion class is
00629     not valid.  Otherwise a pointer to a 3d curve for 
00630     the requested wall edge. This curve is on the heap and
00631     the caller is responsible for deleting this curve.
00632   */
00633   ON_Curve* WallEdge( ON_COMPONENT_INDEX ci ) const;
00634 
00635   /*
00636   Paramters:
00637     ci - [in]
00638       component index identifying a wall surface.
00639   Returns:
00640     NULL if the component index or the ON_Extrusion class is
00641     not valid.  Otherwise a pointer to a surface for 
00642     the requested wall surface. This curve is on the heap and
00643     the caller is responsible for deleting this curve.
00644   */
00645   ON_Surface* WallSurface( ON_COMPONENT_INDEX ci ) const;
00646 
00647   /*
00648   Paramters:
00649     line_curve - [in]
00650       If null, a line curve will be allocated using new.
00651   Returns:
00652     Null if the extrusion path is not valid.  Otherwise
00653     a pointer to an ON_LineCurve that is set to the 
00654     extrusion's path. The caller must delete this curve.
00655   */
00656   ON_LineCurve* PathLineCurve(ON_LineCurve* line_curve) const;
00657 
00658   /*
00659   Paramters:
00660     profile_parameter - [in]
00661       parameter on profile curve
00662   Returns:
00663       -1: if the profile_parameter does not correspond 
00664           to a point on the profile curve.
00665     >= 0: index of the profile curve with domain containing
00666           this paramter.  When the profile_parameter corresponds
00667           to the end of one profile and the beginning of the next
00668           profile, the index of the next profile is returned.
00669   */
00670   int ProfileIndex( double profile_parameter ) const;
00671 
00672 
00673   /*
00674   Returns:
00675     If m_profile_count >= 2 and m_profile is an ON_PolyCurve
00676     with m_profile_count segments defining outer and inner
00677     profiles, a pointer to the polycurve is returned.
00678     Otherwise null is returned.
00679   */
00680   const ON_PolyCurve* PolyProfile() const;
00681 
00682   /*
00683   Description:
00684     Get a list of the 2d profile curves.
00685   Returns:
00686     Number of curves appended to the list.
00687   */
00688   int GetProfileCurves( ON_SimpleArray<const ON_Curve*>& profile_curves ) const;
00689 
00690 
00691   /*
00692   Description:
00693     Get the parameters where a profile curve has kinks.
00694   Parameters:
00695     profile_index - [in]
00696     profile_kink_parameters - [out]
00697       parameters at internal kinks are appended to this array.
00698   Returns:
00699     Number of parameters appended to profile_kink_parameters[]
00700   Remarks:
00701     This function is used when making the brep form that has
00702     smooth faces.
00703   */
00704   int GetProfileKinkParameters( int profile_index, ON_SimpleArray<double>& profile_kink_parameters ) const;
00705 
00706   /*
00707   Parameters:
00708     profile_index - [in]
00709   Returns:
00710     True if the profile has at least one kink.
00711   */
00712   bool ProfileIsKinked( int profile_index ) const;
00713 
00714   /*
00715   Description:
00716     Test a polycurve to determine if it meets the necessary 
00717     conditions to be used as a multi-segment profile in a extrusion.
00718   Returns:
00719     True if the returned polycurve can be used a a multi-segment 
00720     profile in a extrusion.
00721   */
00722   static bool IsValidPolyCurveProfile( const ON_PolyCurve& polycurve, ON_TextLog* text_log = 0 );
00723 
00724   /*
00725   Description:
00726     If possible, modify a polycurve so it meets the necessary conditions
00727     to be used as a multi-segment profile in a extrusion.
00728   Returns:
00729     True if the returned polycurve can be used a a multi-segment 
00730     profile in a extrusion.
00731   */
00732   static bool CleanupPolyCurveProfile( ON_PolyCurve& polycurve );
00733 
00734   // path definition:
00735   //   The line m_path must have length > m_path_length_min.
00736   //   The interval m_t must statisfy 0 <= m_t[0] < m_t[1] <= 1.
00737   //   The extrusion starts at m_path.PointAt(m_t[0]) and ends
00738   //   at m_path.PointAt(m_t[1]).
00739   //   The "up" direction m_up is a unit vector that must
00740   //   be perpendicular to m_path.Tangent().
00741   ON_Line m_path;
00742   ON_Interval m_t;
00743   ON_3dVector m_up;
00744 
00745   // profile information:
00746   //   In general, use SetOuterProfile() and AddInnerProfile()
00747   //   to set m_profile_count and m_profile.  If you are
00748   //   a glutton for punishment, then you might be interested
00749   //   in the following.
00750   //   The profile curves must be in the x-y plane.
00751   //   The profile's "y" axis corresponds to m_up.
00752   //   The point (0,0) is extruded along the m_path line.
00753   //   If m_profile_count = 1, then m_profile can be any
00754   //   type of continous curve.  If m_profile_count > 1,
00755   //   then m_profile must be an ON_PolyCurve with
00756   //   m_profile_count segments, the domain of each segment
00757   //   must exactly match the polycurve's segment domain,
00758   //   every segment must be continuous and closed,
00759   //   the first segement curve must have counter-clockwise
00760   //   orientation, and the rest must have clockwise 
00761   //   orientations.
00762   int m_profile_count;
00763   ON_Curve* m_profile;
00764 
00765   // capped end information:
00766   //   If the profile is closed, then m_bCap[] determines
00767   //   if the ends are capped.
00768   bool m_bCap[2];
00769 
00770   // mitered end information:
00771   //   The normals m_N[] are with respect to the xy plane.
00772   //   A normal parallel to the z axis has no mitering.
00773   //   If m_bHaveN[i] is true, then m_N[i] must be a 3d unit
00774   //   vector with m_N[i].z > m_Nz_tol;  If m_bHaveN[i]
00775   //   is false, then m_N[i] is ignored.  The normal m_N[0]
00776   //   defines the start miter plane and m_N[1] defines the
00777   //   end miter plane.
00778   bool m_bHaveN[2];
00779   ON_3dVector m_N[2];
00780 
00781   // Surface parameterization information
00782   ON_Interval m_path_domain;
00783   bool m_bTransposed; // false: (s,t) = (profile,path)
00784 
00785   // The z coordinates of miter plane normals must be
00786   // greater than m_Nz_tol
00787   static const double m_Nz_min; // 1/64;
00788 
00789   // The length of the m_path line must be greater than
00790   // m_path_length_min
00791   static const double m_path_length_min; // ON_ZERO_TOLERANCE;
00792 
00793   /*
00794   Description:
00795     Get an ON_Exrusion form of a cylinder.
00796   Parameters:
00797     cylinder - [in] cylinder.IsFinite() must be true
00798     bCapBottom - [in] if true, the end at cylinder.m_height[0] will be capped
00799     bCapTop - [in] if true, the end at cylinder.m_height[1] will be capped
00800     extrusion - [in] 
00801       If the input extrusion pointer is null, one will be allocated on the heap
00802       and it is the caller's responsibility to delte it at an appropriate time.
00803       If the input pointer is not null, this extrusion will be used and the same
00804       pointer will be returned, provided the input is valid.
00805   Returns:
00806     If the input is valid, a pointer to an ON_Exrusion form of the cylinder.
00807     If the input is not valid, then null, even when the input extrusion
00808     object is not null.
00809   Example:
00810 
00811           ON_Cylinder cylinder = ...;
00812           bool bCapBottom = true;
00813           bool bCapTop = true;
00814           ON_Extrusion extrusion;
00815           if ( 0 == ON_Extrusion::Cylinder(cylinder,bCapBottom,bCapTop,&extrusion) )
00816           {
00817             // input is not valid - nothing set
00818             ...
00819           }
00820           else
00821           {
00822             // extrusion = cylinder
00823             ...
00824           }
00825   */
00826   static ON_Extrusion* Cylinder( 
00827     const ON_Cylinder& cylinder, 
00828     bool bCapBottom,
00829     bool bCapTop,
00830     ON_Extrusion* extrusion = 0 
00831     );
00832 
00833   /*
00834   Description:
00835     Get an ON_Exrusion form of a pipe.
00836   Parameters:
00837     cylinder - [in] cylinder.IsFinite() must be true
00838       The cylinder can be either the inner or outer wall of the pipe.
00839     other_radius - [in] ( != cylinder.Radius() )
00840       If cylinder.Radius() < other_radius, then the cylinder will be
00841       the inside of the pipe.  If cylinder.Radius() > other_radius, then
00842       the cylinder will be the outside of the pipe.
00843     bCapBottom - [in] if true, the end at cylinder.m_height[0] will be capped
00844     bCapTop - [in] if true, the end at cylinder.m_height[1] will be capped
00845     extrusion - [in] 
00846       If the input extrusion pointer is null, one will be allocated on the heap
00847       and it is the caller's responsibility to delte it at an appropriate time.
00848       If the input pointer is not null, this extrusion will be used and the same
00849       pointer will be returned, provided the input is valid.
00850   Returns:
00851     If the input is valid, a pointer to an ON_Exrusion form of the pipe.
00852     If the input is not valid, then null, even when the input extrusion
00853     object is not null.
00854   Example:
00855 
00856           ON_Cylinder cylinder = ...;
00857           double other_radius = cylinder.Radius()+1.0;
00858           bool bCapBottom = true;
00859           bool bCapTop = true;
00860           ON_Extrusion extrusion;
00861           if ( 0 == ON_Extrusion::Pipe(cylinder,other_radius,bCapBottom,bCapTop,&extrusion) )
00862           {
00863             // input is not valid - nothing set
00864             ...
00865           }
00866           else
00867           {
00868             // extrusion = pipe
00869             ...
00870           }
00871   */
00872   static ON_Extrusion* Pipe( 
00873     const ON_Cylinder& cylinder, 
00874     double other_radius,
00875     bool bCapBottom,
00876     bool bCapTop,
00877     ON_Extrusion* extrusion = 0 
00878     );
00879 
00880   /*
00881   Description:
00882     Create an ON_Exrusion from a 3d curve, a plane and a height.
00883   Parameters:
00884     curve - [in] 
00885       A continuous 3d curve.
00886     plane - [in]
00887       If plane is null, then the plane returned by curve.IsPlanar() is used.
00888       The 3d curve is projected to this plane and the result is passed to
00889       ON_Extrusion::SetOuterProfile().
00890     height - [in]
00891       If the height > 0, the bottom of the extrusion will be in plane and
00892       the top will be height units above the plane.
00893       If the height < 0, the top of the extrusion will be in plane and
00894       the bottom will be height units below the plane.
00895     bCap - [in]
00896       If the curve is closed and bCap is true, then the resulting extrusion
00897       is capped.
00898     extrusion - [in] 
00899       If the input extrusion pointer is null, one will be allocated on the heap
00900       and it is the caller's responsibility to delte it at an appropriate time.
00901       If the input pointer is not null, this extrusion will be used and the same
00902       pointer will be returned, provided the input is valid.
00903   Returns:
00904     If the input is valid, a pointer to an ON_Exrusion form of the pipe.
00905     If the input is not valid, then null, even when the input extrusion
00906     object is not null.
00907   */
00908   static ON_Extrusion* CreateFrom3dCurve( 
00909     const ON_Curve& curve,
00910     const ON_Plane* plane,
00911     double height,
00912     bool bCap,
00913     ON_Extrusion* extrusion = 0 
00914     );
00915 
00916 };
00917 
00918 
00919 #endif
00920 


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