/** * 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); }
/** * 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); }