dispmap/svfigure.cpp

38 lines
652 B
C++
Raw Normal View History

2014-07-22 20:37:29 +04:00
#include "svfigure.h"
2014-07-25 18:44:11 +04:00
SvFigure::SvFigure(SvCurve *curve)
2014-07-22 20:37:29 +04:00
{
2014-07-25 18:44:11 +04:00
addCurve(curve);
}
SvCurve *SvFigure::findCurveByPoint()
{
foreach(SvCurve* curve, m_curves) {
if (curve->hasPoint(point)) {
return curve;
}
}
return 0;
}
SvFigure SvFigure::split(SvPoint *point)
{
SvCurve *curve = findCurveByPoint(point);
SvFigure figure;
if (curve) {
figure.addCurve(curve->cut(point));
SvCurve *item = m_curves.last();
while(item != curve) {
figure.addCurve(item);
m_curves.removeLast();
item = m_curves.last();
}
}
return figure;
2014-07-22 20:37:29 +04:00
}