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