QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_cone.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(ON_CONE_INC_)
17#define ON_CONE_INC_
18
19class ON_NurbsSurface;
20class ON_Brep;
21
22// Description:
23// Lightweight right circular cone. Use ON_ConeSurface if
24// you need ON_Cone geometry as a virtual ON_Surface.
26{
27public:
28
29 // Creates a cone with world XY plane as the base plane,
30 // center = (0,0,0), radius = 0.0, height = 0.0.
31 ON_Cone();
32
33 // See ON_Cone::Create.
34 ON_Cone(
35 const ON_Plane& plane,
36 double height,
37 double radius
38 );
39
40 ~ON_Cone();
41
42 // Description:
43 // Creates a right circular cone from a plane, height,
44 // and radius.
45 // plane - [in] The apex of cone is at plane.origin and
46 // the axis of the cone is plane.zaxis.
47 // height - [in] The center of the base is height*plane.zaxis.
48 // radius - [in] tan(cone angle) = radius/height
49 ON_BOOL32 Create(
50 const ON_Plane& plane,
51 double height,
52 double radius
53 );
54
55 // Returns true if plane is valid, height is not zero, and
56 // radius is not zero.
57 ON_BOOL32 IsValid() const;
58
59 // Returns:
60 // Center of base circle.
61 // Remarks:
62 // The base point is plane.origin + height*plane.zaxis.
63 ON_3dPoint BasePoint() const;
64
65 // Returns:
66 // Point at the tip of the cone.
67 // Remarks:
68 // The apex point is plane.origin.
69 const ON_3dPoint& ApexPoint() const;
70
71 // Returns:
72 // Unit vector axis of cone.
73 const ON_3dVector& Axis() const;
74
75 // Returns:
76 // The angle (in radians) between the axis and the
77 // side of the cone.
78 // The angle and the height have the same sign.
79 double AngleInRadians() const;
80
81 // Returns:
82 // The angle Iin degrees) between the axis and the side.
83 // The angle and the height have the same sign.
84 double AngleInDegrees() const;
85
86 // evaluate parameters and return point
87 // Parameters:
88 // radial_parameter - [in] 0.0 to 2.0*ON_PI
89 // height_parameter - [in] 0 = apex, height = base
90 ON_3dPoint PointAt(
91 double radial_parameter,
92 double height_parameter
93 ) const;
94
95 // Parameters:
96 // radial_parameter - [in] (in radians) 0.0 to 2.0*ON_PI
97 // height_parameter - [in] 0 = apex, height = base
98 // Remarks:
99 // If radius>0 and height>0, then the normal points "out"
100 // when height_parameter >= 0.
101 ON_3dVector NormalAt(
102 double radial_parameter,
103 double height_parameter
104 ) const;
105
106 // Description:
107 // Get iso curve circle at a specified height.
108 // Parameters:
109 // height_parameter - [in] 0 = apex, height = base
110 ON_Circle CircleAt(
111 double height_parameter
112 ) const;
113
114 // Description:
115 // Get iso curve line segment at a specified angle.
116 // Parameters:
117 // radial_parameter - [in] (in radians) 0.0 to 2.0*ON_PI
118 ON_Line LineAt(
119 double radial_parameter
120 ) const;
121
122 // returns parameters of point on cone that is closest to given point
123 bool ClosestPointTo(
124 ON_3dPoint point,
125 double* radial_parameter,
126 double* height_parameter
127 ) const;
128
129 // returns point on cone that is closest to given point
130 ON_3dPoint ClosestPointTo(
132 ) const;
133
134 ON_BOOL32 Transform( const ON_Xform& );
135
136 // rotate cone about its origin
138 double sin_angle,
139 double cos_angle,
140 const ON_3dVector& axis_of_rotation
141 );
142
144 double angle_in_radians,
145 const ON_3dVector& axis_of_rotation
146 );
147
148 // rotate cone about a point and axis
150 double sin_angle,
151 double cos_angle,
152 const ON_3dVector& axis_of_rotation,
153 const ON_3dPoint& center_of_rotation
154 );
156 double angle_in_radians,
157 const ON_3dVector& axis_of_rotation,
158 const ON_3dPoint& center_of_rotation
159 );
160
162 const ON_3dVector& delta
163 );
164
165 ON_BOOL32 GetNurbForm( ON_NurbsSurface& ) const;
166
167 /*
168 Description:
169 Creates a surface of revolution definition of the cylinder.
170 Parameters:
171 srf - [in] if not NULL, then this srf is used.
172 Result:
173 A surface of revolution or NULL if the cylinder is not
174 valid or is infinite.
175 */
176 ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const;
177
178public:
179 ON_Plane plane; // apex = plane.origin, axis = plane.zaxis
180 double height; // not zero
181 double radius; // not zero
182};
183
184#endif
@ Transform
Definition RSMetaType.h:67
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_brep.h:1585
Definition opennurbs_circle.h:33
Definition opennurbs_cone.h:26
double radius
Definition opennurbs_cone.h:181
double height
Definition opennurbs_cone.h:180
ON_Plane plane
Definition opennurbs_cone.h:179
Definition opennurbs_line.h:20
Definition opennurbs_nurbssurface.h:62
Definition opennurbs_plane.h:20
Definition opennurbs_revsurface.h:21
Definition opennurbs_xform.h:28
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
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362