[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36136] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/view_map/FEdgeXDetector.cpp: Fix for a crash in silhouette edge detection.
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Wed Apr 13 00:17:15 CEST 2011
Revision: 36136
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36136
Author: kjym3
Date: 2011-04-12 22:17:15 +0000 (Tue, 12 Apr 2011)
Log Message:
-----------
Fix for a crash in silhouette edge detection. The problem was
reported by macouno. Thanks!
The crash was caused by a lack of curvature information required
for smooth edges. Now the curvature information is computed if and
only if there are smooth edges. This leads to a minor performance
improvement, because in the past the curvature information was
always computed when the Face Smoothness was enabled.
(To be precise, the above description is true when both the Ridges
and Valleys and Suggestive Contours options are disabled. If they
are enabled, the curvature information is always computed because
it is necessary for the determination of these edge natures.)
Modified Paths:
--------------
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp 2011-04-12 21:33:24 UTC (rev 36135)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp 2011-04-12 22:17:15 UTC (rev 36136)
@@ -114,7 +114,7 @@
preProcessFace((WXFace*)(*f));
}
- if(_faceSmoothness || _computeRidgesAndValleys || _computeSuggestiveContours ) {
+ if(_computeRidgesAndValleys || _computeSuggestiveContours ) {
vector<WVertex*>& wvertices = iWShape->getVertexList();
for(vector<WVertex*>::iterator wv=wvertices.begin(), wvend=wvertices.end();
wv!=wvend;
@@ -711,6 +711,8 @@
// Build Smooth edges
/////////////////////
void FEdgeXDetector::buildSmoothEdges(WXShape* iShape){
+ bool hasSmoothEdges = false;
+
// Make a last pass to build smooth edges from the previous stored values:
//--------------------------------------------------------------------------
vector<WFace*>& wfaces = iShape->GetFaceList();
@@ -722,7 +724,21 @@
for(vector<WXFaceLayer*>::iterator wxfl = faceLayers.begin(), wxflend=faceLayers.end();
wxfl!=wxflend;
++wxfl){
- (*wxfl)->BuildSmoothEdge();
+ if ((*wxfl)->BuildSmoothEdge())
+ hasSmoothEdges = true;
}
}
+
+ if (hasSmoothEdges && !_computeRidgesAndValleys && !_computeSuggestiveContours) {
+ vector<WVertex*>& wvertices = iShape->getVertexList();
+ for(vector<WVertex*>::iterator wv=wvertices.begin(), wvend=wvertices.end();
+ wv!=wvend;
+ ++wv){
+ // Compute curvatures
+ WXVertex * wxv = dynamic_cast<WXVertex*>(*wv);
+ computeCurvatures(wxv);
+ }
+ _meanK1 /= (real)(_nPoints);
+ _meanKr /= (real)(_nPoints);
+ }
}
More information about the Bf-blender-cvs
mailing list