Пример #1
0
/**
 * Updates the tangents at the start and end to make the spline periodic.
 */
void RSpline::updateTangentsPeriodic() {
    if (!isValid() || !isClosed()) {
        qWarning() << "RSpline::updateTangentsPeriodic(): "
                      "spline not valid or not closed";
    }

    unsetTangents();

    double tangent1 = getDirection1();
    double tangent2 = RMath::getNormalizedAngle(getDirection2() + M_PI);
    RVector v1 = RVector::createPolar(1.0, tangent1);
    RVector v2 = RVector::createPolar(1.0, tangent2);
    RVector t = (v1 + v2).getNormalized();

    setTangents(t, t);
}
Пример #2
0
/**
 * Updates the tangents at the start and end to make the spline periodic.
 */
void RSpline::updateTangentsPeriodic() {
    if (!isValid() || !isClosed()) {
        qWarning() << "RSpline::updateTangentsPeriodic(): "
                      "spline not valid or not closed";
    }

    // TODO: tangent support:
//    RVector lStartTangent = tangentStart;
//    RVector lEndTangent = tangentEnd;

    unsetTangents();

    double tangent1 = getDirection1();
    double tangent2 = RMath::getNormalizedAngle(getDirection2() + M_PI);
    RVector v1 = RVector::createPolar(1.0, tangent1);
    RVector v2 = RVector::createPolar(1.0, tangent2);
    RVector t = (v1 + v2).getNormalized();

    // TODO: tangent support:
//    RVector t1 = t;
//    RVector t2 = t;
//    t1.valid = lStartTangent.valid;
//    t2.valid = lEndTangent.valid;

//    if (!lStartTangent.isValid()) {
//        setTangentAtStart(t1);
//    }
//    else {
//        setTangentAtStart(lStartTangent);
//    }
//    if (!lEndTangent.isValid()) {
//        setTangentAtEnd(t2);
//    }
//    else {
//        setTangentAtEnd(lEndTangent);
//    }
    setTangents(t, t);
}
Пример #3
0
/**
 * Clears the valud of the start and end tangents. The tangents are calculated
 *      and updated internally if not set manually.
 */
void RSpline::unsetTangents() {
    setTangents(RVector::invalid, RVector::invalid);
}