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_SPHERE_INC_) 00018 #define ON_SPHERE_INC_ 00019 00020 class ON_RevSurface; 00021 00022 class ON_CLASS ON_Sphere 00023 { 00024 public: 00025 00026 ON_Plane plane; // equitorial plane 00027 double radius; // > 0 00028 00029 ON_Sphere(); 00030 ON_Sphere( const ON_3dPoint& center, double radius ); // center, radius 00031 ~ON_Sphere(); 00032 00033 bool IsValid() const; 00034 00035 bool Create( const ON_3dPoint& center, double radius); // center radius 00036 00037 ON_Circle LatitudeRadians(double latitude_radians ) const; 00038 ON_Circle LatitudeDegrees(double latitude_degrees) const; 00039 ON_Circle LongitudeRadians(double longitude_radians) const; 00040 ON_Circle LongitudeDegrees(double longitude_degrees) const; 00041 00042 ON_3dPoint Center() const; 00043 ON_3dPoint NorthPole() const; 00044 ON_3dPoint SouthPole() const; 00045 double Diameter() const; 00046 double Radius() const; 00047 00048 ON_3dPoint PointAt( 00049 double longitude_radians, 00050 double latitude_radians 00051 ) const; // longitude [0,2pi], latitude [-pi/2,pi/2] in radians 00052 00053 ON_3dVector NormalAt( 00054 double longitude_radians, 00055 double latitude_radians 00056 ) const; // longitude [0,2pi], latitude [-pi/2,pi/2] in radians 00057 00058 ON_BoundingBox BoundingBox() const; 00059 00060 // returns parameters of point on sphere that is closest to given point 00061 bool ClosestPointTo( 00062 ON_3dPoint test_point, 00063 double* longitude_radians, // longitude [0,2pi) 00064 double* latitude_radians // latitude [-pi/2,pi/2] 00065 ) const; 00066 00067 // returns point on sphere that is closest to given point 00068 ON_3dPoint ClosestPointTo( 00069 ON_3dPoint test_point 00070 ) const; 00071 00072 // For intersections see ON_Intersect(); 00073 00074 // rotate sphere about its origin 00075 bool Rotate( 00076 double sin_angle, // sin(angle) 00077 double cos_angle, // cos(angle) 00078 const ON_3dVector& axis_of_rotation // axis of rotation 00079 ); 00080 00081 bool Rotate( 00082 double angle_radians, // angle in radians 00083 const ON_3dVector& axis_of_rotation // axis of rotation 00084 ); 00085 00086 // rotate sphere about a point and axis 00087 bool Rotate( 00088 double sin_angle, // sin(angle) 00089 double cos_angle, // cos(angle) 00090 const ON_3dVector& axis_of_rotation, // axis of rotation 00091 const ON_3dPoint& center_of_rotation // center of rotation 00092 ); 00093 00094 bool Rotate( 00095 double angle_radians, // angle in radians 00096 const ON_3dVector& axis_of_rotation, // axis of rotation 00097 const ON_3dPoint& center_of_rotation // center of rotation 00098 ); 00099 00100 bool Translate( 00101 const ON_3dVector& 00102 ); 00103 00104 bool Transform( const ON_Xform& ); 00105 00106 // parameterization of NURBS surface does not match sphere's transcendental paramaterization 00107 int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success 00108 00109 /* 00110 Description: 00111 Creates a surface of revolution definition of the sphere. 00112 Parameters: 00113 bArcLengthParameterization - [in] 00114 true: 00115 The domain will be set to (0,radius*2*pi)x(-radius*pi/2,radius*pi/2) 00116 false: 00117 The domain will be set to (0,2*pi)x(-pi/2,pi/2) 00118 srf - [in] 00119 if not NULL, then this srf is used. 00120 Result: 00121 A surface of revolution or NULL if the sphere is not valid. 00122 */ 00123 ON_RevSurface* RevSurfaceForm( bool bArcLengthParameterization, ON_RevSurface* srf = NULL ) const; 00124 ON_DEPRECATED ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const; 00125 }; 00126 00127 #endif