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 >::multPntFullMatrix(), pos, and refPlaneDistance.

00043 {
00044     Pnt3f transPos;
00045     transform.multPntFullMatrix(pos, transPos);
00046     
00047     // calculate distance to the reference plane
00048     refPlaneDistance = plane.distance(transPos);
00049 }

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 51 of file OSGDVRVertex.cpp.

References behindPlane, and refPlaneDistance.

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

00052 {
00053     switched = false;
00054 
00055     if(dist2RefPlane > refPlaneDistance)
00056     {
00057         if(!behindPlane)
00058             switched = true;
00059 
00060         behindPlane = true;
00061 
00062         return true;
00063     }
00064 
00065     return false;
00066 }

bool DVRVertex::isBehindPlane ( float  dist2RefPlane  ) 

Definition at line 68 of file OSGDVRVertex.cpp.

References refPlaneDistance.

00069 {
00070     return (dist2RefPlane > refPlaneDistance);
00071 }

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 74 of file OSGDVRVertex.cpp.

References refPlaneDistance.

00075 {
00076     if(distance < refPlaneDistance)
00077     {
00078         return false;
00079     }
00080 
00081     if(distance == refPlaneDistance)
00082         return false;
00083 
00084     return true;
00085 }

void DVRVertex::dump ( void   )  const

Definition at line 88 of file OSGDVRVertex.cpp.

References adjacentTriangles, pos, and transformedPos.

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


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 Mon Mar 17 11:14:40 2008 for OpenSG by  doxygen 1.5.5