TridSketch3Prism Class Reference

#include <TridSketches.h>

Inheritance diagram for TridSketch3Prism:
TridSketch

List of all members.

Public Member Functions

 TridSketch3Prism (void)
 TridSketch3Prism (const TVector3 &p0, const TVector3 &p1, const TVector3 &p2, const TVector3 &p3, const TVector3 &p4, const TVector3 &p5)
 TridSketch3Prism (const TVector3 &x0, const TVector3 &v1, float half_length, const TVector3 &v2, float half_width, const TVector3 &v3, float half_depth, bool up, bool right)
 ~TridSketch3Prism (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 [6]

Detailed Description

Definition at line 187 of file TridSketches.h.


Constructor & Destructor Documentation

TridSketch3Prism::TridSketch3Prism ( void   ) 

Definition at line 357 of file TridSketches.cxx.

00358   : TridSketch( k3Prism, TVector3() )
00359 {
00360   //
00361   // Default constructor for a box.
00362   //
00363   cout << "TridSketch3Prism:: Wrong constructor!" << endl;
00364   for(int i=0;i<8;i++) {
00365     cout << "3Prism " << fId << "\t" << i << "\t" << p[i].x() << "\t" << p[i].y() << "\t" << p[i].z() << endl;
00366   }
00367 }

TridSketch3Prism::TridSketch3Prism ( const TVector3 &  p0,
const TVector3 &  p1,
const TVector3 &  p2,
const TVector3 &  p3,
const TVector3 &  p4,
const TVector3 &  p5 
)

Definition at line 369 of file TridSketches.cxx.

References p.

00371   : TridSketch( k3Prism, (p0+p1+p2+p3+p4+p5)*(1.0/6.0) )
00372 {
00373   //
00374   // Defines a box using the 8 corner vertices.
00375   // Note that the corner vertices must be in order:
00376   // top-nw top-ne top-se top-sw bottom-nw bottom-ne bottom-se,bottom-sw
00377   //
00378   p[0] = p0;
00379   p[1] = p1;
00380   p[2] = p2;
00381   p[3] = p3;
00382   p[4] = p4;
00383   p[5] = p5;
00384 }

TridSketch3Prism::TridSketch3Prism ( const TVector3 &  x0,
const TVector3 &  v1,
float  half_length,
const TVector3 &  v2,
float  half_width,
const TVector3 &  v3,
float  half_depth,
bool  up,
bool  right 
)

Definition at line 386 of file TridSketches.cxx.

References p.

00391   : TridSketch( k3Prism, x0 )
00392 {
00393   //
00394   // Defines a box the center, the 3 normal vectors, and a set of half-widths.
00395   //
00396   // Adjust which corner of the box is cut off.
00397   if(up)    half_length = -half_length;
00398   if(right) half_width  = -half_width;
00399 
00400   p[0] = x0 - v1*half_length - v2*half_width - v3*half_depth;  
00401   p[1] = x0 + v1*half_length - v2*half_width - v3*half_depth;
00402   p[2] = x0 + v1*half_length + v2*half_width - v3*half_depth;
00403 
00404   p[3] = x0 - v1*half_length - v2*half_width + v3*half_depth;
00405   p[4] = x0 + v1*half_length - v2*half_width + v3*half_depth;
00406   p[5] = x0 + v1*half_length + v2*half_width + v3*half_depth;
00407 }

TridSketch3Prism::~TridSketch3Prism ( void   )  [inline]

Definition at line 201 of file TridSketches.h.

00201 {};


Member Function Documentation

void TridSketch3Prism::DrawSelf ( void   )  [virtual]

Reimplemented from TridSketch.

Definition at line 410 of file TridSketches.cxx.

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

00411 {
00412   //
00413   // Draws a box in the current context.
00414   //
00415   glBegin(GL_TRIANGLES);
00416   
00417   GlVertexTVector(p[0]);  // Top face
00418   GlVertexTVector(p[1]);
00419   GlVertexTVector(p[2]);
00420   
00421   GlVertexTVector(p[3]);  // Bottom face
00422   GlVertexTVector(p[4]);
00423   GlVertexTVector(p[5]);
00424 
00425   glEnd();
00426 
00427   glBegin(GL_QUAD_STRIP);
00428 
00429   GlVertexTVector(p[0]);  // North face
00430   GlVertexTVector(p[3]);
00431   GlVertexTVector(p[1]);
00432   GlVertexTVector(p[4]);
00433 
00434   GlVertexTVector(p[2]);  // East face
00435   GlVertexTVector(p[5]);
00436   
00437   GlVertexTVector(p[0]);  // South
00438   GlVertexTVector(p[3]);
00439   
00440   glEnd();
00441   
00442   int error;
00443   while ((error = glGetError()) != GL_NO_ERROR)  
00444     MSG("TriD",Msg::kError) << "TridSketch3Prism::DrawSelf.  GL error: "
00445                             << "(" << error << ")"
00446                             <<  gluErrorString(error)
00447                             << endl;
00448 }

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

Reimplemented from TridSketch.

Definition at line 204 of file TridSketches.h.

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

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

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

Reimplemented from TridSketch.

Definition at line 203 of file TridSketches.h.

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

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


Member Data Documentation

TVector3 TridSketch3Prism::p[6]

Definition at line 190 of file TridSketches.h.

Referenced by DrawSelf(), and TridSketch3Prism().


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

Generated on 3 Dec 2018 for loon by  doxygen 1.6.1