Point Cloud Library (PCL)
1.7.0
|
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 // 00014 //////////////////////////////////////////////////////////////// 00015 */ 00016 00017 #if !defined(ON_CONE_INC_) 00018 #define ON_CONE_INC_ 00019 00020 class ON_NurbsSurface; 00021 class ON_Brep; 00022 00023 // Description: 00024 // Lightweight right circular cone. Use ON_ConeSurface if 00025 // you need ON_Cone geometry as a virtual ON_Surface. 00026 class ON_CLASS ON_Cone 00027 { 00028 public: 00029 00030 // Creates a cone with world XY plane as the base plane, 00031 // center = (0,0,0), radius = 0.0, height = 0.0. 00032 ON_Cone(); 00033 00034 // See ON_Cone::Create. 00035 ON_Cone( 00036 const ON_Plane& plane, 00037 double height, 00038 double radius 00039 ); 00040 00041 ~ON_Cone(); 00042 00043 // Description: 00044 // Creates a right circular cone from a plane, height, 00045 // and radius. 00046 // plane - [in] The apex of cone is at plane.origin and 00047 // the axis of the cone is plane.zaxis. 00048 // height - [in] The center of the base is height*plane.zaxis. 00049 // radius - [in] tan(cone angle) = radius/height 00050 ON_BOOL32 Create( 00051 const ON_Plane& plane, 00052 double height, 00053 double radius 00054 ); 00055 00056 // Returns true if plane is valid, height is not zero, and 00057 // radius is not zero. 00058 ON_BOOL32 IsValid() const; 00059 00060 // Returns: 00061 // Center of base circle. 00062 // Remarks: 00063 // The base point is plane.origin + height*plane.zaxis. 00064 ON_3dPoint BasePoint() const; 00065 00066 // Returns: 00067 // Point at the tip of the cone. 00068 // Remarks: 00069 // The apex point is plane.origin. 00070 const ON_3dPoint& ApexPoint() const; 00071 00072 // Returns: 00073 // Unit vector axis of cone. 00074 const ON_3dVector& Axis() const; 00075 00076 // Returns: 00077 // The angle (in radians) between the axis and the 00078 // side of the cone. 00079 // The angle and the height have the same sign. 00080 double AngleInRadians() const; 00081 00082 // Returns: 00083 // The angle Iin degrees) between the axis and the side. 00084 // The angle and the height have the same sign. 00085 double AngleInDegrees() const; 00086 00087 // evaluate parameters and return point 00088 // Parameters: 00089 // radial_parameter - [in] 0.0 to 2.0*ON_PI 00090 // height_parameter - [in] 0 = apex, height = base 00091 ON_3dPoint PointAt( 00092 double radial_parameter, 00093 double height_parameter 00094 ) const; 00095 00096 // Parameters: 00097 // radial_parameter - [in] (in radians) 0.0 to 2.0*ON_PI 00098 // height_parameter - [in] 0 = apex, height = base 00099 // Remarks: 00100 // If radius>0 and height>0, then the normal points "out" 00101 // when height_parameter >= 0. 00102 ON_3dVector NormalAt( 00103 double radial_parameter, 00104 double height_parameter 00105 ) const; 00106 00107 // Description: 00108 // Get iso curve circle at a specified height. 00109 // Parameters: 00110 // height_parameter - [in] 0 = apex, height = base 00111 ON_Circle CircleAt( 00112 double height_parameter 00113 ) const; 00114 00115 // Description: 00116 // Get iso curve line segment at a specified angle. 00117 // Parameters: 00118 // radial_parameter - [in] (in radians) 0.0 to 2.0*ON_PI 00119 ON_Line LineAt( 00120 double radial_parameter 00121 ) const; 00122 00123 // returns parameters of point on cone that is closest to given point 00124 bool ClosestPointTo( 00125 ON_3dPoint point, 00126 double* radial_parameter, 00127 double* height_parameter 00128 ) const; 00129 00130 // returns point on cone that is closest to given point 00131 ON_3dPoint ClosestPointTo( 00132 ON_3dPoint 00133 ) const; 00134 00135 ON_BOOL32 Transform( const ON_Xform& ); 00136 00137 // rotate cone about its origin 00138 ON_BOOL32 Rotate( 00139 double sin_angle, 00140 double cos_angle, 00141 const ON_3dVector& axis_of_rotation 00142 ); 00143 00144 ON_BOOL32 Rotate( 00145 double angle_in_radians, 00146 const ON_3dVector& axis_of_rotation 00147 ); 00148 00149 // rotate cone about a point and axis 00150 ON_BOOL32 Rotate( 00151 double sin_angle, 00152 double cos_angle, 00153 const ON_3dVector& axis_of_rotation, 00154 const ON_3dPoint& center_of_rotation 00155 ); 00156 ON_BOOL32 Rotate( 00157 double angle_in_radians, 00158 const ON_3dVector& axis_of_rotation, 00159 const ON_3dPoint& center_of_rotation 00160 ); 00161 00162 ON_BOOL32 Translate( 00163 const ON_3dVector& delta 00164 ); 00165 00166 ON_BOOL32 GetNurbForm( ON_NurbsSurface& ) const; 00167 00168 /* 00169 Description: 00170 Creates a surface of revolution definition of the cylinder. 00171 Parameters: 00172 srf - [in] if not NULL, then this srf is used. 00173 Result: 00174 A surface of revolution or NULL if the cylinder is not 00175 valid or is infinite. 00176 */ 00177 ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const; 00178 00179 public: 00180 ON_Plane plane; // apex = plane.origin, axis = plane.zaxis 00181 double height; // not zero 00182 double radius; // not zero 00183 }; 00184 00185 #endif