osg::DVRVertex Class Reference

A single Vertex of the triangled clip geometry.

#include <OSGDVRVertex.h>

List of all members.

Public Member Functions

 DVRVertex (void)
 Construct a new vertex.
 DVRVertex (const DVRVertex &vertex)
 Copy.
 ~DVRVertex (void)
 Destructor.
void calculatePlaneDistance (const Plane &plane)
 calculates the distance of the vertex to a reference plane.
void calculatePlaneDistanceTransformed (const Plane &plane)
 calculates the distance of the vertex to a reference plane.
void calculatePlaneDistance (const Plane &plane, const Matrix &transform)
 calculates the distance of the vertex to a reference plane.
bool isBehindPlane (float dist2RefPlane, bool &switched)
bool isBehindPlane (float dist2RefPlane)
 returns true, iff dist2RefPlane ist bigger than this->refPlaneDistance
bool isCloser (float distance)
void dump (void) const
 Usefull for debugging.

Public Attributes

Pnt3f pos
 The vertex index in the parent geometry.
std::vector< Int32adjacentTriangles
 The adjacent triangles of this vertex.
bool behindPlane
Real32 refPlaneDistance
Pnt3f transformedPos
 The position of this vertex in volume coords.

Detailed Description

Definition at line 13 of file OSGDVRVertex.h.


Constructor & Destructor Documentation

DVRVertex::DVRVertex ( void   ) 

Definition at line 8 of file OSGDVRVertex.cpp.

References behindPlane, pos, refPlaneDistance, and transformedPos.

00009 {
00010     pos              = Pnt3f(0.0, 0.0, 0.0);
00011     transformedPos   = pos;
00012     behindPlane      = false;
00013     refPlaneDistance = 0.0; 
00014 }

DVRVertex::DVRVertex ( const DVRVertex vertex  ) 

Definition at line 16 of file OSGDVRVertex.cpp.

References adjacentTriangles, behindPlane, pos, refPlaneDistance, and transformedPos.

00017 {
00018     pos               = vertex.pos;
00019     transformedPos    = vertex.transformedPos;
00020     adjacentTriangles = vertex.adjacentTriangles;
00021     behindPlane       = vertex.behindPlane;
00022     refPlaneDistance  = vertex.refPlaneDistance; 
00023 }

DVRVertex::~DVRVertex ( void   ) 

Definition at line 25 of file OSGDVRVertex.cpp.

00026 {
00027 }


Member Function Documentation

void DVRVertex::calculatePlaneDistance ( const Plane plane  ) 

uses the vertex position

Definition at line 29 of file OSGDVRVertex.cpp.

References osg::Plane::distance(), pos, and refPlaneDistance.

00030 {
00031     // calculate distance to the reference plane
00032     refPlaneDistance = plane.distance(pos);
00033 }

void DVRVertex::calculatePlaneDistanceTransformed ( const Plane plane  ) 

uses the transformed vertex position

Definition at line 35 of file OSGDVRVertex.cpp.

References osg::Plane::distance(), refPlaneDistance, and transformedPos.

00036 {
00037     // calculate distance to the reference plane
00038     refPlaneDistance = plane.distance(transformedPos);
00039 }

void DVRVertex::calculatePlaneDistance ( const Plane plane,
const Matrix transform 
)

uses the vertex position transformed with 'transform'

Definition at line 41 of file OSGDVRVertex.cpp.

References osg::Plane::distance(), osg::TransformationMatrix< ValueTypeT >::multFull(), osg::TransformationMatrix< ValueTypeT >::multPntFullMatrix(), pos, and refPlaneDistance.

00043 {
00044     Pnt3f transPos;
00045 #ifndef OSG_2_PREP
00046     transform.multPntFullMatrix(pos, transPos);
00047 #else
00048     transform.multFull(pos, transPos);
00049 #endif
00050     
00051     // calculate distance to the reference plane
00052     refPlaneDistance = plane.distance(transPos);
00053 }

bool DVRVertex::isBehindPlane ( float  dist2RefPlane,
bool &  switched 
)

returns true, iff dist2RefPlane ist bigger than this->refPlaneDistance switched will be set, if the vertex was till yet in front of each of the tested planes

Definition at line 55 of file OSGDVRVertex.cpp.

References behindPlane, and refPlaneDistance.

Referenced by osg::DVRClipGeometry::updateActiveTriangles().

00056 {
00057     switched = false;
00058 
00059     if(dist2RefPlane > refPlaneDistance)
00060     {
00061         if(!behindPlane)
00062             switched = true;
00063 
00064         behindPlane = true;
00065 
00066         return true;
00067     }
00068 
00069     return false;
00070 }

bool DVRVertex::isBehindPlane ( float  dist2RefPlane  ) 

Definition at line 72 of file OSGDVRVertex.cpp.

References refPlaneDistance.

00073 {
00074     return (dist2RefPlane > refPlaneDistance);
00075 }

bool DVRVertex::isCloser ( float  distance  ) 

Returns true, if the vertex is closer to the ref plane than (distance). If not, the notMinimumValue flag is set to true.

One of the calculatePlaneDistance(..) functions has to be called before!

Definition at line 78 of file OSGDVRVertex.cpp.

References refPlaneDistance.

00079 {
00080     if(distance < refPlaneDistance)
00081     {
00082         return false;
00083     }
00084 
00085     if(distance == refPlaneDistance)
00086         return false;
00087 
00088     return true;
00089 }

void DVRVertex::dump ( void   )  const

Definition at line 92 of file OSGDVRVertex.cpp.

References adjacentTriangles, pos, and transformedPos.

00093 {
00094     std::cerr << "Pos=("
00095               << pos 
00096               << ") transformedPos=("
00097               << transformedPos 
00098               << ") Adj. Tris: ";
00099 
00100     for(UInt32 i = 0; i < adjacentTriangles.size(); i++)
00101     {
00102         std::cerr << adjacentTriangles[i] << " ";
00103     }
00104     std::cerr << std::endl;
00105 }


Member Data Documentation

Definition at line 75 of file OSGDVRVertex.h.

Referenced by DVRVertex(), isBehindPlane(), and osg::DVRClipGeometry::resetLocalData().

Definition at line 84 of file OSGDVRVertex.h.

Referenced by calculatePlaneDistanceTransformed(), dump(), and DVRVertex().


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

Generated on 8 Feb 2010 for OpenSG by  doxygen 1.6.1