opennurbs_ellipse.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(OPENNURBS_ELLIPSE_INC_)
00018 #define OPENNURBS_ELLIPSE_INC_
00019 
00020 class ON_Ellipse;
00021 class ON_Plane;
00022 
00023 class ON_CLASS ON_Ellipse
00024 {
00025 public:
00026   ON_Ellipse(); // zeros all fields - plane is invalid
00027 
00028   ON_Ellipse(
00029     const ON_Plane&,
00030     double, double     // radii for x and y vectors
00031     );
00032 
00033   ON_Ellipse(
00034     const ON_Circle&
00035     );
00036 
00037   ~ON_Ellipse();
00038 
00039   ON_Ellipse& operator=(const ON_Circle&);
00040 
00041   ON_BOOL32 Create(
00042     const ON_Plane&,  // point on the plane
00043     double, double     // radii for x and y vectors
00044     );
00045 
00046   ON_BOOL32 Create(
00047     const ON_Circle&
00048     );
00049 
00050   ON_BOOL32 IsValid() const; // returns true if all fields contain reasonable
00051                         // information and equation jibes with point and Z.
00052 
00053   ON_BOOL32 IsCircle() const; // returns true is ellipse is a circle
00054 
00055   double Radius( 
00056     int // 0 = x axis radius, 1 = y axis radius
00057     ) const; 
00058   const ON_3dPoint& Center() const;
00059   const ON_3dVector& Normal() const;
00060   const ON_Plane& Plane() const; // plane containing ellipse
00061 
00062   /*
00063   Returns:
00064     Distance from the center to a focus, commonly called "c".
00065   */
00066   double FocalDistance() const;
00067 
00068   bool GetFoci( ON_3dPoint& F1, ON_3dPoint& F2 ) const;
00069 
00070   // Evaluation uses the trigonometrix parameterization
00071   // t -> plane.origin + cos(t)*radius[0]*plane.xaxis + sin(t)*radius[1]*plane.yaxis
00072   // evaluate parameters and return point
00073   ON_3dPoint  PointAt( double ) const;
00074   ON_3dVector DerivativeAt( 
00075                  int, // desired derivative ( >= 0 )
00076                  double // parameter
00077                  ) const;
00078 
00079   ON_3dVector TangentAt( double ) const;  // returns unit tangent
00080   ON_3dVector CurvatureAt( double ) const;  // returns curvature vector
00081 
00082   // returns parameters of point on ellipse that is closest to given point
00083   ON_BOOL32 ClosestPointTo( 
00084          const ON_3dPoint&, 
00085          double*
00086          ) const;
00087   // returns point on ellipse that is closest to given point
00088   ON_3dPoint ClosestPointTo( 
00089          const ON_3dPoint& 
00090          ) const;
00091 
00092   // evaluate ellipse's implicit equation in plane
00093   double EquationAt( const ON_2dPoint& ) const;
00094   ON_2dVector GradientAt( const ON_2dPoint& ) const;
00095 
00096   // rotate ellipse about its center
00097   ON_BOOL32 Rotate(
00098         double,              // sin(angle)
00099         double,              // cos(angle)
00100         const ON_3dVector&  // axis of rotation
00101         );
00102   ON_BOOL32 Rotate(
00103         double,              // angle in radians
00104         const ON_3dVector&  // axis of rotation
00105         );
00106 
00107   // rotate ellipse about a point and axis
00108   ON_BOOL32 Rotate(
00109         double,              // sin(angle)
00110         double,              // cos(angle)
00111         const ON_3dVector&, // axis of rotation
00112         const ON_3dPoint&   // center of rotation
00113         );
00114   ON_BOOL32 Rotate(
00115         double,              // angle in radians
00116         const ON_3dVector&, // axis of rotation
00117         const ON_3dPoint&   // center of rotation
00118         );
00119 
00120   ON_BOOL32 Translate(
00121         const ON_3dVector&
00122         );
00123 
00124   // parameterization of NURBS curve does not match ellipse's transcendental paramaterization
00125   int GetNurbForm( ON_NurbsCurve& ) const; // returns 0=failure, 2=success
00126 
00127 public: // members left public
00128   // The center of the ellipse is at the plane's origin.  The axes of the
00129   // ellipse are the plane's x and y axes. The equation of the ellipse 
00130   // with respect to the plane is (x/m_r[0])^2 + (y/m_r[1])^2 = 1;
00131   ON_Plane plane;
00132   double radius[2]; // radii for x and y axes (both must be > 0)
00133 };
00134 
00135 #endif


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