opennurbs_point.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 //   defines double precision point, vector, and array classes
00020 //
00022 #if !defined(ON_POINT_INC_)
00023 #define ON_POINT_INC_
00024 
00025 #include <pcl/pcl_exports.h>
00026 
00027 class ON_BoundingBox;
00028 class ON_Xform;
00029 class ON_Line;
00030 class ON_Plane;
00031 
00032 class ON_2dPoint;
00033 class ON_3dPoint;
00034 class ON_4dPoint;
00035 
00036 class ON_2dVector;
00037 class ON_3dVector;
00038 
00039 class ON_2fVector;
00040 class ON_3fVector;
00041 
00042 class ON_Interval;
00043 
00045 //
00046 //   ON_Interval
00047 //
00048 class PCL_EXPORTS ON_CLASS ON_Interval
00049 {
00050 public:
00051 
00052   static const ON_Interval EmptyInterval; // (ON_UNSET_VALUE,ON_UNSET_VALUE)
00053 
00055   // The default constructor creates an empty interval (ON_UNSET_VALUE,ON_UNSET_VALUE)
00056   ON_Interval();
00057 
00058   ON_Interval(double t0,double t1);
00059 
00060   ~ON_Interval();
00061 
00062   bool operator!=(const ON_Interval&) const;
00063   bool operator==(const ON_Interval&) const;
00064 
00065   // Interval = [m_t[0], m_t[1]]
00066   double m_t[2];
00067 
00068   /*
00069   Description:
00070     Sets interval to (ON_UNSET_VALUE,ON_UNSET_VALUE)
00071   See Also:
00072     ON_Interval::Set
00073   */
00074   void Destroy();
00075 
00076   /*
00077   Description:
00078     Sets interval to [t0,t1]
00079   Parameters:
00080     t0 - [in]
00081     t1 - [in]
00082   See Also:
00083     ON_Interval::ON_Interval( double, double )
00084   */
00085   void Set(
00086     double t0, 
00087     double t1
00088     );
00089 
00090   /*
00091   Description:
00092     Convert normalized parameter to interval value, or pair of values.
00093   Parameters:
00094     normalized_parameter - [in] 
00095   Returns:
00096     Interval parameter
00097     min*(1.0-normalized_parameter) + max*normalized_parameter
00098   See Also:
00099     ON_Interval::NormalizedParameterAt
00100   */
00101   double ParameterAt (
00102     double normalized_parameter
00103     ) const; 
00104   ON_Interval ParameterAt (
00105     ON_Interval normalized_interval
00106     ) const; 
00107   
00108   /*
00109   Description:
00110     Convert interval value, or pair of values, to normalized parameter.
00111   Parameters:
00112     interval_parameter - [in] value in interval
00113   Returns:
00114     Normalized parameter x so that 
00115     min*(1.0-x) + max*x = interval_parameter.
00116   See Also:
00117     ON_Interval::ParameterAt
00118   */
00119   double NormalizedParameterAt (
00120     double interval_parameter
00121     ) const;
00122   ON_Interval NormalizedParameterAt (
00123     ON_Interval interval_parameter
00124     ) const;
00125 
00126   double& operator[](int); // returns (index<=0) ? m_t[0] : m_t[1]
00127   double operator[](int) const; // returns (index<=0) ? m_t[0] : m_t[1]
00128   double& operator[](unsigned int); // returns (index<=0) ? m_t[0] : m_t[1]
00129   double operator[](unsigned int) const; // returns (index<=0) ? m_t[0] : m_t[1]
00130 
00131   double Min() const; // returns smaller of m_t[0] and m_t[1]
00132   double Max() const; // returns larger of m_t[0] and m_t[1]
00133   double Mid() const; // returns 0.5*(m_t[0] + m_t[1])
00134   double Length() const;
00135 
00136   bool IsIncreasing() const; // returns true if m_t[0] < m_t[1]
00137   bool IsDecreasing() const; // returns true if m_t[0] > m_t[0];
00138   bool IsInterval() const;   // returns truc if m_t[0] != m_t[1]
00139   bool IsSingleton() const;  // returns true if m_t[0] == m_t[1] != ON_UNSET_VALUE
00140   bool IsEmptyInterval() const;   // returns true if m_t[0] == m_t[1] == ON_UNSET_VALUE
00141   bool IsValid() const;      // returns ON_IsValid(m_t[0]) && ON_IsValid(m_t[1])
00142 
00143   // OBSOLETE - Use IsEmptyInterval()
00144   bool IsEmptySet() const;   // returns true if m_t[0] == m_t[1] == ON_UNSET_VALUE
00145 
00146         bool MakeIncreasing();          // returns true if resulting interval IsIncreasing() 
00147 
00148   /*
00149   Returns:
00150     @untitled table
00151      0      this is idential to other
00152     -1      this[0] < other[0]
00153     +1      this[0] > other[0]
00154     -1      this[0] == other[0] and this[1] < other[1]
00155     +1      this[0] == other[0] and this[1] > other[1]
00156   */
00157   int Compare( const ON_Interval& other ) const;
00158 
00159   /* 
00160   Description:
00161     Test a value t to see if it is inside the interval.
00162   Parameters:
00163     t - [in] value to test
00164     bTestOpenInterval - [in] 
00165         If false, t is tested to see if it satisfies min <= t <= max.
00166         If true, t is tested to see if it satisfies min < t < max.
00167   Returns:
00168     true if t is in the interval and false if t is not
00169     in the interval.
00170   */
00171   bool Includes(
00172     double t,
00173     bool bTestOpenInterval = false
00174     ) const;
00175 
00176   /* 
00177   Description:
00178     Test an interval to see if it is contained in this interval.
00179   Parameters:
00180     other - [in] interval to test
00181     bProperSubSet - [in] if true, then the test is for a proper subinterval.
00182   Returns:
00183     If bProperSubSet is false, then the result is true when
00184     this->Min() <= other.Min() and other.Max() <= this->Max().
00185     If bProperSubSet is true, then the result is true when
00186     this->Min() <= other.Min() and other.Max() <= this->Max()
00187     and at least one of the inequalites is strict.
00188   */
00189   bool Includes( 
00190     const ON_Interval& other,
00191     bool bProperSubSet = false
00192     ) const;
00193 
00194   /*
00195   Description:
00196     Changes interval to [-m_t[1],-m_t[0]].
00197   */
00198   void Reverse();
00199 
00200   /*
00201   Description:
00202     Swaps m_t[0] and m_t[1].
00203   */
00204   void Swap();
00205 
00207   // If the intersection is not empty, then 
00208   // intersection = [max(this.Min(),arg.Min()), min(this.Max(),arg.Max())]
00209   // Intersection() returns true if the intersection is not empty.
00210   // The interval [ON_UNSET_VALUE,ON_UNSET_VALUE] is considered to be
00211   // the empty set interval.  The result of any intersection involving an
00212   // empty set interval or disjoint intervals is the empty set interval.
00213   bool Intersection( // this = this intersect arg
00214          const ON_Interval&
00215          );
00216 
00218   // If the intersection is not empty, then 
00219   // intersection = [max(argA.Min(),argB.Min()), min(argA.Max(),argB.Max())]
00220   // Intersection() returns true if the intersection is not empty.
00221   // The interval [ON_UNSET_VALUE,ON_UNSET_VALUE] is considered to be
00222   // the empty set interval.  The result of any intersection involving an
00223   // empty set interval or disjoint intervals is the empty set interval.
00224   bool Intersection( // this = intersection of two args
00225          const ON_Interval&, 
00226          const ON_Interval&
00227          );
00228 
00230   // The union of an empty set and an increasing interval is the increasing
00231   // interval.  The union of two empty sets is empty. The union of an empty
00232   // set an a non-empty interval is the non-empty interval.
00233   // The union of two non-empty intervals is
00234   // union = [min(this.Min(),arg.Min()), max(this.Max(),arg.Max()),]
00235   // Union() returns true if the union is not empty.
00236   bool Union( // this = this union arg
00237          const ON_Interval&
00238          );
00239 
00240   bool Union( // this = this union arg
00241          double t
00242          );
00243 
00244   bool Union( // this = this union arg
00245          int count,
00246          const double* t
00247          );
00248 
00250   // The union of an empty set and an increasing interval is the increasing
00251   // interval.  The union of two empty sets is empty. The union of an empty
00252   // set an a non-empty interval is the non-empty interval.
00253   // The union of two non-empty intervals is
00254   // union = [min(argA.Min(),argB.Min()), max(argA.Max(),argB.Max()),]
00255   // Union() returns true if the union is not empty.
00256   bool Union( // this = union of two args
00257          const ON_Interval&, 
00258          const ON_Interval&
00259          );
00260 };
00261 
00263 //
00264 //   ON_2dPoint
00265 //
00266 class PCL_EXPORTS ON_CLASS ON_2dPoint
00267 {
00268 public:
00269   double x, y;
00270 
00271   static const ON_2dPoint Origin;     // (0.0,0.0)
00272   static const ON_2dPoint UnsetPoint; // (ON_UNSET_VALUE,ON_UNSET_VALUE)
00273 
00274   // use implicit destructor, copy constructor
00275   ON_2dPoint();                         // x,y not initialized
00276   ON_2dPoint(double x,double y);
00277   ON_2dPoint(const ON_3dPoint& );       // from 3d point
00278   ON_2dPoint(const ON_4dPoint& );       // from 4d point
00279   ON_2dPoint(const ON_2dVector& );      // from 2d vector
00280   ON_2dPoint(const ON_3dVector& );      // from 3d vector
00281   ON_2dPoint(const double*);            // from double[2] array
00282 
00283   ON_2dPoint(const class ON_2fPoint&);  // from 2f point
00284   ON_2dPoint(const class ON_3fPoint&);  // from 3f point
00285   ON_2dPoint(const class ON_4fPoint&);  // from 4f point
00286   ON_2dPoint(const class ON_2fVector&); // from 2f point
00287   ON_2dPoint(const class ON_3fVector&); // from 3f point
00288   ON_2dPoint(const float*);             // from float[2] array
00289 
00290   // (double*) conversion operators
00291   operator double*();
00292   operator const double*() const;
00293 
00294   // use implicit operator=(const ON_2dPoint&)
00295   ON_2dPoint& operator=(const ON_3dPoint&);
00296   ON_2dPoint& operator=(const ON_4dPoint&);
00297   ON_2dPoint& operator=(const ON_2dVector&);
00298   ON_2dPoint& operator=(const ON_3dVector&);
00299   ON_2dPoint& operator=(const double*); // point = double[2] support
00300 
00301   ON_2dPoint& operator=(const ON_2fPoint&);
00302   ON_2dPoint& operator=(const ON_3fPoint&);
00303   ON_2dPoint& operator=(const ON_4fPoint&);
00304   ON_2dPoint& operator=(const ON_2fVector&);
00305   ON_2dPoint& operator=(const ON_3fVector&);
00306   ON_2dPoint& operator=(const float*);  // point = float[2] support
00307 
00308   ON_2dPoint& operator*=(double);
00309   ON_2dPoint& operator/=(double);
00310   ON_2dPoint& operator+=(const ON_2dPoint&);  // Adding this was a mistake - cannot remove without breaking SDK
00311   ON_2dPoint& operator+=(const ON_2dVector&);
00312   ON_2dPoint& operator+=(const ON_3dVector&); // Adding this was a mistake - cannot remove without breaking SDK
00313   ON_2dPoint& operator-=(const ON_2dPoint&);  // Adding this was a mistake - cannot remove without breaking SDK
00314   ON_2dPoint& operator-=(const ON_2dVector&);
00315   ON_2dPoint& operator-=(const ON_3dVector&); // Adding this was a mistake - cannot remove without breaking SDK
00316 
00317   ON_2dPoint  operator*(int) const;
00318   ON_2dPoint  operator/(int) const;
00319   ON_2dPoint  operator*(float) const;
00320   ON_2dPoint  operator/(float) const;
00321   ON_2dPoint  operator*(double) const;
00322   ON_2dPoint  operator/(double) const;
00323 
00324   ON_2dPoint  operator+(const ON_2dPoint&) const;
00325   ON_2dPoint  operator+(const ON_2dVector&) const;
00326   ON_2dVector operator-(const ON_2dPoint&) const;
00327   ON_2dPoint  operator-(const ON_2dVector&) const;
00328   ON_3dPoint  operator+(const ON_3dPoint&) const;
00329   ON_3dPoint  operator+(const ON_3dVector&) const;
00330   ON_3dVector operator-(const ON_3dPoint&) const;
00331   ON_3dPoint  operator-(const ON_3dVector&) const;
00332 
00333   ON_2dPoint  operator+(const ON_2fPoint&) const;
00334   ON_2dPoint  operator+(const ON_2fVector&) const;
00335   ON_2dVector operator-(const ON_2fPoint&) const;
00336   ON_2dPoint  operator-(const ON_2fVector&) const;
00337   ON_3dPoint  operator+(const ON_3fPoint&) const;
00338   ON_3dPoint  operator+(const ON_3fVector&) const;
00339   ON_3dVector operator-(const ON_3fPoint&) const;
00340   ON_3dPoint  operator-(const ON_3fVector&) const;
00341 
00342   double operator*(const ON_2dPoint&) const; // dot product for points acting as vectors
00343   double operator*(const ON_2dVector&) const; // dot product for points acting as vectors
00344   double operator*(const ON_4dPoint&) const;
00345   ON_2dPoint operator*(const ON_Xform&) const;
00346 
00347   bool operator==(const ON_2dPoint&) const;
00348   bool operator!=(const ON_2dPoint&) const;
00349 
00350   // dictionary order comparisons
00351   bool operator<=(const ON_2dPoint&) const;
00352   bool operator>=(const ON_2dPoint&) const;
00353   bool operator<(const ON_2dPoint&) const;
00354   bool operator>(const ON_2dPoint&) const;
00355 
00356   // index operators mimic double[2] behavior
00357   double& operator[](int);
00358   double operator[](int) const;
00359   double& operator[](unsigned int);
00360   double operator[](unsigned int) const;
00361 
00362   /*
00363   Returns:
00364     False if any coordinate is infinte, a nan, or ON_UNSET_VALUE.
00365   */
00366   bool IsValid() const;
00367 
00368   /*
00369   Returns:
00370     True if every coordinate is ON_UNSET_VALUE.
00371   */
00372   bool IsUnsetPoint() const;
00373 
00374   // set 2d point value
00375   void Set(double x,double y);
00376 
00377   double DistanceTo( const ON_2dPoint& ) const;
00378 
00379   int MaximumCoordinateIndex() const;
00380   double MaximumCoordinate() const; // absolute value of maximum coordinate
00381 
00382   int MinimumCoordinateIndex() const;
00383   double MinimumCoordinate() const; // absolute value of minimum coordinate
00384 
00385   void Zero(); // set all coordinates to zero;
00386 
00387   // These transform the point in place. The transformation matrix acts on
00388   // the left of the point; i.e., result = transformation*point
00389   void Transform( 
00390         const ON_Xform&
00391         );
00392 
00393   void Rotate( // rotatation in XY plane
00394         double angle,              // angle in radians
00395         const ON_2dPoint& center   // center of rotation
00396         );
00397 
00398   void Rotate( // rotatation in XY plane
00399         double sin_angle,          // sin(angle)
00400         double cos_angle,          // cos(angle)
00401         const ON_2dPoint& center   // center of rotation
00402         );
00403 };
00404 
00405 ON_DECL
00406 ON_2dPoint operator*(int, const ON_2dPoint&);
00407 
00408 ON_DECL
00409 ON_2dPoint operator*(float, const ON_2dPoint&);
00410 
00411 ON_DECL
00412 ON_2dPoint operator*(double, const ON_2dPoint&);
00413 
00415 //
00416 //   ON_3dPoint
00417 //
00418 class PCL_EXPORTS ON_CLASS ON_3dPoint
00419 {
00420 public:
00421   double x, y, z;
00422 
00423   static const ON_3dPoint Origin;     // (0.0,0.0,0.0)
00424   static const ON_3dPoint UnsetPoint; // (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE)
00425 
00426   // use implicit destructor, copy constructor
00427   ON_3dPoint();                         // x,y,z not initialized
00428   ON_3dPoint(double x,double y,double z);
00429   ON_3dPoint(const ON_2dPoint& );       // from 2d point
00430   ON_3dPoint(const ON_4dPoint& );       // from 4d point
00431   ON_3dPoint(const ON_2dVector& );      // from 2d vector
00432   ON_3dPoint(const ON_3dVector& );      // from 3d vector
00433   ON_3dPoint(const double*);            // from double[3] array
00434 
00435   ON_3dPoint(const class ON_2fPoint&);  // from 2f point
00436   ON_3dPoint(const class ON_3fPoint&);  // from 3f point
00437   ON_3dPoint(const class ON_4fPoint&);  // from 4f point
00438   ON_3dPoint(const class ON_2fVector&); // from 2f point
00439   ON_3dPoint(const class ON_3fVector&); // from 3f point
00440   ON_3dPoint(const float*);             // from float[3] array
00441 
00442   // (double*) conversion operators
00443   operator double*();
00444   operator const double*() const;
00445 
00446   // use implicit operator=(const ON_3dPoint&)
00447   ON_3dPoint& operator=(const ON_2dPoint&);
00448   ON_3dPoint& operator=(const ON_4dPoint&);
00449   ON_3dPoint& operator=(const ON_2dVector&);
00450   ON_3dPoint& operator=(const ON_3dVector&);
00451   ON_3dPoint& operator=(const double*); // point = double[3] support
00452 
00453   ON_3dPoint& operator=(const class ON_2fPoint&);
00454   ON_3dPoint& operator=(const class ON_3fPoint&);
00455   ON_3dPoint& operator=(const class ON_4fPoint&);
00456   ON_3dPoint& operator=(const class ON_2fVector&);
00457   ON_3dPoint& operator=(const class ON_3fVector&);
00458   ON_3dPoint& operator=(const float*);  // point = float[3] support
00459 
00460   ON_3dPoint& operator*=(double);
00461   ON_3dPoint& operator/=(double);
00462   ON_3dPoint& operator+=(const ON_3dPoint&);  // Adding this was a mistake - cannot remove without breaking SDK
00463   ON_3dPoint& operator+=(const ON_3dVector&);
00464   ON_3dPoint& operator-=(const ON_3dPoint&);  // Adding this was a mistake - cannot remove without breaking SDK
00465   ON_3dPoint& operator-=(const ON_3dVector&);
00466 
00467   ON_3dPoint  operator*(int) const;
00468   ON_3dPoint  operator/(int) const;
00469   ON_3dPoint  operator*(float) const;
00470   ON_3dPoint  operator/(float) const;
00471   ON_3dPoint  operator*(double) const;
00472   ON_3dPoint  operator/(double) const;
00473 
00474   ON_3dPoint  operator+(const ON_3dPoint&) const;
00475   ON_3dPoint  operator+(const ON_3dVector&) const;
00476   ON_3dVector operator-(const ON_3dPoint&) const;
00477   ON_3dPoint  operator-(const ON_3dVector&) const;
00478   ON_3dPoint  operator+(const ON_2dPoint&) const;
00479   ON_3dPoint  operator+(const ON_2dVector&) const;
00480   ON_3dVector operator-(const ON_2dPoint&) const;
00481   ON_3dPoint  operator-(const ON_2dVector&) const;
00482 
00483   ON_3dPoint  operator+(const ON_3fPoint&) const;
00484   ON_3dPoint  operator+(const ON_3fVector&) const;
00485   ON_3dVector operator-(const ON_3fPoint&) const;
00486   ON_3dPoint  operator-(const ON_3fVector&) const;
00487   ON_3dPoint  operator+(const ON_2fPoint&) const;
00488   ON_3dPoint  operator+(const ON_2fVector&) const;
00489   ON_3dVector operator-(const ON_2fPoint&) const;
00490   ON_3dPoint  operator-(const ON_2fVector&) const;
00491 
00492   double operator*(const ON_3dPoint&) const; // dot product for points acting as vectors
00493   double operator*(const ON_3dVector&) const; // dot product for points acting as vectors
00494   double operator*(const ON_4dPoint&) const;
00495   ON_3dPoint operator*(const ON_Xform&) const;
00496 
00497   bool operator==(const ON_3dPoint&) const;
00498   bool operator!=(const ON_3dPoint&) const;
00499 
00500   // dictionary order comparisons
00501   bool operator<=(const ON_3dPoint&) const;
00502   bool operator>=(const ON_3dPoint&) const;
00503   bool operator<(const ON_3dPoint&) const;
00504   bool operator>(const ON_3dPoint&) const;
00505 
00506   // index operators mimic double[3] behavior
00507   double& operator[](int);
00508   double operator[](int) const;
00509   double& operator[](unsigned int);
00510   double operator[](unsigned int) const;
00511 
00512   /*
00513   Returns:
00514     False if any coordinate is infinte, a nan, or ON_UNSET_VALUE.
00515   */
00516   bool IsValid() const;
00517 
00518   /*
00519   Returns:
00520     True if every coordinate is ON_UNSET_VALUE.
00521   */
00522   bool IsUnsetPoint() const;
00523 
00524   // set 3d point value
00525   void Set(double x,double y,double z);
00526 
00527   double DistanceTo( const ON_3dPoint& ) const;
00528 
00529   int MaximumCoordinateIndex() const;
00530   double MaximumCoordinate() const; // absolute value of maximum coordinate
00531   
00532   int MinimumCoordinateIndex() const;
00533   double MinimumCoordinate() const; // absolute value of minimum coordinate
00534 
00535   double Fuzz( double tolerance = ON_ZERO_TOLERANCE ) const; // tolerance to use when comparing 3d points
00536 
00537   void Zero(); // set all coordinates to zero;
00538 
00539   // These transform the point in place. The transformation matrix acts on
00540   // the left of the point; i.e., result = transformation*point
00541   void Transform( 
00542         const ON_Xform&
00543         );
00544 
00545   void Rotate( 
00546         double angle,             // angle in radians
00547         const ON_3dVector& axis,  // axis of rotation
00548         const ON_3dPoint& center  // center of rotation
00549         );
00550 
00551   void Rotate( 
00552         double sin_angle,         // sin(angle)
00553         double cos_angle,         // cos(angle)
00554         const ON_3dVector& axis,  // axis of rotation
00555         const ON_3dPoint& center  // center of rotation
00556         );
00557 };
00558 
00559 ON_DECL
00560 ON_3dPoint operator*(int, const ON_3dPoint&);
00561 
00562 ON_DECL
00563 ON_3dPoint operator*(float, const ON_3dPoint&);
00564 
00565 ON_DECL
00566 ON_3dPoint operator*(double, const ON_3dPoint&);
00567 
00569 //
00570 //   ON_4dPoint (homogeneous coordinates)
00571 //
00572 class PCL_EXPORTS ON_CLASS ON_4dPoint
00573 {
00574 public:
00575   double x, y, z, w;
00576   
00577   // use implicit destructor, copy constructor
00578   ON_4dPoint();                       // x,y,z,w not initialized
00579   ON_4dPoint(double x,double y,double z,double w);
00580 
00581   ON_4dPoint(const ON_2dPoint& );     // from 2d point
00582   ON_4dPoint(const ON_3dPoint& );     // from 3d point
00583   ON_4dPoint(const ON_2dVector& );    // from 2d vector
00584   ON_4dPoint(const ON_3dVector& );    // from 3d vector
00585   ON_4dPoint(const double*);          // from double[4] array
00586 
00587   ON_4dPoint(const ON_2fPoint& );     // from 2f point
00588   ON_4dPoint(const ON_3fPoint& );     // from 3f point
00589   ON_4dPoint(const ON_4fPoint& );     // from 3f point
00590   ON_4dPoint(const ON_2fVector& );    // from 2f vector
00591   ON_4dPoint(const ON_3fVector& );    // from 3f vector
00592   ON_4dPoint(const float*);           // from float[4] array
00593 
00594   // (double*) conversion operators
00595   operator double*();
00596   operator const double*() const;
00597 
00598   // use implicit operator=(const ON_4dPoint&)
00599   ON_4dPoint& operator=(const ON_2dPoint&);
00600   ON_4dPoint& operator=(const ON_3dPoint&);
00601   ON_4dPoint& operator=(const ON_2dVector&);
00602   ON_4dPoint& operator=(const ON_3dVector&);
00603   ON_4dPoint& operator=(const double*); // point = double[4] support
00604 
00605   ON_4dPoint& operator=(const class ON_2fPoint&);
00606   ON_4dPoint& operator=(const class ON_3fPoint&);
00607   ON_4dPoint& operator=(const class ON_4fPoint&);
00608   ON_4dPoint& operator=(const class ON_2fVector&);
00609   ON_4dPoint& operator=(const class ON_3fVector&);
00610   ON_4dPoint& operator=(const float*);  // point = float[4] support
00611 
00612   ON_4dPoint& operator*=(double);
00613   ON_4dPoint& operator/=(double);
00614   ON_4dPoint& operator+=(const ON_4dPoint&); // sum w = sqrt(|w1*w2|)
00615   ON_4dPoint& operator-=(const ON_4dPoint&); // difference w = sqrt(|w1*w2|)
00616 
00617   ON_4dPoint  operator*(double) const;
00618   ON_4dPoint  operator/(double) const;
00619   ON_4dPoint  operator+(const ON_4dPoint&) const; // sum w = sqrt(|w1*w2|)
00620   ON_4dPoint  operator-(const ON_4dPoint&) const; // difference w = sqrt(|w1*w2|)
00621 
00622   double operator*(const ON_4dPoint&) const;
00623   ON_4dPoint operator*(const ON_Xform&) const;
00624 
00625   // projective comparison 
00626   // (i.e., [x,y,z,w] == [c*x,c*y,c*z,c*w] is true for nonzero c)
00627   bool operator==(ON_4dPoint) const;
00628   bool operator!=(const ON_4dPoint&) const;
00629 
00630   // index operators mimic double[4] behavior
00631   double& operator[](int);
00632   double operator[](int) const;
00633   double& operator[](unsigned int);
00634   double operator[](unsigned int) const;
00635 
00636   /*
00637   Returns:
00638     False if any coordinate is infinte, a nan, or ON_UNSET_VALUE.
00639   */
00640   bool IsValid() const;
00641 
00642   /*
00643   Returns:
00644     True if every coordinate is ON_UNSET_VALUE.
00645   */
00646   bool IsUnsetPoint() const;
00647 
00648   // set 4d point value
00649   void Set(double x,double y,double z,double w);
00650 
00651   int MaximumCoordinateIndex() const;
00652   double MaximumCoordinate() const; // absolute value of maximum coordinate
00653 
00654   int MinimumCoordinateIndex() const;
00655   double MinimumCoordinate() const; // absolute value of minimum coordinate
00656 
00657   void Zero();      // set all 4 coordinates to zero;
00658   bool Normalize(); // set so x^2 + y^2 + z^2 + w^2 = 1
00659 
00660   // These transform the point in place. The transformation matrix acts on
00661   // the left of the point; i.e., result = transformation*point
00662   void Transform( 
00663         const ON_Xform&
00664         );
00665 };
00666 
00667 ON_DECL
00668 ON_4dPoint operator*(double, const ON_4dPoint&);
00669 
00671 //
00672 //   ON_2dVector
00673 //
00674 class PCL_EXPORTS ON_CLASS ON_2dVector
00675 {
00676 public:
00677   double x, y;
00678 
00679   static const ON_2dVector ZeroVector;  // (0.0,0.0)
00680   static const ON_2dVector XAxis;       // (1.0,0.0)
00681   static const ON_2dVector YAxis;       // (0.0,1.0)
00682   static const ON_2dVector UnsetVector; // (ON_UNSET_VALUE,ON_UNSET_VALUE)
00683 
00684   // Description:
00685   //   A index driven function to get unit axis vectors.
00686   // Parameters:
00687   //   index - [in] 0 returns (1,0), 1 returns (0,1)
00688   // Returns:
00689   //   Unit 2d vector with vector[i] = (i==index)?1:0;
00690   static const ON_2dVector& UnitVector(
00691     int // index
00692     );
00693 
00694   // use implicit destructor, copy constructor
00695   ON_2dVector();                     // x,y not initialized
00696   ON_2dVector(double x,double y);
00697 
00698   ON_2dVector(const ON_3dVector& ); // from 3d vector
00699   ON_2dVector(const ON_2dPoint& );  // from 2d point
00700   ON_2dVector(const ON_3dPoint& );  // from 3d point
00701   ON_2dVector(const double*);       // from double[2] array
00702 
00703   ON_2dVector(const ON_2fVector& ); // from 2f vector
00704   ON_2dVector(const ON_3fVector& ); // from 3f vector
00705   ON_2dVector(const ON_2fPoint& );  // from 2f point
00706   ON_2dVector(const ON_3fPoint& );  // from 3f point
00707   ON_2dVector(const float*);        // from double[2] array
00708 
00709   // (double*) conversion operators
00710   operator double*();
00711   operator const double*() const;
00712 
00713   // use implicit operator=(const ON_2dVector&)
00714   ON_2dVector& operator=(const ON_3dVector&);
00715   ON_2dVector& operator=(const ON_2dPoint&);
00716   ON_2dVector& operator=(const ON_3dPoint&);
00717   ON_2dVector& operator=(const double*); // vector = double[2] support
00718 
00719   ON_2dVector& operator=(const ON_2fVector&);
00720   ON_2dVector& operator=(const ON_3fVector&);
00721   ON_2dVector& operator=(const ON_2fPoint&);
00722   ON_2dVector& operator=(const ON_3fPoint&);
00723   ON_2dVector& operator=(const float*);  // vector = float[2] support
00724 
00725   ON_2dVector  operator-() const;
00726 
00727   ON_2dVector& operator*=(double);
00728   ON_2dVector& operator/=(double);
00729   ON_2dVector& operator+=(const ON_2dVector&);
00730   ON_2dVector& operator-=(const ON_2dVector&);
00731   // DO NOT ADD ANY MORE overrides of += or -=
00732 
00733   double operator*(const ON_2dVector&) const; // inner (dot) product
00734   double operator*(const ON_2dPoint&) const; // inner (dot) product (point acting as vector)
00735   double operator*(const ON_2fVector&) const; // inner (dot) product    
00736 
00737   ON_2dVector  operator*(int) const;
00738   ON_2dVector  operator/(int) const;
00739   ON_2dVector  operator*(float) const;
00740   ON_2dVector  operator/(float) const;
00741   ON_2dVector  operator*(double) const;
00742   ON_2dVector  operator/(double) const;
00743 
00744   ON_2dVector  operator+(const ON_2dVector&) const;
00745   ON_2dPoint   operator+(const ON_2dPoint&) const;
00746   ON_2dVector  operator-(const ON_2dVector&) const;
00747   ON_2dPoint   operator-(const ON_2dPoint&) const;
00748   ON_3dVector  operator+(const ON_3dVector&) const;
00749   ON_3dPoint   operator+(const ON_3dPoint&) const;
00750   ON_3dVector  operator-(const ON_3dVector&) const;
00751   ON_3dPoint   operator-(const ON_3dPoint&) const;
00752 
00753   ON_2dVector  operator+(const ON_2fVector&) const;
00754   ON_2dPoint   operator+(const ON_2fPoint&) const;
00755   ON_2dVector  operator-(const ON_2fVector&) const;
00756   ON_2dPoint   operator-(const ON_2fPoint&) const;
00757   ON_3dVector  operator+(const ON_3fVector&) const;
00758   ON_3dPoint   operator+(const ON_3fPoint&) const;
00759   ON_3dVector  operator-(const ON_3fVector&) const;
00760   ON_3dPoint   operator-(const ON_3fPoint&) const;
00761 
00762   double operator*(const ON_4dPoint&) const;
00763   ON_2dVector operator*(const ON_Xform&) const;
00764 
00765   bool operator==(const ON_2dVector&) const;
00766   bool operator!=(const ON_2dVector&) const;
00767 
00768   // dictionary order comparisons
00769   bool operator<=(const ON_2dVector&) const;
00770   bool operator>=(const ON_2dVector&) const;
00771   bool operator<(const ON_2dVector&) const;
00772   bool operator>(const ON_2dVector&) const;
00773 
00774   // index operators mimic double[2] behavior
00775   double& operator[](int);
00776   double operator[](int) const;
00777   double& operator[](unsigned int);
00778   double operator[](unsigned int) const;
00779 
00780   /*
00781   Returns:
00782     False if any coordinate is infinte, a nan, or ON_UNSET_VALUE.
00783   */
00784   bool IsValid() const;
00785 
00786   /*
00787   Returns:
00788     True if every coordinate is ON_UNSET_VALUE.
00789   */
00790   bool IsUnsetVector() const;
00791 
00792   // set 2d vector value
00793   void Set(double x,double y);
00794 
00795   int MaximumCoordinateIndex() const;
00796   double MaximumCoordinate() const; // absolute value of maximum coordinate
00797 
00798   int MinimumCoordinateIndex() const;
00799   double MinimumCoordinate() const; // absolute value of minimum coordinate
00800 
00801   double LengthSquared() const;
00802   double Length() const;
00803 
00804         // Signed area of the parallelagram.  The volume element.
00805         // returns x*B.y - y*B.x
00806         double WedgeProduct(const ON_2dVector& B) const;
00807 
00808   bool Decompose( // Computes a, b such that this vector = a*X + b*Y
00809          // Returns false if unable to solve for a,b.  This happens
00810          // when X,Y is not really a basis.
00811          //
00812          // If X,Y is known to be an orthonormal frame,
00813          // then a = V*X, b = V*Y will compute
00814          // the same result more quickly.
00815          const ON_2dVector&, // X
00816          const ON_2dVector&, // Y
00817          double*, // a
00818          double*  // b
00819          ) const;
00820 
00821   int IsParallelTo( 
00822         // returns  1: this and other vectors are parallel
00823         //         -1: this and other vectors are anti-parallel
00824         //          0: this and other vectors are not parallel
00825         //             or at least one of the vectors is zero
00826         const ON_2dVector& other,                           // other vector     
00827         double angle_tolerance = ON_DEFAULT_ANGLE_TOLERANCE // optional angle tolerance (radians)
00828         ) const;
00829 
00830   bool IsPerpendicularTo(
00831         // returns true:  this and other vectors are perpendicular
00832         //         false: this and other vectors are not perpendicular
00833         //                or at least one of the vectors is zero
00834         const ON_2dVector& other,                           // other vector     
00835         double angle_tolerance = ON_DEFAULT_ANGLE_TOLERANCE // optional angle tolerance (radians)
00836         ) const;
00837 
00838   void Zero(); // set all coordinates to zero;
00839   void Reverse(); // negate all coordinates
00840   bool Unitize();  // returns false if vector has zero length
00841 
00842   // Description:
00843   //   Test a vector to see if it is very short
00844   //
00845   // Parameters:
00846   //   tiny_tol - [in] (default = ON_ZERO_TOLERANCE) a nonzero
00847   //              value used as the coordinate zero tolerance.
00848   //
00849   // Returns:
00850   //   ( fabs(x) <= tiny_tol && fabs(y) <= tiny_tol )
00851   //
00852   bool IsTiny(
00853          double tiny_tol = ON_ZERO_TOLERANCE // tiny_tol
00854          ) const;
00855 
00856   // Returns:
00857   //   true if vector is the zero vector.
00858   bool IsZero() const;
00859 
00860   // Returns:
00861   //   true if vector is valid and has length 1.
00862   bool IsUnitVector() const;
00863 
00864   // set this vector to be perpendicular to another vector
00865   bool PerpendicularTo( // Result is not unitized. 
00866                         // returns false if input vector is zero
00867         const ON_2dVector& 
00868         );
00869 
00870   // set this vector to be perpendicular to a line defined by 2 points
00871   bool PerpendicularTo( 
00872         const ON_2dPoint&, 
00873         const ON_2dPoint& 
00874         );
00875 
00876   // These transform the vector in place. The transformation matrix acts on
00877   // the left of the vector; i.e., result = transformation*vector
00878   void Transform( 
00879         const ON_Xform& // can use ON_Xform here
00880         );
00881 
00882   void Rotate( 
00883         double angle            // angle in radians
00884         );
00885 
00886   void Rotate( 
00887         double sin_angle,       // sin(angle)
00888         double cos_angle        // cos(angle)
00889         );
00890 };
00891 
00892 ON_DECL
00893 ON_2dVector operator*(int, const ON_2dVector&);
00894 
00895 ON_DECL
00896 ON_2dVector operator*(float, const ON_2dVector&);
00897 
00898 ON_DECL
00899 ON_2dVector operator*(double, const ON_2dVector&);
00900 
00902 //
00903 // ON_2dVector utilities
00904 //
00905 
00906 ON_DECL
00907 double 
00908 ON_DotProduct( 
00909     const ON_2dVector&, 
00910     const ON_2dVector& 
00911     );
00912 
00913 ON_DECL
00914 ON_3dVector 
00915 ON_CrossProduct(
00916     const ON_2dVector&, 
00917     const ON_2dVector& 
00918     );
00919 
00920 ON_DECL
00921 double                   
00922 ON_WedgeProduct(                // signed area of the parallelagram.  Volume element.
00923     const ON_2dVector& A, // returns A.x * B.y - A.y * B.x 
00924     const ON_2dVector& B 
00925     );
00926 
00927 ON_DECL
00928 bool 
00929 ON_IsOrthogonalFrame( // true if X, Y are nonzero and mutually perpendicular
00930     const ON_2dVector&, // X
00931     const ON_2dVector&  // Y
00932     );
00933 
00934 ON_DECL
00935 bool 
00936 ON_IsOrthonormalFrame( // true if X, Y are orthogonal and unit length
00937     const ON_2dVector&, // X
00938     const ON_2dVector&  // Y
00939     );
00940 
00941 ON_DECL
00942 bool 
00943 ON_IsRightHandFrame( // true if X, Y are orthonormal and right handed
00944     const ON_2dVector&, // X
00945     const ON_2dVector&  // Y
00946     );
00947 
00949 //
00950 //   ON_3dVector
00951 //
00952 class PCL_EXPORTS ON_CLASS ON_3dVector
00953 {
00954 public:
00955   double x, y, z;
00956 
00957   static const ON_3dVector ZeroVector;  // (0.0,0.0,0.0)
00958   static const ON_3dVector XAxis;       // (1.0,0.0,0.0)
00959   static const ON_3dVector YAxis;       // (0.0,1.0,0.0)
00960   static const ON_3dVector ZAxis;       // (0.0,0.0,1.0)
00961   static const ON_3dVector UnsetVector; // (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE)
00962 
00963   // Description:
00964   //   A index driven function to get unit axis vectors.
00965   // Parameters:
00966   //   index - [in] 0 returns (1,0,0), 1 returns (0,1,0), 
00967   //                2 returns (0,0,1)
00968   // Returns:
00969   //   Unit 3d vector with vector[i] = (i==index)?1:0;
00970   static const ON_3dVector& UnitVector(
00971     int // index
00972     );
00973 
00974   // use implicit destructor, copy constructor
00975   ON_3dVector();                     // x,y,z not initialized
00976   ON_3dVector(double x,double y,double z);
00977   ON_3dVector(const ON_2dVector& );  // from 2d vector
00978   ON_3dVector(const ON_2dPoint& );   // from 2d point
00979   ON_3dVector(const ON_3dPoint& );   // from 3d point
00980   ON_3dVector(const double*);        // from double[3] array
00981 
00982   ON_3dVector(const ON_2fVector& );  // from 2f vector
00983   ON_3dVector(const ON_3fVector& );  // from 3f vector
00984   ON_3dVector(const ON_2fPoint& );   // from 2f point
00985   ON_3dVector(const ON_3fPoint& );   // from 3f point
00986   ON_3dVector(const float*);         // from float[3] array
00987 
00988   // (double*) conversion operators
00989   operator double*();
00990   operator const double*() const;
00991 
00992   // use implicit operator=(const ON_3dVector&)
00993   ON_3dVector& operator=(const ON_2dVector&);
00994   ON_3dVector& operator=(const ON_2dPoint&);
00995   ON_3dVector& operator=(const ON_3dPoint&);
00996   ON_3dVector& operator=(const double*); // vector = double[3] support
00997   
00998   ON_3dVector& operator=(const ON_2fVector&);
00999   ON_3dVector& operator=(const ON_3fVector&);
01000   ON_3dVector& operator=(const ON_2fPoint&);
01001   ON_3dVector& operator=(const ON_3fPoint&);
01002   ON_3dVector& operator=(const float*);  // vector = float[3] support
01003 
01004   ON_3dVector  operator-() const;
01005 
01006   ON_3dVector& operator*=(double);
01007   ON_3dVector& operator/=(double);
01008   ON_3dVector& operator+=(const ON_3dVector&);
01009   ON_3dVector& operator-=(const ON_3dVector&);
01010   // DO NOT ADD ANY MORE overrides of += or -=
01011 
01012   double operator*(const ON_3dVector&) const; // inner (dot) product
01013   double operator*(const ON_3dPoint&) const; // inner (dot) product
01014   double operator*(const ON_3fVector&) const; // inner (dot) product
01015 
01016   ON_3dVector  operator*(int) const;
01017   ON_3dVector  operator/(int) const;
01018   ON_3dVector  operator*(float) const;
01019   ON_3dVector  operator/(float) const;
01020   ON_3dVector  operator*(double) const;
01021   ON_3dVector  operator/(double) const;
01022 
01023   ON_3dVector  operator+(const ON_3dVector&) const;
01024   ON_3dPoint   operator+(const ON_3dPoint&) const;
01025   ON_3dVector  operator-(const ON_3dVector&) const;
01026   ON_3dPoint   operator-(const ON_3dPoint&) const;
01027   ON_3dVector  operator+(const ON_2dVector&) const;
01028   ON_3dPoint   operator+(const ON_2dPoint&) const;
01029   ON_3dVector  operator-(const ON_2dVector&) const;
01030   ON_3dPoint   operator-(const ON_2dPoint&) const;
01031 
01032   ON_3dVector  operator+(const ON_3fVector&) const;
01033   ON_3dPoint   operator+(const ON_3fPoint&) const;
01034   ON_3dVector  operator-(const ON_3fVector&) const;
01035   ON_3dPoint   operator-(const ON_3fPoint&) const;
01036   ON_3dVector  operator+(const ON_2fVector&) const;
01037   ON_3dPoint   operator+(const ON_2fPoint&) const;
01038   ON_3dVector  operator-(const ON_2fVector&) const;
01039   ON_3dPoint   operator-(const ON_2fPoint&) const;
01040 
01041   double operator*(const ON_4dPoint&) const;
01042   ON_3dVector operator*(const ON_Xform&) const;
01043 
01044   bool operator==(const ON_3dVector&) const;
01045   bool operator!=(const ON_3dVector&) const;
01046 
01047   // dictionary order comparisons
01048   bool operator<=(const ON_3dVector&) const;
01049   bool operator>=(const ON_3dVector&) const;
01050   bool operator<(const ON_3dVector&) const;
01051   bool operator>(const ON_3dVector&) const;
01052 
01053   // index operators mimic double[3] behavior
01054   double& operator[](int);
01055   double operator[](int) const;
01056   double& operator[](unsigned int);
01057   double operator[](unsigned int) const;
01058 
01059   /*
01060   Returns:
01061     False if any coordinate is infinte, a nan, or ON_UNSET_VALUE.
01062   */
01063   bool IsValid() const;
01064 
01065   /*
01066   Returns:
01067     True if every coordinate is ON_UNSET_VALUE.
01068   */
01069   bool IsUnsetVector() const;
01070 
01071   // set 3d vector value
01072   void Set(double x,double y,double z);
01073 
01074   int MaximumCoordinateIndex() const;
01075   double MaximumCoordinate() const; // absolute value of maximum coordinate
01076 
01077   int MinimumCoordinateIndex() const;
01078   double MinimumCoordinate() const; // absolute value of minimum coordinate
01079 
01080   double LengthSquared() const;
01081   double Length() const;
01082 
01083   bool Decompose( // Computes a, b, c such that this vector = a*X + b*Y + c*Z
01084          // Returns false if unable to solve for a,b,c.  This happens
01085          // when X,Y,Z is not really a basis.
01086          //
01087          // If X,Y,Z is known to be an orthonormal frame,
01088          // then a = V*X, b = V*Y, c = V*Z will compute
01089          // the same result more quickly.
01090          const ON_3dVector&, // X
01091          const ON_3dVector&, // Y
01092          const ON_3dVector&, // Z
01093          double*, // a
01094          double*, // b
01095          double*  // c
01096          ) const;
01097 
01098   int IsParallelTo( 
01099         // returns  1: this and other vectors are parallel
01100         //         -1: this and other vectors are anti-parallel
01101         //          0: this and other vectors are not parallel
01102         //             or at least one of the vectors is zero
01103         const ON_3dVector& other,                           // other vector     
01104         double angle_tolerance = ON_DEFAULT_ANGLE_TOLERANCE // optional angle tolerance (radians)
01105         ) const;
01106 
01107   bool IsPerpendicularTo(
01108         // returns true:  this and other vectors are perpendicular
01109         //         false: this and other vectors are not perpendicular
01110         //                or at least one of the vectors is zero
01111         const ON_3dVector& other,                           // other vector     
01112         double angle_tolerance = ON_DEFAULT_ANGLE_TOLERANCE // optional angle tolerance (radians)
01113         ) const;
01114 
01115   double Fuzz( double tolerance = ON_ZERO_TOLERANCE ) const; // tolerance to use when comparing 3d vectors
01116 
01117   void Zero(); // set all coordinates to zero;
01118   void Reverse(); // negate all coordinates
01119   bool Unitize();  // returns false if vector has zero length
01120   double LengthAndUnitize(); // unitizes and returns initial length
01121 
01122   // Description:
01123   //   Test a vector to see if it is very short
01124   //
01125   // Parameters:
01126   //   tiny_tol - [in] (default = ON_ZERO_TOLERANCE) a nonzero
01127   //              value used as the coordinate zero tolerance.
01128   //
01129   // Returns:
01130   //   ( fabs(x) <= tiny_tol && fabs(y) <= tiny_tol && fabs(z) <= tiny_tol )
01131   //
01132   bool IsTiny(
01133          double tiny_tol = ON_ZERO_TOLERANCE // tiny_tol
01134          ) const;
01135 
01136   // Returns:
01137   //   true if vector is the zero vector.
01138   bool IsZero() const;
01139 
01140   // Returns:
01141   //   true if vector is valid and has length 1.
01142   bool IsUnitVector() const;
01143 
01144   // set this vector to be perpendicular to another vector
01145   bool PerpendicularTo( // Result is not unitized. 
01146                         // returns false if input vector is zero
01147         const ON_3dVector& 
01148         );
01149 
01150   // set this vector to be perpendicular to a plane defined by 3 points
01151   bool PerpendicularTo(
01152                // about 3 times slower than
01153                //    ON_3dVector N = ON_CrossProduct(P1-P0,P2-P0); 
01154                //    N.Unitize();
01155                // returns false if points are coincident or colinear
01156          const ON_3dPoint&, const ON_3dPoint&, const ON_3dPoint& 
01157          );
01158 
01159   // These transform the vector in place. The transformation matrix acts on
01160   // the left of the vector; i.e., result = transformation*vector
01161   void Transform( 
01162         const ON_Xform& // can use ON_Xform here
01163         );
01164 
01165   void Rotate( 
01166         double angle,           // angle in radians
01167         const ON_3dVector& axis // axis of rotation
01168         );
01169 
01170   void Rotate( 
01171         double sin_angle,        // sin(angle)
01172         double cos_angle,        // cos(angle)
01173         const ON_3dVector& axis  // axis of rotation
01174         );
01175 };
01176 
01177 class PCL_EXPORTS ON_CLASS ON_3dRay
01178 {
01179 public:
01180   ON_3dRay();
01181   ~ON_3dRay();
01182 
01183   ON_3dPoint  m_P;
01184   ON_3dVector m_V;
01185 };
01186 
01187 /*
01188 Description:
01189   Typically the vector portion is a unit vector and
01190   m_d = -(x*P.x + y*P.y + z*P.z) for a point P on the plane.
01191 */
01192 class PCL_EXPORTS ON_CLASS ON_PlaneEquation : public ON_3dVector
01193 {
01194 public:
01195   // C++ defaults for construction, destruction, copys, and operator=
01196   // work fine.
01197 
01198   static const ON_PlaneEquation UnsetPlaneEquation; // (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE)
01199   static const ON_PlaneEquation ZeroPlaneEquation; // (0.0,0.0,0.0,0.0)
01200 
01201   ON_PlaneEquation();
01202 
01203   ON_PlaneEquation(double xx, double yy, double zz, double dd);
01204 
01205   /*
01206   Description:
01207     returns true if x, y, z, d are valid, finite doubles.
01208   Remarks:
01209     this function will return true if x, y and z are all zero.
01210   See Also:
01211     ON_PlaneEquation::IsSet().
01212   */
01213   bool IsValid() const;
01214 
01215   /*
01216   Description:
01217     returns true if x, y, z, d are valid, finite doubles and
01218     at least one of x, y or z is not zero.
01219   */
01220   bool IsSet() const;
01221 
01222   /*
01223   Description:
01224     Sets (x,y,z) to a unitized N and then sets
01225     d = -(x*P.x + y*P.y + z*P.z).
01226   Parameters:
01227     P - [in] point on the plane
01228     N - [in] vector perpendicular to the plane
01229   Returns:
01230      true if input is valid.
01231   */
01232   bool Create( ON_3dPoint P, ON_3dVector N );
01233 
01234   /*
01235   Description:
01236     Evaluate the plane at a point.
01237   Parameters:
01238     P - [in]
01239   Returns:
01240     x*P.x + y*P.y + z*P.z + d;
01241   */
01242   double ValueAt(ON_3dPoint P) const;
01243   double ValueAt(ON_4dPoint P) const;
01244   double ValueAt(ON_3dVector P) const;
01245   double ValueAt(double x, double y, double z) const;
01246 
01247   /*
01248   Description:
01249     Evaluate the plane at a list of point values.
01250   Parameters:
01251     Pcount - [in]
01252       number of points
01253     P - [in]
01254       points
01255     value - [in]
01256       If not null, value[] must be an array of length at least Pcount.
01257       The values will be stored in this array.  If null, the an array
01258       will be allocated with onmalloc() and returned.
01259     value_range - [out]
01260       If not null, the range of values will be returned here.
01261   Returns:
01262     An array of Pcount values.  If the input parameter value was null,
01263     then the array is allocated on the heap using onmalloc() and the 
01264     caller is responsible for calling onfree() when finished.  If the 
01265     input is not valid, null is returned.
01266   */
01267   double* ValueAt(
01268         int Pcount,
01269         const ON_3fPoint* P,
01270         double* value,
01271         double value_range[2]
01272         ) const;
01273 
01274   double* ValueAt(
01275         int Pcount,
01276         const ON_3dPoint* P,
01277         double* value,
01278         double value_range[2]
01279         ) const;
01280 
01281   /*
01282   Description:
01283     This function calculates and evalutes points that 
01284     would be exactly on the plane if double precision
01285     aritmetic were mathematically perfect and returns
01286     the largest value of the evaluations.
01287   */
01288   double ZeroTolerance() const;
01289 
01290   /*
01291   Description:
01292     Transform the plane equation so that, if e0 is the initial
01293     equation, e1 is transformed equation and P is a point,
01294     then e0.ValueAt(P) = e1.ValueAt(xform*P).
01295   Parameters:
01296     xform - [in]
01297       Invertable transformation.
01298   Returns:
01299     True if the plane equation was successfully transformed.
01300     False if xform is not invertable or the equation is not
01301     valid.
01302   Remarks:
01303     This function has to invert xform.  If you have apply the
01304     same transformation to a bunch of planes, then it will be
01305     more efficient to calculate xform's inverse transpose
01306     and apply the resultingt transformation to the equation's
01307     coefficients as if they were 4d point coordinates.
01308   */
01309   bool Transform( const ON_Xform& xform );
01310 
01311   /*
01312   Description:
01313     Get point on plane that is closest to a given point.
01314   Parameters:
01315     point - [in]
01316   Returns:
01317     A 3d point on the plane that is closest to the input point.
01318   */
01319   ON_3dPoint ClosestPointTo( ON_3dPoint point ) const;
01320 
01321   /*
01322   Description:
01323     Get the minimum value of the plane equation
01324     on a bounding box.
01325   Parameters:
01326     bbox - [in] 
01327   Returns:
01328     Minimum value of the plane equation on the bounding box.
01329   */
01330   double MinimumValueAt(const ON_BoundingBox& bbox) const;
01331 
01332   /*
01333   Description:
01334     Get the maximum value of the plane equation
01335     on a bounding box.
01336   Parameters:
01337     bbox - [in] 
01338   Returns:
01339     Maximum value of the plane equation on the bounding box.
01340   */
01341   double MaximumValueAt(const ON_BoundingBox& bbox) const;
01342 
01343   /*
01344   Description:
01345     Get the maximum value of the plane equation on a set of 3d points.
01346   Parameters:
01347     bRational - [in]
01348       False if the points are euclidean (x,y,z)
01349       True if the points are homogenous rational (x,y,z,w)
01350       (x/w,y/w,z/w) is used to evaluate the value.
01351     point_count - [in]
01352     point_stride - [in]
01353       i-th point's x coordinate = points[i*point_stride]
01354     points - [in]
01355       coordinates of points
01356     stop_value - [in]
01357       If stop_value is valid and not ON_UNSET_VALUE, then the 
01358       evaulation stops if a value > stop_value is found. 
01359       If stop_value = ON_UNSET_VALUE, then stop_value is ignored.
01360   Returns:
01361     Maximum value of the plane equation on the point list.
01362     If the input is not valid, then ON_UNSET_VALUE is returned.
01363   */
01364   double MaximumValueAt(
01365     bool bRational,
01366     int point_count,
01367     int point_stride,
01368     const double* points,
01369     double stop_value
01370     ) const;
01371 
01372   /*
01373   Description:
01374     Get the minimum value of the plane equation on a set of 3d points.
01375   Parameters:
01376     bRational - [in]
01377       False if the points are euclidean (x,y,z)
01378       True if the points are homogenous rational (x,y,z,w)
01379       (x/w,y/w,z/w) is used to evaluate the value.
01380     point_count - [in]
01381     point_stride - [in]
01382       i-th point's x coordinate = points[i*point_stride]
01383     points - [in]
01384       coordinates of points
01385     stop_value - [in]
01386       If stop_value is valid and not ON_UNSET_VALUE, then the 
01387       evaulation stops if a value < stop_value is found. 
01388       If stop_value = ON_UNSET_VALUE, then stop_value is ignored.
01389   Returns:
01390     Maximum value of the plane equation on the point list.
01391     If the input is not valid, then ON_UNSET_VALUE is returned.
01392   */
01393   double MinimumValueAt(
01394     bool bRational,
01395     int point_count,
01396     int point_stride,
01397     const double* points,
01398     double stop_value
01399     ) const;
01400 
01401   /*
01402   Description:
01403     Get the maximum absolute value of the plane equation 
01404     on a set of 3d points.
01405   Parameters:
01406     bRational - [in]
01407       False if the points are euclidean (x,y,z)
01408       True if the points are homogenous rational (x,y,z,w)
01409       (x/w,y/w,z/w) is used to evaluate the value.
01410     point_count - [in]
01411     point_stride - [in]
01412       i-th point's x coordinate = points[i*point_stride]
01413     points - [in]
01414       coordinates of points
01415     stop_value - [in]
01416       If stop_value >= 0.0, then the evaulation stops if an
01417       absolute value > stop_value is found. If stop_value < 0.0 
01418       or stop_value is invalid, then stop_value is ignored.
01419   Returns:
01420     Maximum value of the plane equation on the point list.
01421     If the input is not valid, then ON_UNSET_VALUE is returned.
01422   */
01423   double MaximumAbsoluteValueAt(
01424     bool bRational,
01425     int point_count,
01426     int point_stride,
01427     const double* points,
01428     double stop_value
01429     ) const;
01430 
01431   /*
01432   Description:
01433     Test points on a bezier curve to see if they are near the plane.
01434   Parameters:
01435     bezcrv - [in]
01436     s0 - [in]
01437     s1 - [in] the interval from s0 to s1 is tested (s0 < s1)
01438     sample_count - [in] number of interior points to test.  
01439                 Numbers like 1, 3, 7, 15, ... work best.
01440     endpoint_tolerance - [in] If >= 0, then the end points are 
01441               tested to see if the distance from the endpoints 
01442               is <= endpoint_tolerance.
01443     interior_tolerance - [in] (>=0 and >=endpoint_tolerance) 
01444               This tolerance is used to test the interior sample points.
01445     smin - [put]  If not NULL, *smin = bezier parameter of nearest
01446                   test point.
01447     smax - [put]  If not NULL, *smax = bezier parameter of farthest
01448                   test point.  If false is returned, this is the
01449                   parameter of the test point that failed.
01450   Returns:
01451     True if all the tested points passed the tolerance test.
01452     False if at least one tested point failed the tolerance test.
01453     (The test terminates when the first failure is encountered.)
01454   */
01455   bool IsNearerThan( 
01456           const class ON_BezierCurve& bezcrv,
01457           double s0,
01458           double s1,
01459           int sample_count,
01460           double endpoint_tolerance,
01461           double interior_tolerance,
01462           double* smin,
01463           double* smax
01464           ) const;
01465   
01466   bool operator==(const ON_PlaneEquation&) const;
01467   bool operator!=(const ON_PlaneEquation&) const;
01468 
01469   double d; // 4th coefficient of the plane equation.
01470 };
01471 
01472 ON_DECL
01473 ON_3dVector operator*(int, const ON_3dVector&);
01474 
01475 ON_DECL
01476 ON_3dVector operator*(float, const ON_3dVector&);
01477 
01478 ON_DECL
01479 ON_3dVector operator*(double, const ON_3dVector&);
01480 
01482 //
01483 // ON_3dVector utilities
01484 //
01485 
01486 ON_DECL
01487 double 
01488 ON_DotProduct( 
01489     const ON_3dVector&, 
01490     const ON_3dVector& 
01491     );
01492 
01493 
01494 ON_DECL
01495 ON_3dVector 
01496 ON_CrossProduct(
01497     const ON_3dVector&, 
01498     const ON_3dVector& 
01499     );
01500 
01501 ON_DECL
01502 ON_3dVector 
01503 ON_CrossProduct( // 3d cross product for old fashioned arrays
01504     const double*, // array of 3d doubles
01505     const double*  // array of 3d doubles
01506     );
01507 
01508 ON_DECL
01509 double 
01510 ON_TripleProduct( 
01511     const ON_3dVector&,
01512     const ON_3dVector&,
01513     const ON_3dVector&
01514     );
01515 
01516 ON_DECL
01517 double 
01518 ON_TripleProduct(  // 3d triple product for old fashioned arrays
01519     const double*, // array of 3d doubles
01520     const double*, // array of 3d doubles
01521     const double*  // array of 3d doubles
01522     );
01523 
01524 ON_DECL
01525 bool 
01526 ON_IsOrthogonalFrame( // true if X, Y, Z are nonzero and mutually perpendicular
01527     const ON_3dVector&, // X
01528     const ON_3dVector&, // Y
01529     const ON_3dVector&  // Z 
01530     );
01531 
01532 ON_DECL
01533 bool 
01534 ON_IsOrthonormalFrame( // true if X, Y, Z are orthogonal and unit length
01535     const ON_3dVector&, // X
01536     const ON_3dVector&, // Y
01537     const ON_3dVector&  // Z 
01538     );
01539 
01540 ON_DECL
01541 bool 
01542 ON_IsRightHandFrame( // true if X, Y, Z are orthonormal and right handed
01543     const ON_3dVector&, // X
01544     const ON_3dVector&, // Y
01545     const ON_3dVector&  // Z 
01546     );
01547 
01549 //
01550 // common points and vectors
01551 //
01552 // ON_unset_point is obsolete - use ON_3dPoint::UnsetPoint
01553 #define ON_unset_point ON_UNSET_POINT
01554 
01555 // ON_UNSET_POINT is OBSOLETE - use ON_3dPoint::UnsetPoint
01556 extern ON_EXTERN_DECL const ON_3dPoint  ON_UNSET_POINT; // (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE)
01557 
01558 // ON_UNSET_VECTOR is OBSOLETE - use ON_3dPoint::UnsetVector
01559 extern ON_EXTERN_DECL const ON_3dVector ON_UNSET_VECTOR; // (ON_UNSET_VALUE,ON_UNSET_VALUE,ON_UNSET_VALUE)
01560 
01561 // ON_origin is OBSOLETE - use ON_3dPoint::Origin
01562 extern ON_EXTERN_DECL const ON_3dPoint  ON_origin; // (0.0, 0.0, 0.0)
01563 
01564 // ON_xaxis is OBSOLETE - use ON_3dPoint::XAxis
01565 extern ON_EXTERN_DECL const ON_3dVector ON_xaxis; // (1.0, 0.0, 0.0)
01566 
01567 // ON_yaxis is OBSOLETE - use ON_3dPoint::YAxis
01568 extern ON_EXTERN_DECL const ON_3dVector ON_yaxis; // (0.0, 1.0, 0.0)
01569 
01570 // ON_zaxis is OBSOLETE - use ON_3dPoint::ZAxis
01571 extern ON_EXTERN_DECL const ON_3dVector ON_zaxis; // (0.0, 0.0, 1.0)
01572 
01573 #include "opennurbs_fpoint.h"
01574 
01576 //
01577 //   ON_SurfaceCurvature
01578 //
01579 class PCL_EXPORTS ON_CLASS ON_SurfaceCurvature
01580 {
01581 public:
01582   double k1, k2; // principal curvatures
01583 
01584   double GaussianCurvature() const;
01585   double MeanCurvature() const;
01586   double MinimumRadius() const;
01587   double MaximumRadius() const;
01588 };
01589 
01590 #endif
01591 


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