Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::DVRSlice Class Reference

#include <OSGDVRSlice.h>

List of all members.

Public Member Functions

 DVRSlice (void)
 Constructor.
 ~DVRSlice (void)
 Destructor.
void setVertex (Pnt3f vertex)
 set a new vertex
Pnt3f getVertex (UInt32 number)
 get a vertex
UInt32 getVertexCount (void)
 get number of set vertices
void setNormal (Vec3f normal)
void resetSlice ()
 reset the slice's data
Vec3f getNormal (void)
void setTextureTransform (const Vec3f &scale, const Vec3f &translate)
Vec3f getTextureScale (void) const
 Get the scale parameters used to create texture coordinates from.
Vec3f getTextureTranslate (void) const
 Get the translation parameters used to create texture coordinates.
void output (void)

Private Attributes

UInt32 numberOfVertices
 the number of vertices currently stored
Pnt3fvertexData
 the vertex data, each slice can have max. 6 vertices
Vec3f normal
 the normal of this slice
Vec3f texScale
Vec3f texTranslate


Detailed Description

Definition at line 8 of file OSGDVRSlice.h.


Constructor & Destructor Documentation

DVRSlice::DVRSlice void   ) 
 

Definition at line 9 of file OSGDVRSlice.cpp.

References normal, numberOfVertices, and vertexData.

00010 {
00011     // initialize member variables
00012     numberOfVertices = 0;
00013     normal           = Vec3f(0.0,0.0,0.0);
00014     vertexData       = new Pnt3f[12];
00015 }

DVRSlice::~DVRSlice void   ) 
 

Definition at line 17 of file OSGDVRSlice.cpp.

References vertexData.

00018 {
00019     // cleanup
00020     delete [] vertexData;
00021 }


Member Function Documentation

void DVRSlice::setVertex Pnt3f  vertex  ) 
 

Definition at line 33 of file OSGDVRSlice.cpp.

References numberOfVertices, and vertexData.

Referenced by osg::Brick::render2DSliceXY(), osg::Brick::render2DSliceXZ(), osg::Brick::render2DSliceYZ(), and osg::Brick::render3DSlices().

00034 {
00035     vertexData[numberOfVertices] = vertex;
00036     numberOfVertices++;
00037 }

Pnt3f DVRSlice::getVertex UInt32  number  ) 
 

Definition at line 23 of file OSGDVRSlice.cpp.

References vertexData.

Referenced by osg::DVRClipper::clipSlice().

00024 {
00025     return vertexData[number];
00026 }

UInt32 DVRSlice::getVertexCount void   ) 
 

Definition at line 28 of file OSGDVRSlice.cpp.

References numberOfVertices.

Referenced by osg::DVRClipper::clipSlice().

00029 {
00030     return numberOfVertices;
00031 }

void DVRSlice::setNormal Vec3f  normal  ) 
 

Set the slice's normal

Definition at line 39 of file OSGDVRSlice.cpp.

References normal.

Referenced by osg::Brick::render2DSliceXY(), osg::Brick::render2DSliceXZ(), osg::Brick::render2DSliceYZ(), and osg::Brick::render3DSlices().

00040 {
00041     normal = n;
00042 }

void DVRSlice::resetSlice  ) 
 

Definition at line 59 of file OSGDVRSlice.cpp.

References normal, and numberOfVertices.

Referenced by osg::Brick::render2DSliceXY(), osg::Brick::render2DSliceXZ(), osg::Brick::render2DSliceYZ(), and osg::Brick::render3DSlices().

00060 {
00061     numberOfVertices = 0;
00062     normal           = Vec3f(0.0, 0.0, 0.0);
00063 }

Vec3f DVRSlice::getNormal void   ) 
 

Returns the slice's normal. Returns 0 iff no normal is set and there is insufficient information to calculate the normal (at least three vertices set).

Definition at line 44 of file OSGDVRSlice.cpp.

References osg::VectorInterface< ValueTypeT, StorageInterfaceT >::cross(), normal, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), numberOfVertices, and vertexData.

Referenced by output().

00045 {
00046   // if no normal is set, we can compute it, if we have at least
00047   // three vertices. Otherwise the currently set normal is returned.
00048     if(normal == Vec3f(0.0, 0.0, 0.0) && numberOfVertices >= 3)
00049     {
00050         normal = (vertexData[0] - vertexData[1]).cross(
00051             vertexData[0] - vertexData[2]);
00052 
00053         normal.normalize();
00054     }
00055 
00056     return normal;
00057 }

void DVRSlice::setTextureTransform const Vec3f scale,
const Vec3f translate
 

Set the transformation parameters used to create texture coordinates from vertex positions

Definition at line 65 of file OSGDVRSlice.cpp.

References texScale, and texTranslate.

Referenced by osg::Brick::render2DMultiSlices(), osg::Brick::render2DSlices(), and osg::Brick::render3DSlices().

00066 {
00067     texScale     = scale;
00068     texTranslate = translate;
00069 }

Vec3f DVRSlice::getTextureScale void   )  const
 

Definition at line 71 of file OSGDVRSlice.cpp.

References texScale.

Referenced by osg::DVRClipper::clipSlice().

00072 {
00073     return texScale;
00074 }

Vec3f DVRSlice::getTextureTranslate void   )  const
 

Definition at line 76 of file OSGDVRSlice.cpp.

References texTranslate.

Referenced by osg::DVRClipper::clipSlice().

00077 {
00078     return texTranslate;
00079 }

void DVRSlice::output void   ) 
 

Definition at line 81 of file OSGDVRSlice.cpp.

References getNormal(), numberOfVertices, and vertexData.

00082 {
00083     for(UInt32 i = 0; i < numberOfVertices; i++)
00084     {
00085         std::cerr << "Vertex Number " 
00086                   << i
00087                   << ": " 
00088                   << vertexData[i][0] 
00089                   << ", "
00090                   << vertexData[i][1] 
00091                   << ", "
00092                   << vertexData[i][2] 
00093                   << std::endl;
00094     }
00095 
00096     Vec3f n = getNormal();
00097 
00098     std::cerr << "Normal: " 
00099               << n[0] 
00100               << ", " 
00101               << n[1] 
00102               << ", " 
00103               << n[2] 
00104               << std::endl;
00105 }


Member Data Documentation

UInt32 osg::DVRSlice::numberOfVertices [private]
 

Definition at line 56 of file OSGDVRSlice.h.

Referenced by DVRSlice(), getNormal(), getVertexCount(), output(), resetSlice(), and setVertex().

Pnt3f* osg::DVRSlice::vertexData [private]
 

Definition at line 59 of file OSGDVRSlice.h.

Referenced by DVRSlice(), getNormal(), getVertex(), output(), setVertex(), and ~DVRSlice().

Vec3f osg::DVRSlice::normal [private]
 

Definition at line 62 of file OSGDVRSlice.h.

Referenced by DVRSlice(), getNormal(), resetSlice(), and setNormal().

Vec3f osg::DVRSlice::texScale [private]
 

the scale parameter used to create texture coordinates from vertex positions

Definition at line 66 of file OSGDVRSlice.h.

Referenced by getTextureScale(), and setTextureTransform().

Vec3f osg::DVRSlice::texTranslate [private]
 

the translation parameter used to create texture coordinates from vertex positions

Definition at line 70 of file OSGDVRSlice.h.

Referenced by getTextureTranslate(), and setTextureTransform().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:16:45 2005 for OpenSG by  doxygen 1.4.3