MyNormalVisitor Class Reference
#include <MyNormalVisitor.h>
List of all members.
Public Types | 
| enum   | GenerateMethods {  
  MWE = 0, 
MWA, 
MWSELR, 
MWAAT, 
 
  MWELR, 
MWSRELR
 
 } | 
Public Member Functions | 
|   | MyNormalVisitor (int method=MWE, bool flip=false) | 
| virtual  | ~MyNormalVisitor () | 
| void  | setMethod (int m) | 
| int  | getMethod () const  | 
| void  | setThreshold (double t) | 
| double  | getThreshold () const  | 
| virtual void  | apply (osg::Geode &geode) | 
Static Public Member Functions | 
| static void  | buildNormal (osg::Geometry &geoset, bool flip=false, int method=MWE, double threshold=1e-6) | 
| static void  | buildNormalZ (osg::Geometry &geoset, bool flip=false, int method=MWE, double threshold=1e-6) | 
Public Attributes | 
| int  | done | 
Static Protected Member Functions | 
| static bool  | checkPrimitives (osg::Geometry &geom) | 
Protected Attributes | 
| double  | _threshold | 
| int  | _method | 
| bool  | _flip | 
Member Enumeration Documentation
- Enumerator: 
 
| MWE  | 
 | 
| MWA  | 
 | 
| MWSELR  | 
 | 
| MWAAT  | 
 | 
| MWELR  | 
 | 
| MWSRELR  | 
 | 
 
 
 
Constructor & Destructor Documentation
      
        
          | MyNormalVisitor::MyNormalVisitor  | 
          ( | 
          int  | 
           method = MWE,  | 
        
        
           | 
           | 
          bool  | 
           flip = false |   | 
        
        
           | 
          ) | 
           |  |  | 
        
      
 
 
      
        
          | MyNormalVisitor::~MyNormalVisitor  | 
          ( | 
           | 
           )  | 
           [virtual] | 
        
      
 
 
Member Function Documentation
      
        
          | void MyNormalVisitor::apply  | 
          ( | 
          osg::Geode &  | 
           geode | 
           )  | 
           [virtual] | 
        
      
 
 
      
        
          | void MyNormalVisitor::buildNormal  | 
          ( | 
          osg::Geometry &  | 
           geoset,  | 
        
        
           | 
           | 
          bool  | 
           flip = false,  | 
        
        
           | 
           | 
          int  | 
           method = MWE,  | 
        
        
           | 
           | 
          double  | 
           threshold = 1e-6 |   | 
        
        
           | 
          ) | 
           |  |  [static] | 
        
      
 
Create normals for geometry. 
 
 
      
        
          | void MyNormalVisitor::buildNormalZ  | 
          ( | 
          osg::Geometry &  | 
           geoset,  | 
        
        
           | 
           | 
          bool  | 
           flip = false,  | 
        
        
           | 
           | 
          int  | 
           method = MWE,  | 
        
        
           | 
           | 
          double  | 
           threshold = 1e-6 |   | 
        
        
           | 
          ) | 
           |  |  [static] | 
        
      
 
 
      
        
          | bool MyNormalVisitor::checkPrimitives  | 
          ( | 
          osg::Geometry &  | 
           geom | 
           )  | 
           [static, protected] | 
        
      
 
 
      
        
          | int MyNormalVisitor::getMethod  | 
          ( | 
           | 
           )  | 
           const [inline] | 
        
      
 
 
      
        
          | double MyNormalVisitor::getThreshold  | 
          ( | 
           | 
           )  | 
           const [inline] | 
        
      
 
 
      
        
          | void MyNormalVisitor::setMethod  | 
          ( | 
          int  | 
           m | 
           )  | 
           [inline] | 
        
      
 
Set normal algorithm to use. There are 6 methods at present:
- MWE: "Mean Weighted Equally" (Henri Gouraud, 1971), also known as the smoothing normal.
 
- MWA: "Mean Weighted by Angle" (Thurmer and Wuthrich, 1998).
 
- MWSELR: "Mean Weighted by Sine and Edge Length Reciprocals" (Max, 1999).
 
- MWAAT: "Mean Weighted by Areas of Adjacent Triangles" (Max, 1999).
 
- MWELR: "Mean Weighted by Edge Length Reciprocals" (Max, 1999).
 
- MWSRELR: "Mean Weighted by Square Root of Edge Length Reciprocals" (Max, 1999). 
 
 
 
      
        
          | void MyNormalVisitor::setThreshold  | 
          ( | 
          double  | 
           t | 
           )  | 
           [inline] | 
        
      
 
Set a threshold to decide whether to include a triangle's for calculating. The threshold will be compared with the dot product of normals of 2 triangles sharing same vertex, and the normal will be included in the averaging if the dot product greater than the threshold. A corner vertex of a sharp crease (with a cosine 90 degree) will not be smoothing then. If you want a totally smooth geometry, just set the threshold to be greater than 1. 
 
 
Member Data Documentation
The documentation for this class was generated from the following files:
- C:/Users/Robert/Documents/Visual Studio 2008/Projects/ferprojekt/TerrainEditor/TerrainEditor/MyNormalVisitor.h
 
- C:/Users/Robert/Documents/Visual Studio 2008/Projects/ferprojekt/TerrainEditor/TerrainEditor/MyNormalVisitor.cpp