QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_sphere.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(ON_SPHERE_INC_)
17#define ON_SPHERE_INC_
18
19class ON_RevSurface;
20
22{
23public:
24
25 ON_Plane plane; // equitorial plane
26 double radius; // > 0
27
28 ON_Sphere();
29 ON_Sphere( const ON_3dPoint& center, double radius ); // center, radius
30 ~ON_Sphere();
31
32 bool IsValid() const;
33
34 bool Create( const ON_3dPoint& center, double radius); // center radius
35
36 ON_Circle LatitudeRadians(double latitude_radians ) const;
37 ON_Circle LatitudeDegrees(double latitude_degrees) const;
38 ON_Circle LongitudeRadians(double longitude_radians) const;
39 ON_Circle LongitudeDegrees(double longitude_degrees) const;
40
41 ON_3dPoint Center() const;
42 ON_3dPoint NorthPole() const;
43 ON_3dPoint SouthPole() const;
44 double Diameter() const;
45 double Radius() const;
46
47 ON_3dPoint PointAt(
48 double longitude_radians,
49 double latitude_radians
50 ) const; // longitude [0,2pi], latitude [-pi/2,pi/2] in radians
51
52 ON_3dVector NormalAt(
53 double longitude_radians,
54 double latitude_radians
55 ) const; // longitude [0,2pi], latitude [-pi/2,pi/2] in radians
56
57 ON_BoundingBox BoundingBox() const;
58
59 // returns parameters of point on sphere that is closest to given point
60 bool ClosestPointTo(
61 ON_3dPoint test_point,
62 double* longitude_radians, // longitude [0,2pi)
63 double* latitude_radians // latitude [-pi/2,pi/2]
64 ) const;
65
66 // returns point on sphere that is closest to given point
67 ON_3dPoint ClosestPointTo(
68 ON_3dPoint test_point
69 ) const;
70
71 // For intersections see ON_Intersect();
72
73 // rotate sphere about its origin
74 bool Rotate(
75 double sin_angle, // sin(angle)
76 double cos_angle, // cos(angle)
77 const ON_3dVector& axis_of_rotation // axis of rotation
78 );
79
80 bool Rotate(
81 double angle_radians, // angle in radians
82 const ON_3dVector& axis_of_rotation // axis of rotation
83 );
84
85 // rotate sphere about a point and axis
86 bool Rotate(
87 double sin_angle, // sin(angle)
88 double cos_angle, // cos(angle)
89 const ON_3dVector& axis_of_rotation, // axis of rotation
90 const ON_3dPoint& center_of_rotation // center of rotation
91 );
92
93 bool Rotate(
94 double angle_radians, // angle in radians
95 const ON_3dVector& axis_of_rotation, // axis of rotation
96 const ON_3dPoint& center_of_rotation // center of rotation
97 );
98
99 bool Translate(
100 const ON_3dVector&
101 );
102
103 bool Transform( const ON_Xform& );
104
105 // parameterization of NURBS surface does not match sphere's transcendental paramaterization
106 int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success
107
108 /*
109 Description:
110 Creates a surface of revolution definition of the sphere.
111 Parameters:
112 srf - [in] if not NULL, then this srf is used.
113 Result:
114 A surface of revolution or NULL if the sphere is not valid.
115 */
116 ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const;
117};
118
119#endif
@ Transform
Definition RSMetaType.h:67
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_bounding_box.h:25
Definition opennurbs_circle.h:33
Definition opennurbs_nurbssurface.h:62
Definition opennurbs_plane.h:20
Definition opennurbs_revsurface.h:21
Definition opennurbs_sphere.h:22
ON_Plane plane
Definition opennurbs_sphere.h:25
double radius
Definition opennurbs_sphere.h:26
Definition opennurbs_xform.h:28
Rotates selected entities.
Definition Rotate.js:11
Translates (moves or copies) selected entities.
Definition Translate.js:11
#define ON_CLASS
Definition opennurbs_defines.h:91
#define NULL
Definition opennurbs_system.h:256