QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_torus.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_TORUS_INC_)
17
#define ON_TORUS_INC_
18
19
class
ON_RevSurface
;
20
class
ON_TextLog
;
21
22
/*
23
Description:
24
The torus is defined by a major circle and minor radius. The
25
torus is parameterized by (major_angle,minor_angle). The angles
26
are specified in radians. The domain of both parameters is (0,2pi).
27
*/
28
class
ON_CLASS
ON_Torus
29
{
30
31
public
:
32
// for expert users
33
34
ON_Plane
plane
;
// major circle plane
35
double
major_radius
;
// > minor_radius
36
double
minor_radius
;
// > 0
37
38
public
:
39
40
ON_Torus
();
41
ON_Torus
(
const
ON_Plane
& major__plane,
double
major__radius,
double
minor__radius );
42
ON_Torus
(
const
ON_Circle
& major__circle,
double
minor__radius );
43
~ON_Torus
();
44
45
ON_BOOL32
IsValid(
ON_TextLog
* text_log =
NULL
)
const
;
46
47
ON_BOOL32
Create(
const
ON_Plane
& major__plane,
double
major__radius,
double
minor__radius );
48
ON_BOOL32
Create(
const
ON_Circle
& major__circle,
double
minor__radius);
49
50
/*
51
Description:
52
Get the circle that is the isocurve on the torus
53
at a specified minor angle.
54
Parameteters:
55
minor_angle_radians - [in]
56
Returns:
57
A circle with normal major_circle.plane.zaxis that starts
58
at PointAt( 0.0, minor_angle_radians ).
59
See Also:
60
ON_Torus::MajorCircleRadians
61
ON_Torus::MajorCircleDegrees
62
ON_Torus::MinorCircleRadians
63
ON_Torus::MinorCircleDegrees
64
*/
65
ON_Circle
MajorCircleRadians(
double
minor_angle_radians )
const
;
66
67
/*
68
Description:
69
Get the circle that is the isocurve on the torus
70
at a specified minor angle.
71
Parameteters:
72
minor_angle_degrees - [in]
73
Returns:
74
A circle with normal major_circle.plane.zaxis that starts
75
at PointAt( 0.0, minor_angle_degrees*ON_PI/180.0 ).
76
See Also:
77
ON_Torus::MajorCircleRadians
78
ON_Torus::MajorCircleDegrees
79
ON_Torus::MinorCircleRadians
80
ON_Torus::MinorCircleDegrees
81
*/
82
ON_Circle
MajorCircleDegrees(
double
minor_angle_degrees)
const
;
83
84
/*
85
Description:
86
Get the minor circle that is the isocurve on the torus
87
at a specified major angle.
88
Parameteters:
89
major_angle_radians - [in]
90
Returns:
91
A circle with radius = minor_radis,
92
center = major_circle.PointAt(major_angle_radians), and
93
starting point PointAt( major_angle_radians, 0.0 ).
94
See Also:
95
ON_Torus::MajorCircleRadians
96
ON_Torus::MajorCircleDegrees
97
ON_Torus::MinorCircleRadians
98
ON_Torus::MinorCircleDegrees
99
*/
100
ON_Circle
MinorCircleRadians(
double
major_angle_radians)
const
;
101
102
/*
103
Description:
104
Get the minor circle that is the isocurve on the torus
105
at a specified major angle.
106
Parameteters:
107
major_angle_degrees - [in]
108
Returns:
109
A circle with radius = minor_radis,
110
center = major_circle.PointAt(major_angle_degrees*ON_PI/180.0), and
111
starting point PointAt( major_angle_degrees*ON_PI/180.0, 0.0 ).
112
See Also:
113
ON_Torus::MajorCircleRadians
114
ON_Torus::MajorCircleDegrees
115
ON_Torus::MinorCircleRadians
116
ON_Torus::MinorCircleDegrees
117
*/
118
ON_Circle
MinorCircleDegrees(
double
major_angle_degrees)
const
;
119
120
ON_3dPoint
Center()
const
;
121
ON_3dVector
Axis()
const
;
122
double
MajorRadius()
const
;
123
double
MinorRadius()
const
;
124
125
ON_3dPoint
PointAt(
126
double
major_angle_radians,
127
double
minor_angle_radians
128
)
const
;
129
130
ON_3dVector
NormalAt(
131
double
major_angle_radians,
132
double
minor_angle_radians
133
)
const
;
134
135
// returns parameters of point on torus that is closest to test_point.
136
ON_BOOL32
ClosestPointTo(
137
ON_3dPoint
test_point,
138
double
* major_angle_radians,
139
double
* minor_angle_radians
140
)
const
;
141
142
// returns point on torus that is closest to test_point
143
ON_3dPoint
ClosestPointTo(
144
ON_3dPoint
test_point
145
)
const
;
146
147
// rotate torus about its origin
148
ON_BOOL32
Rotate
(
149
double
sin_angle,
// sin(angle)
150
double
cos_angle,
// cos(angle)
151
const
ON_3dVector
& axis_of_rotation
// axis of rotation
152
);
153
154
ON_BOOL32
Rotate
(
155
double
angle_radians,
// angle in radians
156
const
ON_3dVector
& axis_of_rotation
// axis of rotation
157
);
158
159
// rotate torus about a point and axis
160
ON_BOOL32
Rotate
(
161
double
sin_angle,
// sin(angle)
162
double
cos_angle,
// cos(angle)
163
const
ON_3dVector
& axis_of_rotation,
// axis of rotation
164
const
ON_3dPoint
& center_of_rotation
// center of rotation
165
);
166
167
ON_BOOL32
Rotate
(
168
double
angle_radians,
// angle in radians
169
const
ON_3dVector
& axis_of_rotation,
// axis of rotation
170
const
ON_3dPoint
& center_of_rotation
// center of rotation
171
);
172
173
ON_BOOL32
Translate
(
174
const
ON_3dVector
&
175
);
176
177
ON_BOOL32
Transform
(
const
ON_Xform
& );
178
179
// parameterization of NURBS surface does not match torus's transcendental paramaterization
180
int
GetNurbForm(
ON_NurbsSurface
& )
const
;
// returns 0=failure, 2=success
181
182
/*
183
Description:
184
Creates a surface of revolution definition of the torus.
185
Parameters:
186
srf - [in] if not NULL, then this srf is used.
187
Result:
188
A surface of revolution or NULL if the torus is not valid.
189
*/
190
ON_RevSurface
* RevSurfaceForm(
ON_RevSurface
* srf =
NULL
)
const
;
191
};
192
193
#endif
Transform
@ Transform
Definition
RSMetaType.h:67
ON_3dPoint
Definition
opennurbs_point.h:403
ON_3dVector
Definition
opennurbs_point.h:931
ON_Circle
Definition
opennurbs_circle.h:33
ON_NurbsSurface
Definition
opennurbs_nurbssurface.h:62
ON_Plane
Definition
opennurbs_plane.h:20
ON_RevSurface
Definition
opennurbs_revsurface.h:21
ON_TextLog
Definition
opennurbs_textlog.h:20
ON_Torus
Definition
opennurbs_torus.h:29
ON_Torus::major_radius
double major_radius
Definition
opennurbs_torus.h:35
ON_Torus::plane
ON_Plane plane
Definition
opennurbs_torus.h:34
ON_Torus::minor_radius
double minor_radius
Definition
opennurbs_torus.h:36
ON_Xform
Definition
opennurbs_xform.h:28
Rotate
Rotates selected entities.
Definition
Rotate.js:11
Translate
Translates (moves or copies) selected entities.
Definition
Translate.js:11
ON_CLASS
#define ON_CLASS
Definition
opennurbs_defines.h:91
NULL
#define NULL
Definition
opennurbs_system.h:256
ON_BOOL32
int ON_BOOL32
Definition
opennurbs_system.h:362
src
3rdparty
legacy
opennurbs
opennurbs_torus.h
Generated on Fri Jul 18 2025 09:41:50 for QCAD by
1.10.0