TridSketchBox Class Reference

#include <TridSketches.h>

Inheritance diagram for TridSketchBox:
TridSketch

List of all members.

Public Member Functions

 TridSketchBox (void)
 TridSketchBox (const TVector3 &p0, const TVector3 &p1, const TVector3 &p2, const TVector3 &p3, const TVector3 &p4, const TVector3 &p5, const TVector3 &p6, const TVector3 &p7)
 TridSketchBox (const TVector3 &x0, const TVector3 &v1, float half_length, const TVector3 &v2, float half_width, const TVector3 &v3, float half_depth)
 ~TridSketchBox (void)
void SetPoint (int ipoint, const TVector3 &pt)
void SetPoint (int ipoint, float x, float y, float z)
void DrawSelf (void)

Public Attributes

TVector3 p [8]

Detailed Description

Definition at line 165 of file TridSketches.h.


Constructor & Destructor Documentation

TridSketchBox::TridSketchBox ( void   ) 

Definition at line 256 of file TridSketches.cxx.

00257   : TridSketch( kBox, TVector3() )
00258 {
00259   //
00260   // Default constructor for a box.
00261   //
00262   cout << "TridSketchBox:: Wrong constructor!" << endl;
00263   for(int i=0;i<8;i++) {
00264     cout << "Box " << fId << "\t" << i << "\t" << p[i].x() << "\t" << p[i].y() << "\t" << p[i].z() << endl;
00265   }
00266 }

TridSketchBox::TridSketchBox ( const TVector3 &  p0,
const TVector3 &  p1,
const TVector3 &  p2,
const TVector3 &  p3,
const TVector3 &  p4,
const TVector3 &  p5,
const TVector3 &  p6,
const TVector3 &  p7 
)

Definition at line 268 of file TridSketches.cxx.

References p.

00270   : TridSketch( kBox, (p1+p2+p3+p4+p5+p6+p7)*(1.0/8.0) )
00271 {
00272   //
00273   // Defines a box using the 8 corner vertices.
00274   // Note that the corner vertices must be in order:
00275   // top-nw top-ne top-se top-sw bottom-nw bottom-ne bottom-se,bottom-sw
00276   //
00277   p[0] = p0;
00278   p[1] = p1;
00279   p[2] = p2;
00280   p[3] = p3;
00281   p[4] = p4;
00282   p[5] = p5;
00283   p[6] = p6;
00284   p[7] = p7;
00285 }

TridSketchBox::TridSketchBox ( const TVector3 &  x0,
const TVector3 &  v1,
float  half_length,
const TVector3 &  v2,
float  half_width,
const TVector3 &  v3,
float  half_depth 
)

Definition at line 287 of file TridSketches.cxx.

References p.

00290   : TridSketch( kBox, x0 )
00291 {
00292   //
00293   // Defines a box the center, the 3 normal vectors, and a set of half-widths.
00294   //
00295   p[0] = x0 + v1*half_length + v2*half_width + v3*half_depth;
00296   p[1] = x0 + v1*half_length - v2*half_width + v3*half_depth;
00297   p[2] = x0 + v1*half_length - v2*half_width - v3*half_depth;
00298   p[3] = x0 + v1*half_length + v2*half_width - v3*half_depth;
00299   p[4] = x0 - v1*half_length + v2*half_width + v3*half_depth;
00300   p[5] = x0 - v1*half_length - v2*half_width + v3*half_depth;
00301   p[6] = x0 - v1*half_length - v2*half_width - v3*half_depth;
00302   p[7] = x0 - v1*half_length + v2*half_width - v3*half_depth;
00303 }

TridSketchBox::~TridSketchBox ( void   )  [inline]

Definition at line 178 of file TridSketches.h.

00178 {};


Member Function Documentation

void TridSketchBox::DrawSelf ( void   )  [virtual]

Reimplemented from TridSketch.

Definition at line 306 of file TridSketches.cxx.

References TridSketch::GlVertexTVector(), Msg::kError, MSG, and p.

00307 {
00308   //
00309   // Draws a box in the current context.
00310   //
00311   glBegin(GL_QUADS);
00312   
00313   GlVertexTVector(p[0]);  // Top face
00314   GlVertexTVector(p[1]);
00315   GlVertexTVector(p[2]);
00316   GlVertexTVector(p[3]);
00317   
00318   GlVertexTVector(p[4]);  // Bottom face
00319   GlVertexTVector(p[5]);
00320   GlVertexTVector(p[6]);
00321   GlVertexTVector(p[7]);
00322 
00323   glEnd();
00324 
00325   glBegin(GL_QUAD_STRIP);
00326 
00327   GlVertexTVector(p[0]);  // North face
00328   GlVertexTVector(p[4]);
00329   GlVertexTVector(p[1]);
00330   GlVertexTVector(p[5]);
00331 
00332   GlVertexTVector(p[2]);  // East face
00333   GlVertexTVector(p[6]);
00334   
00335   GlVertexTVector(p[3]);  // South
00336   GlVertexTVector(p[7]);
00337   
00338   GlVertexTVector(p[0]);  // West
00339   GlVertexTVector(p[4]);
00340   
00341   glEnd();
00342   
00343   int error;
00344   while ((error = glGetError()) != GL_NO_ERROR)  
00345     MSG("TriD",Msg::kError) << "TridSketchBox::DrawSelf.  GL error: "
00346                             << "(" << error << ")"
00347                             <<  gluErrorString(error)
00348                             << endl;
00349 }

void TridSketchBox::SetPoint ( int  ipoint,
float  x,
float  y,
float  z 
) [inline, virtual]

Reimplemented from TridSketch.

Definition at line 181 of file TridSketches.h.

References TridSketchLine::p, and TridSketch::SetDirty().

00181 { p[ipoint].SetXYZ(x,y,z);  SetDirty();};

void TridSketchBox::SetPoint ( int  ipoint,
const TVector3 &  pt 
) [inline, virtual]

Reimplemented from TridSketch.

Definition at line 180 of file TridSketches.h.

References TridSketchLine::p, and TridSketch::SetDirty().

00180 { p[ipoint] = pt; SetDirty(); };


Member Data Documentation

TVector3 TridSketchBox::p[8]

Definition at line 168 of file TridSketches.h.

Referenced by DrawSelf(), and TridSketchBox().


The documentation for this class was generated from the following files:

Generated on 3 Oct 2018 for loon by  doxygen 1.6.1