CMS 3D CMS Logo

IgSoG4Trd Class Reference

The documentation from Geant says: A Trd is a trapezoid with the x and y dimensions varying along z functions:. More...

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

Inheritance diagram for IgSoG4Trd:

IgSoShapeKit

List of all members.

Public Member Functions

 IgSoG4Trd (void)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFFloat dx1
SoSFFloat dx2
SoSFFloat dy1
SoSFFloat dy2
SoSFFloat dz

Protected Member Functions

virtual void refresh (void)

Private Member Functions

 SO_KIT_CATALOG_ENTRY_HEADER (faces)
 SO_KIT_HEADER (IgSoG4Trd)


Detailed Description

The documentation from Geant says: A Trd is a trapezoid with the x and y dimensions varying along z functions:.

Author:
Joe Boudreau
Date:
11 Nov 1996

Definition at line 28 of file IgSoG4Trd.h.


Constructor & Destructor Documentation

IgSoG4Trd::IgSoG4Trd ( void   ) 

Definition at line 24 of file IgSoG4Trd.cc.

References dx1, dx2, dy1, dy2, dz, FALSE, IgSoShapeKit::setUpConnections(), and TRUE.

00025 {
00026     SO_KIT_CONSTRUCTOR (IgSoG4Trd);
00027     SO_KIT_ADD_FIELD (dx1, (1.0));
00028     SO_KIT_ADD_FIELD (dx2, (1.0));
00029     SO_KIT_ADD_FIELD (dy1, (1.0));
00030     SO_KIT_ADD_FIELD (dy2, (1.0));
00031     SO_KIT_ADD_FIELD (dz, (1.0));
00032     SO_KIT_ADD_CATALOG_ENTRY (faces, SoIndexedFaceSet, FALSE, separator,\x0, TRUE);
00033     SO_KIT_INIT_INSTANCE ();
00034     setUpConnections (true, true);
00035 }


Member Function Documentation

void IgSoG4Trd::initClass ( void   )  [static]

Reimplemented from IgSoShapeKit.

Definition at line 21 of file IgSoG4Trd.cc.

Referenced by initNodes(), and initShapes().

00022 { SO_KIT_INIT_CLASS (IgSoG4Trd, IgSoShapeKit, "IgSoShapeKit"); }

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

Reimplemented from IgSoShapeKit.

Definition at line 38 of file IgSoG4Trd.cc.

References funct::cos(), dx1, dx2, dy1, dy2, dz, i, and funct::sin().

00039 {
00040     // FIXME: Only do non-zero faces
00041 
00042     static const int    NPOINTS = 8;
00043     static const int    NFACES = 6;
00044     static const int    NINDICES = NFACES*5;
00045 
00046     SoIndexedFaceSet    *faces = new SoIndexedFaceSet;
00047     SoVertexProperty    *vtx = new SoVertexProperty;
00048 
00049     // Indices for the eight faces
00050     static const int    indices [NINDICES] = {
00051         3,2,1,0, SO_END_FACE_INDEX, // bottom
00052         4,5,6,7, SO_END_FACE_INDEX, // top
00053         0,1,5,4, SO_END_FACE_INDEX, 
00054         1,2,6,5, SO_END_FACE_INDEX,
00055         2,3,7,6, SO_END_FACE_INDEX,
00056         3,0,4,7, SO_END_FACE_INDEX
00057     };
00058 
00059     float               points [NPOINTS][3] = {
00060         {  dx1.getValue (),  dy1.getValue (), -dz.getValue () },
00061         { -dx1.getValue (),  dy1.getValue (), -dz.getValue () },
00062         { -dx1.getValue (), -dy1.getValue (), -dz.getValue () },
00063         {  dx1.getValue (), -dy1.getValue (), -dz.getValue () },
00064         {  dx2.getValue (),  dy2.getValue (),  dz.getValue () },
00065         { -dx2.getValue (),  dy2.getValue (),  dz.getValue () },
00066         { -dx2.getValue (), -dy2.getValue (),  dz.getValue () },
00067         {  dx2.getValue (), -dy2.getValue (),  dz.getValue () }
00068     };
00069 
00070     float t1 = atan ((dx2.getValue ()-dx1.getValue ()) / (2*dz.getValue ()));
00071     float t2 = atan ((dy2.getValue ()-dy1.getValue ()) / (2*dz.getValue ()));
00072     float st1 = sin (t1);
00073     float st2 = sin (t2);
00074     float ct1 = cos (t1);
00075     float ct2 = cos (t2);
00076 
00077     float               normals [NFACES][3] = {
00078         {    0,    0,   -1 },
00079         {    0,    0,    1 },
00080         {    0,  ct2, -st2 },
00081         { -ct1,    0, -st1 },
00082         {    0, -ct2, -st2 },
00083         {  ct1,    0, -st1 }
00084     };
00085 
00086     for (int i = 0; i < NPOINTS; ++i)
00087         vtx->vertex.set1Value (i, points[i][0], points[i][1], points[i][2]);
00088 
00089     for (int i = 0; i < NFACES; ++i)
00090         vtx->normal.set1Value (i, normals[i][0], normals[i][1], normals[i][2]);
00091 
00092     vtx->normalBinding = SoVertexProperty::PER_FACE;
00093     faces->coordIndex.setValues (0, NINDICES, indices);
00094     faces->vertexProperty = vtx;
00095 
00096     // Set parts
00097     setPart ("faces", faces);
00098 }

IgSoG4Trd::SO_KIT_CATALOG_ENTRY_HEADER ( faces   )  [private]

IgSoG4Trd::SO_KIT_HEADER ( IgSoG4Trd   )  [private]


Member Data Documentation

SoSFFloat IgSoG4Trd::dx1

Definition at line 37 of file IgSoG4Trd.h.

Referenced by VisG4VisSceneHandler::AddSolid(), IgSoG4Trd(), and refresh().

SoSFFloat IgSoG4Trd::dx2

Definition at line 38 of file IgSoG4Trd.h.

Referenced by VisG4VisSceneHandler::AddSolid(), IgSoG4Trd(), and refresh().

SoSFFloat IgSoG4Trd::dy1

Definition at line 39 of file IgSoG4Trd.h.

Referenced by VisG4VisSceneHandler::AddSolid(), IgSoG4Trd(), and refresh().

SoSFFloat IgSoG4Trd::dy2

Definition at line 40 of file IgSoG4Trd.h.

Referenced by VisG4VisSceneHandler::AddSolid(), IgSoG4Trd(), and refresh().

SoSFFloat IgSoG4Trd::dz

Definition at line 41 of file IgSoG4Trd.h.

Referenced by VisG4VisSceneHandler::AddSolid(), IgSoG4Trd(), and refresh().


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