QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_cylinder.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(OPENNURBS_CYLINDER_INC_)
17#define OPENNURBS_CYLINDER_INC_
18
19class ON_NurbsSurface;
20class ON_RevSurface;
21class ON_Brep;
22
23/*
24Description:
25 ON_Cylinder is a right circular cylinder.
26*/
28{
29public:
30 ON_Cylinder(); // zeros all fields - cylinder is invalid
31
32 ON_Cylinder( // infinte cylinder
33 const ON_Circle& // point on the bottom plane
34 );
35
36 ON_Cylinder( // infinte cylinder
37 const ON_Circle&, // point on the bottom plane
38 double // height
39 );
40
42
43 bool Create(
44 const ON_Circle& // point on the bottom plane
45 );
46
47 bool Create(
48 const ON_Circle&, // point on the bottom plane
49 double // height
50 );
51
52 bool IsValid() const; // returns true if all fields contain reasonable
53 // information and equation jibes with point and Z.
54
55 bool IsFinite() const; // returns true if the cylinder is finite
56 // (height[0] != height[1]) and false if the
57 // cylinder is infinite.
58
59 const ON_3dVector& Axis() const;
60 const ON_3dPoint& Center() const;
61 double Height() const; // returns 0 for infinite cylinder
62 ON_Circle CircleAt(
63 double // linear parameter
64 ) const;
65 ON_Line LineAt(
66 double // angular parameter
67 ) const;
68
69 // evaluate parameters and return point
70 ON_3dPoint PointAt(
71 double, // angular parameter [0,2pi]
72 double // linear parameter (height from base circle's plane)
73 ) const;
74 ON_3dPoint NormalAt(
75 double, // angular parameter [0,2pi]
76 double // linear parameter (height from base circle's plane)
77 ) const;
78
79 // returns parameters of point on cylinder that is closest to given point
80 bool ClosestPointTo(
82 double*, // angular parameter [0,2pi]
83 double* // linear parameter (height from base circle's plane)
84 ) const;
85 // returns point on cylinder that is closest to given point
86 ON_3dPoint ClosestPointTo(
88 ) const;
89
90 // For intersections see ON_Intersect();
91
92 // rotate cylinder about its origin
93 bool Rotate(
94 double, // sin(angle)
95 double, // cos(angle)
96 const ON_3dVector& // axis of rotation
97 );
98 bool Rotate(
99 double, // angle in radians
100 const ON_3dVector& // axis of rotation
101 );
102
103 // rotate cylinder about a point and axis
104 bool Rotate(
105 double, // sin(angle)
106 double, // cos(angle)
107 const ON_3dVector&, // axis of rotation
108 const ON_3dPoint& // center of rotation
109 );
110 bool Rotate(
111 double, // angle in radians
112 const ON_3dVector&, // axis of rotation
113 const ON_3dPoint& // center of rotation
114 );
115
116 bool Translate(
117 const ON_3dVector&
118 );
119
120 // parameterization of NURBS surface does not match cylinder's transcendental paramaterization
121 int GetNurbForm( ON_NurbsSurface& ) const; // returns 0=failure, 2=success
122
123 /*
124 Description:
125 Creates a surface of revolution definition of the cylinder.
126 Parameters:
127 srf - [in] if not NULL, then this srf is used.
128 Result:
129 A surface of revolution or NULL if the cylinder is not
130 valid or is infinite.
131 */
132 ON_RevSurface* RevSurfaceForm( ON_RevSurface* srf = NULL ) const;
133
134public: // members left public
135 // base circle
137
138
139 // If height[0] = height[1], the cylinder is infinite,
140 // Otherwise, height[0] < height[1] and the center of
141 // the "bottom" cap is
142 //
143 // circle.plane.origin + height[0]*circle.plane.zaxis,
144 //
145 // and the center of the top cap is
146 //
147 // circle.plane.origin + height[1]*circle.plane.zaxis.
148 double height[2];
149};
150
151#endif
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_brep.h:1585
Definition opennurbs_circle.h:33
Definition opennurbs_cylinder.h:28
ON_Circle circle
Definition opennurbs_cylinder.h:136
Definition opennurbs_line.h:20
Definition opennurbs_nurbssurface.h:62
Definition opennurbs_revsurface.h:21
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