summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/pov-out.cpp
diff options
context:
space:
mode:
authorJosh Andler <scislac@gmail.com>2009-10-16 22:28:40 +0000
committerscislac <scislac@users.sourceforge.net>2009-10-16 22:28:40 +0000
commitd1e778ca433a52ab65916e2a6c4d36f78faddbf1 (patch)
tree7e5134618541a5da8ae5003e5c1b2dd129d94590 /src/extension/internal/pov-out.cpp
parentRussian translation update by Alexandre Prokoudine. (diff)
downloadinkscape-d1e778ca433a52ab65916e2a6c4d36f78faddbf1.tar.gz
inkscape-d1e778ca433a52ab65916e2a6c4d36f78faddbf1.zip
More proper fix for 451588 by Tavmjong
(bzr r8788)
Diffstat (limited to 'src/extension/internal/pov-out.cpp')
-rw-r--r--src/extension/internal/pov-out.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp
index f8916655d..1cb14fb58 100644
--- a/src/extension/internal/pov-out.cpp
+++ b/src/extension/internal/pov-out.cpp
@@ -303,16 +303,28 @@ bool PovOutput::doCurve(SPItem *item, const String &id)
Geom::Matrix tf = sp_item_i2d_affine(item);
Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf );
- //Count the NR_CURVETOs/LINETOs (including closing line segment)
+ /*
+ * We need to know the number of segments (NR_CURVETOs/LINETOs, including
+ * closing line segment) before we write out segment data. Since we are
+ * going to skip degenerate (zero length) paths, we need to loop over all
+ * subpaths and segments first.
+ */
int segmentCount = 0;
- for(Geom::PathVector::const_iterator it = pathv.begin(); it != pathv.end(); ++it)
+ /**
+ * For all Subpaths in the <path>
+ */
+ for (Geom::PathVector::const_iterator pit = pathv.begin(); pit != pathv.end(); ++pit)
+ {
+ /**
+ * For all segments in the subpath, including extra closing segment defined by 2geom
+ */
+ for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit)
{
- segmentCount += (*it).size();
-
- // If segment not closed, add space for a closing segment.
- if (!it->closed()) segmentCount += 1;
+ // Skip zero length segments.
+ if( !cit->isDegenerate() ) ++segmentCount;
}
+ }
out("/*###################################################\n");
out("### PRISM: %s\n", id.c_str());
@@ -347,8 +359,8 @@ bool PovOutput::doCurve(SPItem *item, const String &id)
for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit)
{
- // If path is closed, we don't need extra closing segment.
- if( pit->closed() && cit == pit->end() )
+ // Skip zero length segments
+ if( cit->isDegenerate() )
continue;
if( is_straight_curve(*cit) )
@@ -371,7 +383,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id)
nrNodes += 8;
}
else
- {
+ {
err("logical error, because pathv_to_linear_and_cubic_beziers was used");
return false;
}