Changeset 1976


Ignore:
Timestamp:
01/14/07 23:19:32 (17 years ago)
Author:
mattausch
Message:

valid function for degenerated obj-triangles

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r1974 r1976  
    13111311                 "1.5"); 
    13121312 
     1313        RegisterOption("GvsPreprocessor.perViewCell", 
     1314                optBool, 
     1315                "gvs_per_viewcell=", 
     1316                "false"); 
     1317 
    13131318        RegisterOption("GvsPreprocessor.stats", 
    13141319                                        optString, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r1935 r1976  
    3636        Environment::GetSingleton()->GetFloatValue("GvsPreprocessor.epsilon", mEps); 
    3737        Environment::GetSingleton()->GetFloatValue("GvsPreprocessor.threshold", mThreshold);     
     38        Environment::GetSingleton()->GetBoolValue("GvsPreprocessor.UsePerViewCellSampling", mPerViewCell); 
    3839 
    3940        char gvsStatsLog[100]; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r1934 r1976  
    199199        GvsStatistics mGvsStats; 
    200200 
     201        bool mPerViewCell; 
    201202        bool mOnlyRandomSampling; 
    202203}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp

    r1973 r1976  
    33#include <list> 
    44#include <map> 
     5#include <math.h> 
     6 
    57using namespace std; 
    68 
     
    2224#define ROTATE_SCENE 0 
    2325 
     26// hack: define this as in the intel ray tracer 
     27#define FLT_EPSILON 1.192092896e-07f 
     28 
    2429// HACK 
    2530static void RotateMesh(Mesh *mesh) 
     
    188193bool TriangleValid(const Triangle3 &triangle) 
    189194{ 
    190         /*int i; 
    191         int good_triangles = 0; 
    192         int ntriangles = tri.GetSize(); 
    193  
    194         for (i = 0; i < ntriangles; i++) { 
    195                 int ti = tri[i]; 
    196                 RTVec3f v[3]; 
    197                 get_triangle(m_tree, v, tri[i]); 
    198                 if ((v[0]-v[1]).Cross(v[0]-v[2]).LengthSquared() <= 0.000001*FLT_EPSILON*FLT_EPSILON) { 
    199                         // v0, v1 & v2 lays on a line (area == 0) 
    200                         tri[i] = -1; 
    201                         continue; 
    202                 } 
    203                 good_triangles++; 
    204         }*/ 
    205  
    206         return false; 
    207 } 
     195        const Vector3 a = triangle.mVertices[0] - triangle.mVertices[1]; 
     196        const Vector3 b = triangle.mVertices[0] - triangle.mVertices[2]; 
     197        const Vector3 cross_a_b = CrossProd(a, b); 
     198 
     199        if (SqrMagnitude(cross_a_b) <= 0.000001 * FLT_EPSILON * FLT_EPSILON)  
     200        { 
     201                // v0, v1 & v2 lays on a line (area == 0) 
     202                return false; 
     203        } 
     204 
     205        return true; 
     206} 
     207 
    208208 
    209209bool ObjParser::ParseFile(const string filename, 
  • GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp

    r1974 r1976  
    732732  // set this values for last contributingRays 
    733733  int index = mBufferStart - 1; 
    734   int i; 
    735   for (i=0; i < contributingRays; i++, index--) { 
     734   
     735  for (int i=0; i < contributingRays; i++, index--) { 
    736736        if (index < 0) 
    737737          index = mRays.size()-1; 
     
    742742  // compute cdf 
    743743  mRays[0].mCdf = mRays[0].mImportance/(mRays[0].mSamples+1); 
    744   for (i=1; i < mRays.size(); i++)  
     744  for (int i=1; i < mRays.size(); i++)  
    745745        mRays[i].mCdf = mRays[i-1].mCdf + mRays[i].mImportance/(mRays[i].mSamples+1); 
    746746   
Note: See TracChangeset for help on using the changeset viewer.