[DEV] correct cyclic path and rectangle basic generation...

This commit is contained in:
Edouard DUPIN 2015-11-20 22:09:23 +01:00
parent bbfe108c5b
commit 5ab659858e
2 changed files with 19 additions and 0 deletions

View File

@ -149,6 +149,10 @@ esvg::render::PointList esvg::render::Path::generateListPoints(int32_t _level, i
} else {
// find the previous tart of the path ...
tmpListPoint.front().m_type = esvg::render::Point::type_join;
// Remove the last point if it is the same position...
if (tmpListPoint.front().m_pos == tmpListPoint.back().m_pos) {
tmpListPoint.pop_back();
}
out.addList(tmpListPoint);
tmpListPoint.clear();
}

View File

@ -46,6 +46,7 @@ void esvg::render::SegmentList::createSegmentList(const esvg::render::PointList&
void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList& _listPoint) {
for (auto &itListPoint : _listPoint.m_data) {
// generate for every point all the orthogonal elements
//
// normal edge * end path
// * | * * * * * * * * * * * * * *
// * |<--*----this | *
@ -114,6 +115,20 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList&
bool haveStartLine;
vec2 leftPoint;
vec2 rightPoint;
if (itListPoint.size() > 0) {
if (itListPoint.front().m_type == esvg::render::Point::type_join) {
// cyclic path...
if ( itListPoint.back().m_type == esvg::render::Point::type_join
|| itListPoint.back().m_type == esvg::render::Point::type_interpolation) {
leftPoint = itListPoint.back().m_pos
+ itListPoint.back().m_miterAxe*lineWidth*0.5f;
rightPoint = itListPoint.back().m_pos
- itListPoint.back().m_miterAxe*lineWidth*0.5f;
} else {
SVG_ERROR("Start list point with a join, but last lement is not a join");
}
}
}
for (auto &it : itListPoint) {
switch (it.m_type) {
case esvg::render::Point::type_single: