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