Point Cloud Library (PCL)  1.14.1-dev
opennurbs_ellipse.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_ELLIPSE_INC_)
18 #define OPENNURBS_ELLIPSE_INC_
19 
20 class ON_Ellipse;
21 class ON_Plane;
22 
23 class ON_CLASS ON_Ellipse
24 {
25 public:
26  ON_Ellipse(); // zeros all fields - plane is invalid
27 
29  const ON_Plane&,
30  double, double // radii for x and y vectors
31  );
32 
34  const ON_Circle&
35  );
36 
38 
40 
41  ON_BOOL32 Create(
42  const ON_Plane&, // point on the plane
43  double, double // radii for x and y vectors
44  );
45 
46  ON_BOOL32 Create(
47  const ON_Circle&
48  );
49 
50  ON_BOOL32 IsValid() const; // returns true if all fields contain reasonable
51  // information and equation jibes with point and Z.
52 
53  ON_BOOL32 IsCircle() const; // returns true is ellipse is a circle
54 
55  double Radius(
56  int // 0 = x axis radius, 1 = y axis radius
57  ) const;
58  const ON_3dPoint& Center() const;
59  const ON_3dVector& Normal() const;
60  const ON_Plane& Plane() const; // plane containing ellipse
61 
62  /*
63  Returns:
64  Distance from the center to a focus, commonly called "c".
65  */
66  double FocalDistance() const;
67 
68  bool GetFoci( ON_3dPoint& F1, ON_3dPoint& F2 ) const;
69 
70  // Evaluation uses the trigonometrix parameterization
71  // t -> plane.origin + cos(t)*radius[0]*plane.xaxis + sin(t)*radius[1]*plane.yaxis
72  // evaluate parameters and return point
73  ON_3dPoint PointAt( double ) const;
75  int, // desired derivative ( >= 0 )
76  double // parameter
77  ) const;
78 
79  ON_3dVector TangentAt( double ) const; // returns unit tangent
80  ON_3dVector CurvatureAt( double ) const; // returns curvature vector
81 
82  // returns parameters of point on ellipse that is closest to given point
83  ON_BOOL32 ClosestPointTo(
84  const ON_3dPoint&,
85  double*
86  ) const;
87  // returns point on ellipse that is closest to given point
89  const ON_3dPoint&
90  ) const;
91 
92  // evaluate ellipse's implicit equation in plane
93  double EquationAt( const ON_2dPoint& ) const;
95 
96  // rotate ellipse about its center
97  ON_BOOL32 Rotate(
98  double, // sin(angle)
99  double, // cos(angle)
100  const ON_3dVector& // axis of rotation
101  );
102  ON_BOOL32 Rotate(
103  double, // angle in radians
104  const ON_3dVector& // axis of rotation
105  );
106 
107  // rotate ellipse about a point and axis
108  ON_BOOL32 Rotate(
109  double, // sin(angle)
110  double, // cos(angle)
111  const ON_3dVector&, // axis of rotation
112  const ON_3dPoint& // center of rotation
113  );
114  ON_BOOL32 Rotate(
115  double, // angle in radians
116  const ON_3dVector&, // axis of rotation
117  const ON_3dPoint& // center of rotation
118  );
119 
120  ON_BOOL32 Translate(
121  const ON_3dVector&
122  );
123 
124  // parameterization of NURBS curve does not match ellipse's transcendental paramaterization
125  int GetNurbForm( ON_NurbsCurve& ) const; // returns 0=failure, 2=success
126 
127 public: // members left public
128  // The center of the ellipse is at the plane's origin. The axes of the
129  // ellipse are the plane's x and y axes. The equation of the ellipse
130  // with respect to the plane is (x/m_r[0])^2 + (y/m_r[1])^2 = 1;
132  double radius[2]; // radii for x and y axes (both must be > 0)
133 };
134 
135 #endif
ON_Ellipse(const ON_Plane &, double, double)
const ON_Plane & Plane() const
ON_3dVector CurvatureAt(double) const
ON_Ellipse & operator=(const ON_Circle &)
ON_3dVector DerivativeAt(int, double) const
ON_3dPoint ClosestPointTo(const ON_3dPoint &) const
bool GetFoci(ON_3dPoint &F1, ON_3dPoint &F2) const
ON_BOOL32 Rotate(double, double, const ON_3dVector &)
ON_3dPoint PointAt(double) const
double FocalDistance() const
ON_3dVector TangentAt(double) const
ON_BOOL32 Rotate(double, const ON_3dVector &, const ON_3dPoint &)
ON_BOOL32 IsValid() const
ON_BOOL32 Create(const ON_Plane &, double, double)
ON_2dVector GradientAt(const ON_2dPoint &) const
ON_Ellipse(const ON_Circle &)
double Radius(int) const
const ON_3dPoint & Center() const
const ON_3dVector & Normal() const
ON_BOOL32 IsCircle() const
ON_BOOL32 Create(const ON_Circle &)
ON_BOOL32 Translate(const ON_3dVector &)
double EquationAt(const ON_2dPoint &) const
int GetNurbForm(ON_NurbsCurve &) const
ON_BOOL32 ClosestPointTo(const ON_3dPoint &, double *) const
ON_BOOL32 Rotate(double, const ON_3dVector &)
ON_BOOL32 Rotate(double, double, const ON_3dVector &, const ON_3dPoint &)