[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31419] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/stroke/Curve.cpp: Fix for a bug in a CurvePoint constructor that caused a crash.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Tue Aug 17 16:09:55 CEST 2010


Revision: 31419
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31419
Author:   kjym3
Date:     2010-08-17 16:09:53 +0200 (Tue, 17 Aug 2010)

Log Message:
-----------
Fix for a bug in a CurvePoint constructor that caused a crash.
This bug was related to an instability issue of SamplingShader.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Curve.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Curve.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Curve.cpp	2010-08-17 13:34:30 UTC (rev 31418)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/stroke/Curve.cpp	2010-08-17 14:09:53 UTC (rev 31419)
@@ -62,6 +62,8 @@
 
 CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) 
 {
+  __A = 0;
+  __B = 0;
   float t1=iA->t2d();
   float t2=iB->t2d();
   if((iA->A() == iB->A()) && (iA->B() == iB->B()) && (iA->A() != 0) && (iA->B() != 0) && (iB->A() != 0) && (iB->B() != 0))
@@ -82,7 +84,8 @@
     __B = iB->A();
     _t2d = t3;
   }
-  else if(iA->A() == iB->A()){
+  else if(iA->A() == iB->A() || (iA->A() != 0 && iB->A() != 0 && (iA->A()->point3d() - iB->A()->point3d()).norm() < 1e-6))
+  {
     if(iA->t2d() == 0){
       __A = iB->A();
       __B = iB->B();
@@ -92,7 +95,9 @@
       __B = iA->B();
       _t2d = t3;
     }
-  }else if(iA->B() == iB->B()){
+  }
+  else if(iA->B() == iB->B() || (iA->B() != 0 && iB->B() != 0 && (iA->B()->point3d() - iB->B()->point3d()).norm() < 1e-6))
+  {
     if(iA->t2d() == 1){
       __A = iB->A();
       __B = iB->B();
@@ -103,7 +108,7 @@
       _t2d = t3;
     }
   }
-  else if(iA->B() == iB->A())
+  else if(iA->B() == iB->A() || (iA->B() != 0 && iB->A() != 0 && (iA->B()->point3d() - iB->A()->point3d()).norm() < 1e-6))
   {
     if((iA->t2d() != 1.f) && (iB->t2d() == 0.f))
     {
@@ -121,6 +126,8 @@
     }
     
   }
+  assert(__A != 0 && __B != 0);
+
   //_Point2d=__A->point2d()+_t2d*(__B->point2d()-__A->point2d());
   //_Point3d=__A->point3d()+_t2d*(__B->point3d()-__A->point3d());
 





More information about the Bf-blender-cvs mailing list