Point Cloud Library (PCL)  1.14.1-dev
opennurbs_sphere.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_SPHERE_INC_)
18 #define ON_SPHERE_INC_
19 
20 class ON_RevSurface;
21 
22 class ON_CLASS ON_Sphere
23 {
24 public:
25 
26  ON_Plane plane; // equitorial plane
27  double radius; // > 0
28 
30  ON_Sphere( const ON_3dPoint& center, double radius ); // center, radius
32 
33  bool IsValid() const;
34 
35  bool Create( const ON_3dPoint& center, double radius); // center radius
36 
37  ON_Circle LatitudeRadians(double latitude_radians ) const;
38  ON_Circle LatitudeDegrees(double latitude_degrees) const;
39  ON_Circle LongitudeRadians(double longitude_radians) const;
40  ON_Circle LongitudeDegrees(double longitude_degrees) const;
41 
42  ON_3dPoint Center() const;
45  double Diameter() const;
46  double Radius() const;
47 
49  double longitude_radians,
50  double latitude_radians
51  ) const; // longitude [0,2pi], latitude [-pi/2,pi/2] in radians
52 
54  double longitude_radians,
55  double latitude_radians
56  ) const; // longitude [0,2pi], latitude [-pi/2,pi/2] in radians
57 
59 
60  // returns parameters of point on sphere that is closest to given point
62  ON_3dPoint test_point,
63  double* longitude_radians, // longitude [0,2pi)
64  double* latitude_radians // latitude [-pi/2,pi/2]
65  ) const;
66 
67  // returns point on sphere that is closest to given point
69  ON_3dPoint test_point
70  ) const;
71 
72  // For intersections see ON_Intersect();
73 
74  // rotate sphere about its origin
75  bool Rotate(
76  double sin_angle, // sin(angle)
77  double cos_angle, // cos(angle)
78  const ON_3dVector& axis_of_rotation // axis of rotation
79  );
80 
81  bool Rotate(
82  double angle_radians, // angle in radians
83  const ON_3dVector& axis_of_rotation // axis of rotation
84  );
85 
86  // rotate sphere about a point and axis
87  bool Rotate(
88  double sin_angle, // sin(angle)
89  double cos_angle, // cos(angle)
90  const ON_3dVector& axis_of_rotation, // axis of rotation
91  const ON_3dPoint& center_of_rotation // center of rotation
92  );
93 
94  bool Rotate(
95  double angle_radians, // angle in radians
96  const ON_3dVector& axis_of_rotation, // axis of rotation
97  const ON_3dPoint& center_of_rotation // center of rotation
98  );
99 
100  bool Translate(
101  const ON_3dVector&
102  );
103 
104  bool Transform( const ON_Xform& );
105 
106  // parameterization of NURBS surface does not match sphere's transcendental paramaterization
107  int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success
108 
109  /*
110  Description:
111  Creates a surface of revolution definition of the sphere.
112  Parameters:
113  bArcLengthParameterization - [in]
114  true:
115  The domain will be set to (0,radius*2*pi)x(-radius*pi/2,radius*pi/2)
116  false:
117  The domain will be set to (0,2*pi)x(-pi/2,pi/2)
118  srf - [in]
119  if not NULL, then this srf is used.
120  Result:
121  A surface of revolution or NULL if the sphere is not valid.
122  */
123  ON_RevSurface* RevSurfaceForm( bool bArcLengthParameterization, ON_RevSurface* srf = NULL ) const;
124  ON_DEPRECATED ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const;
125 };
126 
127 #endif
int GetNurbForm(ON_NurbsSurface &) const
bool Transform(const ON_Xform &)
double Radius() const
ON_Circle LongitudeDegrees(double longitude_degrees) const
ON_3dPoint SouthPole() const
bool Create(const ON_3dPoint &center, double radius)
bool Rotate(double angle_radians, const ON_3dVector &axis_of_rotation)
ON_BoundingBox BoundingBox() const
ON_3dPoint Center() const
bool ClosestPointTo(ON_3dPoint test_point, double *longitude_radians, double *latitude_radians) const
ON_3dPoint PointAt(double longitude_radians, double latitude_radians) const
ON_DEPRECATED ON_RevSurface * RevSurfaceForm(ON_RevSurface *srf=NULL) const
ON_Circle LatitudeDegrees(double latitude_degrees) const
bool Rotate(double sin_angle, double cos_angle, const ON_3dVector &axis_of_rotation, const ON_3dPoint &center_of_rotation)
ON_3dPoint NorthPole() const
ON_Sphere(const ON_3dPoint &center, double radius)
ON_Circle LatitudeRadians(double latitude_radians) const
bool IsValid() const
ON_RevSurface * RevSurfaceForm(bool bArcLengthParameterization, ON_RevSurface *srf=NULL) const
bool Translate(const ON_3dVector &)
ON_Plane plane
ON_3dPoint ClosestPointTo(ON_3dPoint test_point) const
bool Rotate(double angle_radians, const ON_3dVector &axis_of_rotation, const ON_3dPoint &center_of_rotation)
bool Rotate(double sin_angle, double cos_angle, const ON_3dVector &axis_of_rotation)
double Diameter() const
ON_3dVector NormalAt(double longitude_radians, double latitude_radians) const
ON_Circle LongitudeRadians(double longitude_radians) const