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


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