CMS 3D CMS Logo

IgSoG4Torus Class Reference

#include <Iguana/Inventor/interface/IgSoG4Torus.h>

Inheritance diagram for IgSoG4Torus:

IgSoShapeKit

List of all members.

Public Member Functions

 IgSoG4Torus (void)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFFloat maxRadius
SoSFFloat minRadius
SoSFFloat phiDelta
SoSFFloat phiStart
SoSFFloat radius

Protected Member Functions

virtual void refresh (void)

Private Member Functions

void cleanParts (void)
 SO_KIT_CATALOG_ENTRY_HEADER (torus)
 SO_KIT_HEADER (IgSoG4Torus)


Detailed Description

Definition at line 18 of file IgSoG4Torus.h.


Constructor & Destructor Documentation

IgSoG4Torus::IgSoG4Torus ( void   ) 

Definition at line 37 of file IgSoG4Torus.cc.

References f, FALSE, maxRadius, minRadius, phiDelta, phiStart, IgSoShapeKit::setUpConnections(), and TRUE.

00038 {
00039     SO_KIT_CONSTRUCTOR (IgSoG4Torus);
00040     SO_KIT_ADD_FIELD (minRadius, (0.f));
00041     SO_KIT_ADD_FIELD (maxRadius, (1.f));
00042     SO_KIT_ADD_FIELD (phiStart,  (0.0));
00043     SO_KIT_ADD_FIELD (phiDelta,  (2 * M_PI));
00044     SO_KIT_ADD_CATALOG_ENTRY (torus,  SoSeparator, FALSE, separator,\x0, TRUE);
00045     SO_KIT_INIT_INSTANCE ();
00046     setUpConnections (true, true);
00047 }


Member Function Documentation

void IgSoG4Torus::cleanParts ( void   )  [private]

void IgSoG4Torus::initClass ( void   )  [static]

Reimplemented from IgSoShapeKit.

Definition at line 34 of file IgSoG4Torus.cc.

00035 { SO_KIT_INIT_CLASS (IgSoG4Torus, IgSoShapeKit, "IgSoShapeKit"); }

void IgSoG4Torus::refresh ( void   )  [protected, virtual]

Reimplemented from IgSoShapeKit.

Definition at line 50 of file IgSoG4Torus.cc.

References funct::cos(), i, maxRadius, minRadius, NPTS, funct::sin(), SO_TORUS_U_DIM, SO_TORUS_U_ORDER, SO_TORUS_V_DIM, SO_TORUS_V_ORDER, u_knot_vals, v_knot_vals, and weight.

00051 {
00052     SoSeparator   *torSeparator   = new SoSeparator;
00053     SoCoordinate4 *torCoordinate4 = new SoCoordinate4;
00054     torCoordinate4->point.setNum (NPTS);
00055     torSeparator->addChild (torCoordinate4);
00056 
00057     //  Create the surface 
00058     SoNurbsSurface *torSurface = new SoNurbsSurface;
00059     torSurface->numUControlPoints.setValue (SO_TORUS_U_DIM);
00060     torSurface->numVControlPoints.setValue (SO_TORUS_V_DIM);
00061     torSurface->uKnotVector.setValues (0, SO_TORUS_U_DIM + SO_TORUS_U_ORDER, u_knot_vals);
00062     torSurface->vKnotVector.setValues (0, SO_TORUS_V_DIM + SO_TORUS_V_ORDER, v_knot_vals);
00063     torSeparator->addChild (torSurface);
00064 
00065     int iu, iv, i;
00066     double angleU, angleV;
00067     
00068     /*  Generate the Control Points */
00069     double weight, weightU, weightV;
00070     SbVec3f cpt;
00071     SbRotation rotator;
00072  
00073     /*  Set up the basic grid of control points */
00074     for (iv = 0, angleV = 0; iv < SO_TORUS_V_DIM; ++iv, angleV += M_PI/3) 
00075     {
00076         rotator.setValue (SbVec3f (0, 0, 1), (float) angleV);
00077         if (iv % 2 == 1) 
00078         {
00079             weightV = 0.5;
00080         }
00081         else 
00082         {
00083             weightV = 1;
00084         }
00085         for (iu = 0, angleU = 0; iu < SO_TORUS_U_DIM; ++iu, angleU -= M_PI/3) 
00086         {  
00087             /* get the order this way to set exterior of surf */
00088             i = iu + iv * SO_TORUS_U_DIM;
00089             if (iu % 2 == 1) 
00090             {
00091                 weightU = 0.5;
00092             }
00093             else 
00094             {
00095                 weightU = 1;
00096             }
00097             
00098             weight = weightU * weightV;
00099             cpt = SbVec3f (maxRadius.getValue (), 0, 0) / (float) weightV + 
00100                   SbVec3f ((float)(minRadius.getValue () * cos (angleU) / weight),      
00101                            0,
00102                            (float)(minRadius.getValue () * sin (angleU) / weightU));
00103             rotator.multVec (cpt, cpt);
00104             cpt *= (float) weight;
00105             torCoordinate4->point.set1Value (i, cpt [0], cpt [1], cpt [2], (float) weight);
00106         }
00107     }
00108 
00109     setPart ("torus", torSeparator);
00110 }

IgSoG4Torus::SO_KIT_CATALOG_ENTRY_HEADER ( torus   )  [private]

IgSoG4Torus::SO_KIT_HEADER ( IgSoG4Torus   )  [private]


Member Data Documentation

SoSFFloat IgSoG4Torus::maxRadius

Definition at line 28 of file IgSoG4Torus.h.

Referenced by IgSoG4Torus(), and refresh().

SoSFFloat IgSoG4Torus::minRadius

Definition at line 27 of file IgSoG4Torus.h.

Referenced by IgSoG4Torus(), and refresh().

SoSFFloat IgSoG4Torus::phiDelta

Definition at line 31 of file IgSoG4Torus.h.

Referenced by IgSoG4Torus().

SoSFFloat IgSoG4Torus::phiStart

Definition at line 30 of file IgSoG4Torus.h.

Referenced by IgSoG4Torus().

SoSFFloat IgSoG4Torus::radius

Definition at line 29 of file IgSoG4Torus.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:43 2009 for CMSSW by  doxygen 1.5.4