CMS 3D CMS Logo

IgSoArrow Class Reference

An arrow has a cylindar and also a conical tip. More...

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

Inheritance diagram for IgSoArrow:

IgSoShapeKit

List of all members.

Public Member Functions

 IgSoArrow (void)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFVec3f tail
SoSFVec3f tip

Protected Member Functions

virtual void refresh (void)

Private Member Functions

 SO_KIT_CATALOG_ENTRY_HEADER (axisCone)
 SO_KIT_CATALOG_ENTRY_HEADER (cTranslation)
 SO_KIT_CATALOG_ENTRY_HEADER (axisCyl)
 SO_KIT_CATALOG_ENTRY_HEADER (zTranslation)
 SO_KIT_CATALOG_ENTRY_HEADER (rot)
 SO_KIT_CATALOG_ENTRY_HEADER (myRotation)
 SO_KIT_CATALOG_ENTRY_HEADER (scale)
 SO_KIT_CATALOG_ENTRY_HEADER (finalTranslation)
 SO_KIT_HEADER (IgSoArrow)


Detailed Description

An arrow has a cylindar and also a conical tip.

It is suitable for representing vectors and the like.

Definition at line 21 of file IgSoArrow.h.


Constructor & Destructor Documentation

IgSoArrow::IgSoArrow ( void   ) 

Definition at line 28 of file IgSoArrow.cc.

References FALSE, rot, scale, IgSoShapeKit::setUpConnections(), tail, tip, and TRUE.

00029 {
00030     SO_KIT_CONSTRUCTOR (IgSoArrow);
00031 
00032     SO_KIT_ADD_FIELD (tail, (0, 0, 0));
00033     SO_KIT_ADD_FIELD (tip, (0, 1, 0));
00034 
00035     SO_KIT_ADD_CATALOG_ENTRY (finalTranslation, SoTranslation,  FALSE, separator,\x0, TRUE);
00036     SO_KIT_ADD_CATALOG_ENTRY (scale,            SoScale,        FALSE, separator,\x0, TRUE);
00037     SO_KIT_ADD_CATALOG_ENTRY (myRotation,       SoRotation,     FALSE, separator,\x0, TRUE);
00038     SO_KIT_ADD_CATALOG_ENTRY (rot,              SoRotationXYZ,  FALSE, separator,\x0, TRUE);
00039     SO_KIT_ADD_CATALOG_ENTRY (zTranslation,     SoTranslation,  FALSE, separator,\x0, TRUE);
00040     SO_KIT_ADD_CATALOG_ENTRY (axisCyl,          SoCylinder,     FALSE, separator,\x0, TRUE);
00041     SO_KIT_ADD_CATALOG_ENTRY (cTranslation,     SoTranslation,  FALSE, separator,\x0, TRUE);
00042     SO_KIT_ADD_CATALOG_ENTRY (axisCone,         SoCone,         FALSE, separator,\x0, TRUE);
00043     SO_KIT_INIT_INSTANCE ();
00044     setUpConnections (true, true);
00045 }


Member Function Documentation

void IgSoArrow::initClass ( void   )  [static]

Reimplemented from IgSoShapeKit.

Definition at line 25 of file IgSoArrow.cc.

Referenced by initNodes(), and initShapes().

00026 { SO_KIT_INIT_CLASS (IgSoArrow, IgSoShapeKit, "IgSoShapeKit"); }

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

Reimplemented from IgSoShapeKit.

Definition at line 48 of file IgSoArrow.cc.

References rot, scale, tail, tip, and X.

00049 {
00050     static const float  ARROWSIZE = 0.02;
00051     SoTranslation       *finalTranslation    = new SoTranslation;
00052     SoScale             *scale               = new SoScale;
00053     SoRotation          *myRotation          = new SoRotation;
00054     SoRotationXYZ       *rot                 = new SoRotationXYZ;
00055     SoTranslation       *zTranslation        = new SoTranslation;
00056     SoCylinder          *axisCyl             = new SoCylinder;
00057     SoTranslation       *cTranslation        = new SoTranslation;
00058     SoCone              *axisCone            = new SoCone;
00059     SbVec3f             mtail = tail.getValue ();
00060     SbVec3f             mtip  = tip.getValue ();
00061     SbVec3f             mdiff = mtip - mtail;
00062     double              length = mdiff.length ();
00063     SbVec3f             ax = SbVec3f (0, 0, 1).cross (mdiff);
00064     double              an = asin (ax.length () / length);
00065 
00066     if (mdiff[2] < 0)
00067         an = -an;
00068 
00069     finalTranslation->translation.setValue (mtail);
00070     scale->scaleFactor.setValue (length/2, length/2, length/2);
00071     myRotation->rotation.setValue (ax, an);
00072     zTranslation->translation.setValue (0, 1, 0);
00073     rot->axis = SoRotationXYZ::X;
00074     rot->angle = (mdiff[2] < 0) ? -M_PI/2. : M_PI/2.;
00075     axisCyl->radius.setValue (2 * ARROWSIZE);
00076     cTranslation->translation.setValue (0, 1, 0);
00077     axisCone->bottomRadius.setValue (4 * ARROWSIZE);
00078     axisCone->height.setValue (8 * ARROWSIZE);
00079 
00080     setPart ("finalTranslation", finalTranslation);
00081     setPart ("scale", scale);
00082     setPart ("myRotation", myRotation);
00083     setPart ("rot", rot);
00084     setPart ("zTranslation", zTranslation);
00085     setPart ("axisCyl", axisCyl);
00086     setPart ("cTranslation", cTranslation);
00087     setPart ("axisCone", axisCone);
00088 }

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( axisCone   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( cTranslation   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( axisCyl   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( zTranslation   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( rot   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( myRotation   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( scale   )  [private]

IgSoArrow::SO_KIT_CATALOG_ENTRY_HEADER ( finalTranslation   )  [private]

IgSoArrow::SO_KIT_HEADER ( IgSoArrow   )  [private]


Member Data Documentation

SoSFVec3f IgSoArrow::tail

Definition at line 38 of file IgSoArrow.h.

Referenced by IgSoArrow(), refresh(), VisTrajectorySeedTwig::update(), and VisGsfTrackTwig::update().

SoSFVec3f IgSoArrow::tip

Definition at line 37 of file IgSoArrow.h.

Referenced by IgSoArrow(), refresh(), VisTrajectorySeedTwig::update(), and VisGsfTrackTwig::update().


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