OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::OutsideMarker Class Reference

This class will mark vertices of a mesh, which are visible from far away (from outside). More...

#include <OgreOutsideMarker.h>

+ Collaboration diagram for Ogre::OutsideMarker:

Classes

struct  CHTriangle
 

Public Member Functions

 OutsideMarker (ProgressiveMeshGenerator::VertexList &vertexList, Real boundingSphereRadius, Real walkAngle, int step)
 
MeshPtr createConvexHullMesh (const String &meshName, const String &resourceGroupName=ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)
 Mark vertices, which are visible from outside. More...
 
void markOutside ()
 

Private Types

typedef std::vector< std::pair
< CHVertex *, CHVertex * > > 
CHEdgeList
 
typedef std::vector< CHTriangleCHTriangleList
 
typedef std::vector< CHTriangle * > CHTrianglePList
 
typedef
ProgressiveMeshGenerator::PMVertex 
CHVertex
 Returns a mesh containing the Convex Hull shape. More...
 

Private Member Functions

void addEdge (CHEdgeList &edges, CHVertex *a, CHVertex *b)
 Adds vertex to hull. More...
 
template<typename T >
void addHullTriangleVertices (std::vector< CHVertex * > &stack, T tri)
 if we have the convex hull, this will walk on the faces which have less then 90 degree difference. More...
 
int addVertex (CHVertex *vertex)
 Generates the hull. More...
 
void cleanHull ()
 Add edge to the list of removable edges. More...
 
void createTriangle (CHVertex *v1, CHVertex *v2, CHVertex *v3)
 Initializes the hull for expansion. More...
 
void fillHorizon (CHEdgeList &e, CHVertex *target)
 Removes edges, which are not on the horizon. More...
 
void generateHull ()
 
CHVertexgetFurthestVertex (CHTriangle *hull)
 Whether face is visible from point. More...
 
void getHorizon (const CHTrianglePList &tri, CHEdgeList &)
 Adds visible edges to the list, when viewing from target point. More...
 
Real getPointToLineSqraredDistance (CHVertex *x1, CHVertex *x2, CHVertex *vertex)
 
Real getTetrahedronVolume (CHVertex *v0, CHVertex *v1, CHVertex *v2, CHVertex *v3)
 Sets the vertices of a triangle (called from initHull only). More...
 
void getVisibleTriangles (const CHVertex *target, CHTrianglePList &visibleTriangles)
 Gets furthest vertex from face. More...
 
void initHull ()
 
bool isInsideLine (const Vector3 &ptarget, const Vector3 &p0, const Vector3 &p1)
 Whether the vertex is inside the triangle. We assume that it is on the same plane. More...
 
bool isInsideTriangle (const Vector3 &ptarget, const CHTriangle &tri)
 
bool isSamePosition (const Vector3 &p0, const Vector3 &p1)
 Whether ptarget is between p0 and p1. Assuming they are on the same line. More...
 
bool isVisible (CHTriangle *triangle, Vector3 &vertex)
 Removes Triangles, which are having CHTriangle::removed = true. More...
 
void markVertices ()
 Caps the hole with faces connecting to target vertex. More...
 
Real pointToLineDir (const Vector3 &ptarget, const Vector3 &p0, const Vector3 &p1, const Vector3 &p2, const Vector3 &n)
 Add triangle to stack (called from markVertices only). More...
 

Private Attributes

Vector3 mCentroid
 Source of input and output of the algorithm. More...
 
CHEdgeList mEdges
 Temporary vector for addVisibleEdges function (prevent allocation every call). More...
 
const Real mEpsilon
 
CHTriangleList mHull
 Amount of allowed floating point error if 4 vertices are on the same plane. More...
 
int mStep
 Angle limit, when walking inside for marking vertices. More...
 
ProgressiveMeshGenerator::VertexList & mVertexListOrig
 Temporary vector for the horizon edges, when inserting a new vertex into the hull. More...
 
CHTrianglePList mVisibleTriangles
 Contains the current triangles of the convex hull. More...
 
Real mWalkAngle
 Centroid of the convex hull. More...
 

Detailed Description

This class will mark vertices of a mesh, which are visible from far away (from outside).

Triangle is visible if each vertex of it is visible.

Definition at line 41 of file OgreOutsideMarker.h.

Member Typedef Documentation

typedef std::vector<std::pair<CHVertex*, CHVertex*> > Ogre::OutsideMarker::CHEdgeList
private

Definition at line 66 of file OgreOutsideMarker.h.

typedef std::vector<CHTriangle> Ogre::OutsideMarker::CHTriangleList
private

Definition at line 64 of file OgreOutsideMarker.h.

typedef std::vector<CHTriangle*> Ogre::OutsideMarker::CHTrianglePList
private

Definition at line 65 of file OgreOutsideMarker.h.

typedef ProgressiveMeshGenerator::PMVertex Ogre::OutsideMarker::CHVertex
private

Returns a mesh containing the Convex Hull shape.

Definition at line 55 of file OgreOutsideMarker.h.

Constructor & Destructor Documentation

