summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 490356f)
raw | patch | inline | side by side (parent: 490356f)
author | scislac <scislac@users.sourceforge.net> | |
Fri, 16 Oct 2009 22:28:40 +0000 (22:28 +0000) | ||
committer | scislac <scislac@users.sourceforge.net> | |
Fri, 16 Oct 2009 22:28:40 +0000 (22:28 +0000) |
src/extension/internal/pov-out.cpp | patch | blob | history |
index f8916655df152490daa179fbfc84cec78f520fbd..1cb14fb58bd6522f0b7ed8b34af0ffb3610a4cc7 100644 (file)
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());
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) )
nrNodes += 8;
}
else
- {
+ {
err("logical error, because pathv_to_linear_and_cubic_beziers was used");
return false;
}