void ContinuousPathApp::drawCurves(cairo::Context &ctx, Path2d path, float thickness, Color col)
{    
    ctx.setLineWidth(thickness);
    ctx.setSource(col);
    ctx.newSubPath();
    
    int pointIndex = 0;
    for (int i=0; i<path.getNumSegments(); i++) {
        
        int segType = path.getSegmentType(i);
        
        // change jumpIndex depending on the type of segment
        switch(segType){
            case Path2d::CUBICTO:
                if(i==0) ctx.moveTo(path.getPoint(pointIndex));
                // do a curve to using the next 2 points as the curves and the 3rd as the end point
                ctx.curveTo(path.getPoint(pointIndex+1), path.getPoint(pointIndex+2), path.getPoint(pointIndex+3));
                pointIndex += 3;
                break;
            case Path2d::MOVETO:
                // don't do anything with this point
                ctx.moveTo(path.getPoint(pointIndex));
                pointIndex += 0;
                break;
            default:
                pointIndex += 1;
                break;
        }
    }
    ctx.stroke();
}
void PathSimplificationApp::drawLine(cairo::Context &ctx, Vec2f const &pt1, Vec2f const &pt2, float thickness, Color col)
{
    ctx.setLineWidth(thickness);
    ctx.setSource(col);
    ctx.newSubPath();
    ctx.moveTo(pt1.x, pt1.y);
    ctx.lineTo(pt2.x, pt2.y);
    
    ctx.closePath();
    ctx.stroke();
}