opennurbs_linecurve.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 
00017 #if !defined(ON_GEOMETRY_CURVE_LINE_INC_)
00018 #define ON_GEOMETRY_CURVE_LINE_INC_
00019 
00020 class ON_LineCurve;
00021 class ON_CLASS ON_LineCurve : public ON_Curve
00022 {
00023   ON_OBJECT_DECLARE(ON_LineCurve);
00024 
00025 public:
00026   ON_LineCurve();
00027   ON_LineCurve(const ON_2dPoint&,const ON_2dPoint&); // creates a 2d line curve
00028   ON_LineCurve(const ON_3dPoint&,const ON_3dPoint&); // creates a 3d line curve
00029   ON_LineCurve(const ON_Line&);
00030   ON_LineCurve(const ON_Line&,
00031                 double,double    // domain
00032                 );
00033   ON_LineCurve(const ON_LineCurve&);
00034 
00035   virtual ~ON_LineCurve();
00036 
00037         ON_LineCurve& operator=(const ON_LineCurve&);
00038         ON_LineCurve& operator=(const ON_Line&);
00039   
00041   // ON_Object overrides
00042 
00043   // virtual ON_Object::SizeOf override
00044   unsigned int SizeOf() const;
00045 
00046   // virtual ON_Object::DataCRC override
00047   ON__UINT32 DataCRC(ON__UINT32 current_remainder) const;
00048 
00049   /*
00050   Description:
00051     Tests an object to see if its data members are correctly
00052     initialized.
00053   Parameters:
00054     text_log - [in] if the object is not valid and text_log
00055         is not NULL, then a brief englis description of the
00056         reason the object is not valid is appened to the log.
00057         The information appended to text_log is suitable for 
00058         low-level debugging purposes by programmers and is 
00059         not intended to be useful as a high level user 
00060         interface tool.
00061   Returns:
00062     @untitled table
00063     true     object is valid
00064     false    object is invalid, uninitialized, etc.
00065   Remarks:
00066     Overrides virtual ON_Object::IsValid
00067   */
00068   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00069 
00070   void Dump( ON_TextLog& ) const; // for debugging
00071 
00072   ON_BOOL32 Write(
00073          ON_BinaryArchive&  // open binary file
00074        ) const;
00075 
00076   ON_BOOL32 Read(
00077          ON_BinaryArchive&  // open binary file
00078        );
00079 
00081   // ON_Geometry overrides
00082 
00083   int Dimension() const;
00084 
00085   ON_BOOL32 GetBBox( // returns true if successful
00086          double*,    // minimum
00087          double*,    // maximum
00088          ON_BOOL32 = false  // true means grow box
00089          ) const;
00090 
00091   /*
00092         Description:
00093     Get tight bounding box of the line.
00094         Parameters:
00095                 tight_bbox - [in/out] tight bounding box
00096                 bGrowBox -[in]  (default=false)                 
00097       If true and the input tight_bbox is valid, then returned
00098       tight_bbox is the union of the input tight_bbox and the 
00099       line's tight bounding box.
00100                 xform -[in] (default=NULL)
00101       If not NULL, the tight bounding box of the transformed
00102       line is calculated.  The line is not modified.
00103         Returns:
00104     True if the returned tight_bbox is set to a valid 
00105     bounding box.
00106   */
00107         bool GetTightBoundingBox( 
00108                         ON_BoundingBox& tight_bbox, 
00109       int bGrowBox = false,
00110                         const ON_Xform* xform = 0
00111       ) const;
00112 
00113   ON_BOOL32 Transform( 
00114          const ON_Xform&
00115          );
00116 
00117   // virtual ON_Geometry::IsDeformable() override
00118   bool IsDeformable() const;
00119 
00120   // virtual ON_Geometry::MakeDeformable() override
00121   bool MakeDeformable();
00122 
00123   ON_BOOL32 SwapCoordinates(
00124         int, int        // indices of coords to swap
00125         );
00126 
00128   // ON_Curve overrides
00129 
00130   ON_Interval Domain() const;
00131 
00132   // Description:
00133   //   Set the domain of the curve
00134   // Parameters:
00135   //   t0 - [in]
00136   //   t1 - [in] new domain will be [t0,t1]
00137   // Returns:
00138   //   true if successful.
00139   ON_BOOL32 SetDomain( 
00140         double t0, 
00141         double t1 
00142         );
00143 
00144   bool ChangeDimension(
00145           int desired_dimension
00146           );
00147 
00148   int SpanCount() const; // number of smooth spans in curve
00149 
00150   ON_BOOL32 GetSpanVector( // span "knots" 
00151          double* // array of length SpanCount() + 1 
00152          ) const; // 
00153 
00154   int Degree( // returns maximum algebraic degree of any span 
00155                   // ( or a good estimate if curve spans are not algebraic )
00156     ) const; 
00157 
00158   ON_BOOL32 IsLinear( // true if curve locus is a line segment between
00159                  // between specified points
00160         double = ON_ZERO_TOLERANCE // tolerance to use when checking linearity
00161         ) const;
00162 
00163   /*
00164   Description:
00165     Several types of ON_Curve can have the form of a polyline including
00166     a degree 1 ON_NurbsCurve, an ON_PolylineCurve, and an ON_PolyCurve
00167     all of whose segments are some form of polyline.  IsPolyline tests
00168     a curve to see if it can be represented as a polyline.
00169   Parameters:
00170     pline_points - [out] if not NULL and true is returned, then the
00171         points of the polyline form are returned here.
00172     t - [out] if not NULL and true is returned, then the parameters of
00173         the polyline points are returned here.
00174   Returns:
00175     @untitled table
00176     0        curve is not some form of a polyline
00177     >=2      number of points in polyline form
00178   */
00179   virtual
00180   int IsPolyline(
00181         ON_SimpleArray<ON_3dPoint>* pline_points = NULL,
00182         ON_SimpleArray<double>* pline_t = NULL
00183         ) const;
00184 
00185   ON_BOOL32 IsArc( // ON_Arc.m_angle > 0 if curve locus is an arc between
00186               // specified points
00187         const ON_Plane* = NULL, // if not NULL, test is performed in this plane
00188         ON_Arc* = NULL, // if not NULL and true is returned, then arc parameters
00189                          // are filled in
00190         double = ON_ZERO_TOLERANCE    // tolerance to use when checking
00191         ) const;
00192 
00193   ON_BOOL32 IsPlanar(
00194         ON_Plane* = NULL, // if not NULL and true is returned, then plane parameters
00195                            // are filled in
00196         double = ON_ZERO_TOLERANCE    // tolerance to use when checking
00197         ) const;
00198 
00199   ON_BOOL32 IsInPlane(
00200         const ON_Plane&, // plane to test
00201         double = ON_ZERO_TOLERANCE    // tolerance to use when checking
00202         ) const;
00203 
00204   ON_BOOL32 IsClosed(  // true if curve is closed (either curve has
00205         void      // clamped end knots and euclidean location of start
00206         ) const;  // CV = euclidean location of end CV, or curve is
00207                   // periodic.)
00208 
00209   ON_BOOL32 IsPeriodic(  // true if curve is a single periodic segment
00210         void 
00211         ) const;
00212   
00213   /*
00214   Description:
00215     Force the curve to start at a specified point.
00216   Parameters:
00217     start_point - [in]
00218   Returns:
00219     true if successful.
00220   Remarks:
00221     Some end points cannot be moved.  Be sure to check return
00222     code.
00223   See Also:
00224     ON_Curve::SetEndPoint
00225     ON_Curve::PointAtStart
00226     ON_Curve::PointAtEnd
00227   */
00228   ON_BOOL32 SetStartPoint(
00229           ON_3dPoint start_point
00230           );
00231 
00232   /*
00233   Description:
00234     Force the curve to end at a specified point.
00235   Parameters:
00236     end_point - [in]
00237   Returns:
00238     true if successful.
00239   Remarks:
00240     Some end points cannot be moved.  Be sure to check return
00241     code.
00242   See Also:
00243     ON_Curve::SetStartPoint
00244     ON_Curve::PointAtStart
00245     ON_Curve::PointAtEnd
00246   */
00247   ON_BOOL32 SetEndPoint(
00248           ON_3dPoint end_point
00249           );
00250 
00251   ON_BOOL32 Reverse();       // reverse parameterizatrion
00252                         // Domain changes from [a,b] to [-b,-a]
00253 
00254   ON_BOOL32 Evaluate( // returns false if unable to evaluate
00255          double,         // evaluation parameter
00256          int,            // number of derivatives (>=0)
00257          int,            // array stride (>=Dimension())
00258          double*,        // array of length stride*(ndir+1)
00259          int = 0,        // optional - determines which side to evaluate from
00260                          //         0 = default
00261                          //      <  0 to evaluate from below, 
00262                          //      >  0 to evaluate from above
00263          int* = 0        // optional - evaluation hint (int) used to speed
00264                          //            repeated evaluations
00265          ) const;
00266 
00267   // Description:
00268   //   virtual ON_Curve::Trim override.
00269   //   Removes portions of the curve outside the specified interval.
00270   // Parameters:
00271   //   domain - [in] interval of the curve to keep.  Portions of the
00272   //      curve before curve(domain[0]) and after curve(domain[1]) are
00273   //      removed.
00274   // Returns:
00275   //   true if successful.
00276   ON_BOOL32 Trim(
00277     const ON_Interval& domain
00278     );
00279 
00280   // Description:
00281   //   Where possible, analytically extends curve to include domain.
00282   // Parameters:
00283   //   domain - [in] if domain is not included in curve domain, 
00284   //   curve will be extended so that its domain includes domain.  
00285   //   Original curve is identical
00286   //   to the restriction of the resulting curve to the original curve domain, 
00287   // Returns:
00288   //   true if successful.
00289   bool Extend(
00290     const ON_Interval& domain
00291     );
00292 
00293   // Description:
00294   //   virtual ON_Curve::Split override.
00295   //   Divide the curve at the specified parameter.  The parameter
00296   //   must be in the interior of the curve's domain.  The pointers
00297   //   passed to Split must either be NULL or point to an ON_Curve
00298   //   object of the same of the same type.  If the pointer is NULL,
00299   //   then a curve will be created in Split().  You may pass "this"
00300   //   as one of the pointers to Split().
00301   // Parameters:
00302   //   t - [in] parameter in interval Domain().
00303   //   left_side - [out] left portion of curve
00304   //   right_side - [out] right portion of curve
00305   // Example:
00306   //   For example, if crv were an ON_NurbsCurve, then
00307   //
00308   //     ON_NurbsCurve right_side;
00309   //     crv.Split( crv.Domain().Mid() &crv, &right_side );
00310   //
00311   //   would split crv at the parametric midpoint, put the left side
00312   //   in crv, and return the right side in right_side.
00313   ON_BOOL32 Split(
00314       double t,    // t = curve parameter to split curve at
00315       ON_Curve*& left_side, // left portion returned here
00316       ON_Curve*& right_side // right portion returned here
00317     ) const;
00318 
00319   // Description:
00320   //   virtual ON_Curve::GetNurbForm override.
00321   //   Get a NURBS curve representation of this curve.
00322   // Parameters:
00323   //   nurbs_curve - [out] NURBS representation returned here
00324   //   tolerance - [in] tolerance to use when creating NURBS
00325   //       representation.
00326   //   subdomain - [in] if not NULL, then the NURBS representation
00327   //       for this portion of the curve is returned.
00328   // Returns:
00329   //   0   unable to create NURBS representation
00330   //       with desired accuracy.
00331   //   1   success - returned NURBS parameterization
00332   //       matches the curve's to wthe desired accuracy
00333   //   2   success - returned NURBS point locus matches
00334   //       the curve's to the desired accuracy but, on
00335   //       the interior of the curve's domain, the 
00336   //       curve's parameterization and the NURBS
00337   //       parameterization may not match to the 
00338   //       desired accuracy.
00339   int GetNurbForm(
00340         ON_NurbsCurve&,
00341         double = 0.0,
00342         const ON_Interval* = NULL
00343         ) const;
00344 
00345   // Description:
00346   //   virtual ON_Curve::HasNurbForm override.
00347   //   Does a NURBS curve representation of this curve exist.
00348   // Parameters:
00349   // Returns:
00350   //   0   unable to create NURBS representation
00351   //       with desired accuracy.
00352   //   1   success - returned NURBS parameterization
00353   //       matches the curve's to wthe desired accuracy
00354   //   2   success - returned NURBS point locus matches
00355   //       the curve's to the desired accuracy but, on
00356   //       the interior of the curve's domain, the 
00357   //       curve's parameterization and the NURBS
00358   //       parameterization may not match to the 
00359   //       desired accuracy.
00360   int HasNurbForm(
00361         ) const;
00362 
00363   // Description:
00364   //   virtual ON_Curve::GetCurveParameterFromNurbFormParameter override.
00365   //   Convert a NURBS curve parameter to a curve parameter
00366   //
00367   // Parameters:
00368   //   nurbs_t - [in] nurbs form parameter
00369   //   curve_t - [out] curve parameter
00370   //
00371   // Remarks:
00372   //   If GetNurbForm returns 2, this function converts the curve
00373   //   parameter to the NURBS curve parameter.
00374   //
00375   // See Also:
00376   //   ON_Curve::GetNurbForm, ON_Curve::GetNurbFormParameterFromCurveParameter
00377   virtual
00378   ON_BOOL32 GetCurveParameterFromNurbFormParameter(
00379         double nurbs_t,
00380         double* curve_t
00381         ) const;
00382 
00383   // Description:
00384   //   virtual ON_Curve::GetNurbFormParameterFromCurveParameter override.
00385   //   Convert a curve parameter to a NURBS curve parameter.
00386   //
00387   // Parameters:
00388   //   curve_t - [in] curve parameter
00389   //   nurbs_t - [out] nurbs form parameter
00390   //
00391   // Remarks:
00392   //   If GetNurbForm returns 2, this function converts the curve
00393   //   parameter to the NURBS curve parameter.
00394   //
00395   // See Also:
00396   //   ON_Curve::GetNurbForm, ON_Curve::GetCurveParameterFromNurbFormParameter
00397   virtual
00398   ON_BOOL32 GetNurbFormParameterFromCurveParameter(
00399         double curve_t,
00400         double* nurbs_t
00401         ) const;
00402 
00404   // Interface
00405 
00406   ON_Line m_line;
00407   ON_Interval m_t;  // domain
00408   int      m_dim;   // 2 or 3 (2 so ON_LineCurve can be uses as a trimming curve)
00409 };
00410 
00411 
00412 #endif


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