[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26857] branches/soc-2008-mxcurioni/source /blender/freestyle/intern: Further consolidation of the view map creation.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Feb 13 00:25:01 CET 2010


Revision: 26857
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26857
Author:   kjym3
Date:     2010-02-13 00:24:59 +0100 (Sat, 13 Feb 2010)

Log Message:
-----------
Further consolidation of the view map creation.

Made Controller::_EPSILON constant with the value 1e-6.  Previously,
the _EPSILON value was computed based on the minimum edge size within
the scene being rendered (in some cases, the computed value resulted
in zero).  This does not seem to make sense, because _EPSILON has been
used as a tolerance threshold of floating-point arithmetic errors
throughout the view map creation.  Since Blender uses single-precision
real values for mesh data representations, the new constant _EPSILON
value looks more adequate.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp	2010-02-12 22:13:47 UTC (rev 26856)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/application/Controller.cpp	2010-02-12 23:24:59 UTC (rev 26857)
@@ -97,6 +97,7 @@
   _ProgressBar = new ProgressBar;
   _SceneNumFaces = 0;
   _minEdgeSize = DBL_MAX;
+  _EPSILON = 1e-6;
   _bboxDiag = 0;
   
   _ViewMap = 0;
@@ -210,13 +211,8 @@
   if(loader.minEdgeSize() < _minEdgeSize)
     {
       _minEdgeSize = loader.minEdgeSize();
-      _EPSILON = _minEdgeSize*1e-6;
-      if(_EPSILON < DBL_MIN)
-	_EPSILON = 0.0;
     }
 
-  cout << "Epsilon computed : " << _EPSILON << endl;
-
   // DEBUG
   // ScenePrettyPrinter spp;
   // blenderScene->accept(spp);

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp	2010-02-12 22:13:47 UTC (rev 26856)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp	2010-02-12 23:24:59 UTC (rev 26857)
@@ -976,6 +976,21 @@
     if((Tb < -epsilon) || (Tb > 1+epsilon))
         cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - " << fB->vertexB()->getId() << endl;
 
+#if 0
+    if((Ta < -epsilon) || (Ta > 1+epsilon) || (Tb < -epsilon) || (Tb > 1+epsilon)) {
+        printf("ta %.12e\n", ta);
+        printf("tb %.12e\n", tb);
+        printf("a1 %e, %e -- b1 %e, %e\n", a1[0], a1[1], b1[0], b1[1]);
+        printf("a2 %e, %e -- b2 %e, %e\n", a2[0], a2[1], b2[0], b2[1]);
+        if((Ta < -epsilon) || (Ta > 1+epsilon))
+            printf("Ta %.12e\n", Ta);
+        if((Tb < -epsilon) || (Tb > 1+epsilon))
+            printf("Tb %.12e\n", Tb);
+        printf("A1 %e, %e, %e -- B1 %e, %e, %e\n", A1[0], A1[1], A1[2], B1[0], B1[1], B1[2]);
+        printf("A2 %e, %e, %e -- B2 %e, %e, %e\n", A2[0], A2[1], A2[2], B2[0], B2[1], B2[2]);
+    }
+#endif
+
     TVertex * tvertex = ioViewMap->CreateTVertex(Vec3r(A1 + Ta*(A2-A1)), Vec3r(a1 + ta*(a2-a1)), fA, 
                                                  Vec3r(B1 + Tb*(B2-B1)), Vec3r(b1 + tb*(b2-b1)), fB, id);
      





More information about the Bf-blender-cvs mailing list