opennurbs_torus.h
Go to the documentation of this file.
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 //
00015 */
00016 
00017 #if !defined(ON_TORUS_INC_)
00018 #define ON_TORUS_INC_
00019 
00020 class ON_RevSurface;
00021 class ON_TextLog;
00022 
00023 /*
00024 Description:
00025   The torus is defined by a major circle and minor radius.  The
00026   torus is parameterized by (major_angle,minor_angle).  The angles
00027   are specified in radians.  The domain of both parameters is (0,2pi).
00028 */
00029 class ON_CLASS ON_Torus
00030 {
00031 
00032 public:
00033   // for expert users
00034 
00035   ON_Plane plane; // major circle plane
00036   double major_radius;  // > minor_radius
00037   double minor_radius;  // > 0
00038 
00039 public:
00040 
00041   ON_Torus();
00042   ON_Torus( const ON_Plane& major__plane, double major__radius, double minor__radius );
00043   ON_Torus( const ON_Circle& major__circle, double minor__radius );
00044   ~ON_Torus();
00045 
00046   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00047 
00048   ON_BOOL32 Create( const ON_Plane& major__plane, double major__radius, double minor__radius );
00049   ON_BOOL32 Create( const ON_Circle& major__circle, double minor__radius);
00050 
00051   /*
00052   Description:
00053     Get the circle that is the isocurve on the torus
00054     at a specified minor angle.
00055   Parameteters:
00056     minor_angle_radians - [in]
00057   Returns:
00058     A circle with normal major_circle.plane.zaxis that starts
00059     at PointAt( 0.0, minor_angle_radians ).
00060   See Also:
00061     ON_Torus::MajorCircleRadians
00062     ON_Torus::MajorCircleDegrees
00063     ON_Torus::MinorCircleRadians
00064     ON_Torus::MinorCircleDegrees
00065   */
00066   ON_Circle MajorCircleRadians(double minor_angle_radians ) const;
00067 
00068   /*
00069   Description:
00070     Get the circle that is the isocurve on the torus
00071     at a specified minor angle.
00072   Parameteters:
00073     minor_angle_degrees - [in]
00074   Returns:
00075     A circle with normal major_circle.plane.zaxis that starts
00076     at PointAt( 0.0, minor_angle_degrees*ON_PI/180.0 ).
00077   See Also:
00078     ON_Torus::MajorCircleRadians
00079     ON_Torus::MajorCircleDegrees
00080     ON_Torus::MinorCircleRadians
00081     ON_Torus::MinorCircleDegrees
00082   */
00083   ON_Circle MajorCircleDegrees(double minor_angle_degrees) const;
00084 
00085   /*
00086   Description:
00087     Get the minor circle that is the isocurve on the torus
00088     at a specified major angle.
00089   Parameteters:
00090     major_angle_radians - [in]
00091   Returns:
00092     A circle with radius = minor_radis, 
00093     center = major_circle.PointAt(major_angle_radians), and
00094     starting point PointAt( major_angle_radians, 0.0 ).
00095   See Also:
00096     ON_Torus::MajorCircleRadians
00097     ON_Torus::MajorCircleDegrees
00098     ON_Torus::MinorCircleRadians
00099     ON_Torus::MinorCircleDegrees
00100   */
00101   ON_Circle MinorCircleRadians(double major_angle_radians) const;
00102 
00103   /*
00104   Description:
00105     Get the minor circle that is the isocurve on the torus
00106     at a specified major angle.
00107   Parameteters:
00108     major_angle_degrees - [in]
00109   Returns:
00110     A circle with radius = minor_radis, 
00111     center = major_circle.PointAt(major_angle_degrees*ON_PI/180.0), and
00112     starting point PointAt( major_angle_degrees*ON_PI/180.0, 0.0 ).
00113   See Also:
00114     ON_Torus::MajorCircleRadians
00115     ON_Torus::MajorCircleDegrees
00116     ON_Torus::MinorCircleRadians
00117     ON_Torus::MinorCircleDegrees
00118   */
00119   ON_Circle MinorCircleDegrees(double major_angle_degrees) const;
00120 
00121   ON_3dPoint Center() const;
00122   ON_3dVector Axis() const;
00123   double MajorRadius() const;
00124   double MinorRadius() const;
00125 
00126   ON_3dPoint PointAt(
00127     double major_angle_radians, 
00128     double minor_angle_radians
00129     ) const;
00130 
00131   ON_3dVector NormalAt(
00132     double major_angle_radians, 
00133     double minor_angle_radians
00134     ) const;
00135 
00136   // returns parameters of point on torus that is closest to test_point.
00137   ON_BOOL32 ClosestPointTo( 
00138          ON_3dPoint test_point, 
00139          double* major_angle_radians, 
00140          double* minor_angle_radians
00141          ) const;
00142 
00143   // returns point on torus that is closest to test_point
00144   ON_3dPoint ClosestPointTo( 
00145          ON_3dPoint test_point
00146          ) const;
00147 
00148   // rotate torus about its origin
00149   ON_BOOL32 Rotate(
00150         double sin_angle,               // sin(angle)
00151         double cos_angle,               // cos(angle)
00152         const ON_3dVector& axis_of_rotation // axis of rotation
00153         );
00154 
00155   ON_BOOL32 Rotate(
00156         double angle_radians,               // angle in radians
00157         const ON_3dVector& axis_of_rotation // axis of rotation
00158         );
00159 
00160   // rotate torus about a point and axis
00161   ON_BOOL32 Rotate(
00162         double sin_angle,               // sin(angle)
00163         double cos_angle,               // cos(angle)
00164         const ON_3dVector& axis_of_rotation, // axis of rotation
00165         const ON_3dPoint& center_of_rotation  // center of rotation
00166         );
00167 
00168   ON_BOOL32 Rotate(
00169         double angle_radians,               // angle in radians
00170         const ON_3dVector& axis_of_rotation, // axis of rotation
00171         const ON_3dPoint& center_of_rotation  // center of rotation
00172         );
00173 
00174   ON_BOOL32 Translate(
00175         const ON_3dVector&
00176         );
00177 
00178   ON_BOOL32 Transform( const ON_Xform& );
00179 
00180   // parameterization of NURBS surface does not match torus's transcendental paramaterization
00181   int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success
00182 
00183   /*
00184   Description:
00185     Creates a surface of revolution definition of the torus.
00186   Parameters:
00187     srf - [in] if not NULL, then this srf is used.
00188   Result:
00189     A surface of revolution or NULL if the torus is not valid.
00190   */
00191   ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const;
00192 };
00193 
00194 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:03