Ogre::OutsideMarker::OutsideMarker ( ProgressiveMeshGenerator::VertexList &  vertexList,
Real  boundingSphereRadius,
Real  walkAngle,
int  step 
)
Parameters
vertexListList of vertices. vertex.position is the input and vertex.isOuterWallVertex is the output of the algorithm.
walkAngleWalk angle in dot product values. Allowed range is from -1 to 1. Default = 0. Smaller value is bigger angle. If you set it to 1 then you can disable walking and it will only mark the vertices on the convex hull.

Member Function Documentation

void Ogre::OutsideMarker::addEdge ( CHEdgeList edges,
CHVertex a,
CHVertex b 
)
private

Adds vertex to hull.

template<typename T >
void Ogre::OutsideMarker::addHullTriangleVertices ( std::vector< CHVertex * > &  stack,
tri 
)
private

if we have the convex hull, this will walk on the faces which have less then 90 degree difference.

int Ogre::OutsideMarker::addVertex ( CHVertex vertex)
private

Generates the hull.

void Ogre::OutsideMarker::cleanHull ( )
private

Add edge to the list of removable edges.

MeshPtr Ogre::OutsideMarker::createConvexHullMesh ( const String meshName,
const String resourceGroupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME 
)

Mark vertices, which are visible from outside.

void Ogre::OutsideMarker::createTriangle ( CHVertex v1,
CHVertex v2,
CHVertex v3 
)
private

Initializes the hull for expansion.

void Ogre::OutsideMarker::fillHorizon ( CHEdgeList e,
CHVertex target 
)
private

Removes edges, which are not on the horizon.

void Ogre::OutsideMarker::generateHull ( )
private
CHVertex* Ogre::OutsideMarker::getFurthestVertex ( CHTriangle hull)
private

Whether face is visible from point.

void Ogre::OutsideMarker::getHorizon ( const CHTrianglePList tri,
CHEdgeList  
)
private

Adds visible edges to the list, when viewing from target point.

Real Ogre::OutsideMarker::getPointToLineSqraredDistance ( CHVertex x1,
CHVertex x2,
CHVertex vertex 
)
private
Real Ogre::OutsideMarker::getTetrahedronVolume ( CHVertex v0,
CHVertex v1,
CHVertex v2,
CHVertex v3 
)
private

Sets the vertices of a triangle (called from initHull only).

void Ogre::OutsideMarker::getVisibleTriangles ( const CHVertex target,
CHTrianglePList visibleTriangles 
)
private

Gets furthest vertex from face.

void Ogre::OutsideMarker::initHull ( )
private
bool Ogre::OutsideMarker::isInsideLine ( const Vector3 ptarget,
const Vector3 p0,
const Vector3 p1 
)
private

Whether the vertex is inside the triangle. We assume that it is on the same plane.

bool Ogre::OutsideMarker::isInsideTriangle ( const Vector3 ptarget,
const CHTriangle tri 
)
private
bool Ogre::OutsideMarker::isSamePosition ( const Vector3 p0,
const Vector3 p1 
)
private

Whether ptarget is between p0 and p1. Assuming they are on the same line.

bool Ogre::OutsideMarker::isVisible ( CHTriangle triangle,
Vector3 vertex 
)
private

Removes Triangles, which are having CHTriangle::removed = true.

void Ogre::OutsideMarker::markOutside ( )
void Ogre::OutsideMarker::markVertices ( )
private

Caps the hole with faces connecting to target vertex.

Real Ogre::OutsideMarker::pointToLineDir ( const Vector3 ptarget,
const Vector3 p0,
const Vector3 p1,
const Vector3 p2,
const Vector3 n 
)
private

Add triangle to stack (called from markVertices only).

Determines whether ptarget is on the same side of the p0-p1 line as p2. Assuming each point is on the same plane.

Member Data Documentation

Vector3 Ogre::OutsideMarker::mCentroid
private

Source of input and output of the algorithm.

Definition at line 73 of file OgreOutsideMarker.h.

CHEdgeList Ogre::OutsideMarker::mEdges
private

Temporary vector for addVisibleEdges function (prevent allocation every call).

Definition at line 71 of file OgreOutsideMarker.h.

const Real Ogre::OutsideMarker::mEpsilon
private

Definition at line 68 of file OgreOutsideMarker.h.

CHTriangleList Ogre::OutsideMarker::mHull
private

Amount of allowed floating point error if 4 vertices are on the same plane.

Definition at line 69 of file OgreOutsideMarker.h.

int Ogre::OutsideMarker::mStep
private

Angle limit, when walking inside for marking vertices.

Definition at line 75 of file OgreOutsideMarker.h.

ProgressiveMeshGenerator::VertexList& Ogre::OutsideMarker::mVertexListOrig
private

Temporary vector for the horizon edges, when inserting a new vertex into the hull.

Definition at line 72 of file OgreOutsideMarker.h.

CHTrianglePList Ogre::OutsideMarker::mVisibleTriangles
private

Contains the current triangles of the convex hull.

Definition at line 70 of file OgreOutsideMarker.h.

Real Ogre::OutsideMarker::mWalkAngle
private

Centroid of the convex hull.

Definition at line 74 of file OgreOutsideMarker.h.


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