コード例 #1
0
ファイル: CurveNode.cpp プロジェクト: ming-hai/libavg
void CurveNode::updateLines()
{
    unsigned numPts = getCurveLen()/2;
    m_CenterCurve.clear();
    m_LeftCurve.clear();
    m_RightCurve.clear();
    m_CenterCurve.reserve(numPts + 2);
    m_LeftCurve.reserve(numPts + 2);
    m_RightCurve.reserve(numPts + 2);

    for (unsigned i = 0; i < numPts; ++i) {
        float t = float(i)/numPts;
        addCurvePoints(m_pCurve->interpolate(t), m_pCurve->getDeriv(t));
    }
    addCurvePoints(m_pCurve->interpolate(1), m_pCurve->getDeriv(1));
}
コード例 #2
0
ファイル: CurveNode.cpp プロジェクト: dboesel/libavg
void CurveNode::updateLines()
{
    BezierCurve curve(m_P1, m_P2, m_P3, m_P4);
    
    float len = float(getCurveLen());
    m_LeftCurve.clear();
    m_RightCurve.clear();
    m_LeftCurve.reserve(int(len+1.5f));
    m_RightCurve.reserve(int(len+1.5f));

    for (unsigned i = 0; i < len; ++i) {
        float t = i/len;
        addLRCurvePoint(curve.interpolate(t), curve.getDeriv(t));
    }
    addLRCurvePoint(curve.interpolate(1), curve.getDeriv(1));
}