Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoCylinder.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25** Modified by : Nick Thompson (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2021 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_CYLINDER_
52#define _SO_CYLINDER_
53
54#include <Inventor/SbVec.h>
55#include <Inventor/SbBox.h>
56#include <Inventor/fields/SoSFBitMask.h>
57#include <Inventor/fields/SoSFFloat.h>
58#include <Inventor/nodes/SoShape.h>
59
61//
62// Class: SoCylinder
63//
64// Simple cylinder, aligned with y-axis. Default size is -1 to +1 in
65// all 3 dimensions, but the radius and height fields can be used to
66// change that. There are essentially three parts to the cylinder:
67// the sides, the top face, and the bottom face (in that order).
68//
70
71SO_PIMPL_PUBLIC_DECLARATION( SoCylinder );
72
146class SoCylinder : public SoShape {
147
148 SO_NODE_HEADER(SoCylinder);
149 SO_PIMPL_PUBLIC_HEADER( SoCylinder );
150
151 public:
152
154 enum Part {
158 SIDES = 0x01,
162 TOP = 0x02,
166 BOTTOM = 0x04,
170 ALL = 0x07
171 };
172
173 // Fields
186
191
200
205
206 private:
207 // Implements actions
208 virtual void GLRender(SoGLRenderAction *action);
209 virtual void rayPick(SoRayPickAction *action);
210 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
211
212 // Computes bounding box of cylinder
213 virtual void computeBBox(SoAction *action, SbBox3f &box,
214 SbVec3f &center);
215
216 private:
217 static void initClass();
218 static void exitClass();
219
220 // Computes number of sides and sections to use to represent
221 // cylinder (based on complexity), then computes ring of x,z
222 // coordinates around cylinder and stores in ringCoords.
223 void computeRing( SoState* state, int& numSides, int& numSections, std::vector<SbVec2f>& ringCoords ) const;
224
225 virtual SoChildList* getChildren() const;
226
227private:
228 // Generates triangles representing a cylinder
229 virtual void generatePrimitives(SoAction *action);
230
231 virtual ~SoCylinder();
232};
233
234#endif /* _SO_CYLINDER_ */
3D box class.
Definition SbBox.h:649
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Cylinder shape node.
Definition SoCylinder.h:146
void addPart(SoCylinder::Part part)
Convenience function to turn on a part of the cylinder.
Part
Cylinder parts.
Definition SoCylinder.h:154
@ BOTTOM
The bottom circular face.
Definition SoCylinder.h:166
@ SIDES
The cylindrical part.
Definition SoCylinder.h:158
@ ALL
All parts.
Definition SoCylinder.h:170
@ TOP
The top circular face.
Definition SoCylinder.h:162
SoSFBitMask parts
Visible parts of cylinder.
Definition SoCylinder.h:177
SbBool hasPart(SoCylinder::Part part) const
Convenience function that returns whether a given part is on or off.
SoSFFloat height
Specifies the cylinder's height.
Definition SoCylinder.h:185
void removePart(SoCylinder::Part part)
Convenience function to turn off a part of the cylinder.
SoCylinder()
Creates a cylinder node with default settings.
SoSFFloat radius
Specifies the cylinder's radius.
Definition SoCylinder.h:181
Renders a scene graph using Open Inventor's Render Engine.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
friend class SoChildList
Definition SoNode.h:473
Intersects objects with a ray cast into scene.
Single-value field containing a set of bit flags.
Field containing a floating-point value.
Definition SoSFFloat.h:78
Abstract base class for all shape nodes.
Definition SoShape.h:116
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87