diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-08-17 18:09:53 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-08-17 18:09:53 +0400 |
commit | fd793b069db2e4f3b1eaa68310acdd4627171aab (patch) | |
tree | 2f0eed133bb9e8256308c16d8fbfc10393083477 /source/blender/freestyle/intern/stroke | |
parent | 92478de0eb1077666ee20976853a984d52ac6e45 (diff) |
Fix for a bug in a CurvePoint constructor that caused a crash.
This bug was related to an instability issue of SamplingShader.
Diffstat (limited to 'source/blender/freestyle/intern/stroke')
-rwxr-xr-x | source/blender/freestyle/intern/stroke/Curve.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index f7b255c3ef4..92af05bf6e7 100755 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -62,6 +62,8 @@ CurvePoint::CurvePoint(SVertex *iA, SVertex *iB, float t) 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 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) __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 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) __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 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) _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 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) } } + assert(__A != 0 && __B != 0); + //_Point2d=__A->point2d()+_t2d*(__B->point2d()-__A->point2d()); //_Point3d=__A->point3d()+_t2d*(__B->point3d()-__A->point3d()); |