diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-12-11 15:17:41 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-12-11 15:17:41 +0400 |
commit | 8a182d41b18b739c8b03c2961a2e79ca6d83049c (patch) | |
tree | f879c77ca4c3a1edd1025fd5b0e1b65e1bf15eb2 | |
parent | efc4341ee4d0a04d6d68f0c9cf53be4ad7e84492 (diff) |
Fix for Operators.recursiveSplit() not able to split a chain within the last segment.
-rwxr-xr-x | source/blender/freestyle/intern/stroke/Operators.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index 2c2e468c195..81b41557149 100755 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -695,7 +695,7 @@ int __recursiveSplit(Chain *_curve, UnaryFunction0D<double>& func, UnaryPredicat CurveInternal::CurvePointIterator vnext = vit; ++vnext; - for(; (vit!=vitend)&&(vnext!=vitend)&&(split._CurvilinearLength-vit._CurvilinearLength> 0.001); ++vit,++vnext){ + for(; (vit!=vitend)&&(vnext!=vitend)&&(vnext._CurvilinearLength<split._CurvilinearLength); ++vit,++vnext){ new_curve_a->push_vertex_back(&(*vit)); } if((vit==vitend) || (vnext == vitend)){ @@ -707,15 +707,11 @@ int __recursiveSplit(Chain *_curve, UnaryFunction0D<double>& func, UnaryPredicat } // build the two resulting chains - if(fabs(vit._CurvilinearLength-split._CurvilinearLength) > 0.001){ - new_curve_a->push_vertex_back(&(*split)); - new_curve_b->push_vertex_back(&(*split)); - } - else{ - new_curve_a->push_vertex_back(&(*vit)); - } + new_curve_a->push_vertex_back(&(*vit)); + new_curve_a->push_vertex_back(&(*split)); + new_curve_b->push_vertex_back(&(*split)); - for(;vit!=vitend;++vit) + for(vit=vnext;vit!=vitend;++vit) new_curve_b->push_vertex_back(&(*vit)); // let's check whether one or two of the two new curves @@ -864,7 +860,7 @@ int __recursiveSplit(Chain *_curve, UnaryFunction0D<double>& func, UnaryPredicat CurveInternal::CurvePointIterator vnext = vit; ++vnext; - for(; (vit!=vitend)&&(vnext!=vitend)&&(split._CurvilinearLength-vit._CurvilinearLength> 0.001); ++vit,++vnext){ + for(; (vit!=vitend)&&(vnext!=vitend)&&(vnext._CurvilinearLength<split._CurvilinearLength); ++vit,++vnext){ new_curve_a->push_vertex_back(&(*vit)); } if((vit==vitend) || (vnext == vitend)){ @@ -876,15 +872,11 @@ int __recursiveSplit(Chain *_curve, UnaryFunction0D<double>& func, UnaryPredicat } // build the two resulting chains - if(fabs(vit._CurvilinearLength-split._CurvilinearLength) > 0.001){ - new_curve_a->push_vertex_back(&(*split)); - new_curve_b->push_vertex_back(&(*split)); - } - else{ - new_curve_a->push_vertex_back(&(*vit)); - } + new_curve_a->push_vertex_back(&(*vit)); + new_curve_a->push_vertex_back(&(*split)); + new_curve_b->push_vertex_back(&(*split)); - for(;vit!=vitend;++vit) + for(vit=vnext;vit!=vitend;++vit) new_curve_b->push_vertex_back(&(*vit)); // let's check whether one or two of the two new curves |