We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following snippet demontsrates the issue TEST_CASE("Hermite to Bezier") { Magnum::Vector2 t1(0.1f, 0.3f); Magnum::Vector2 p1(1.0f, 1.0f); Magnum::Vector2 t2(0.5f, 0.5f); Magnum::Vector2 p2(2.0f, 7.0f); Magnum::CubicHermite2D a(t1, p1, t1); Magnum::CubicHermite2D b(t2, p2, t2); using CubicBezier2 = Magnum::Math::CubicBezier<2, Magnum::Float>; auto bezier = CubicBezier2::fromCubicHermite(a, b); std::vector params = { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f }; for (auto t : params) { Magnum::Vector2 hermite_value = Magnum::Math::splerp(a, b, t); Magnum::Vector2 bezier_value = bezier.value(t); if (fabs(hermite_value.x() - bezier_value.x()) > 0.1f || fabs(hermite_value.y() - bezier_value.y()) > 0.1f) CHECK(false); // t = 0.1 hermite = [1.03, 1.18] bezier = [0.55, 0.70] } }
Also fromCubicHermite is not enabled for CubicHermite1D
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Following snippet demontsrates the issue
TEST_CASE("Hermite to Bezier")
{
Magnum::Vector2 t1(0.1f, 0.3f);
Magnum::Vector2 p1(1.0f, 1.0f);
Magnum::Vector2 t2(0.5f, 0.5f);
Magnum::Vector2 p2(2.0f, 7.0f);
Magnum::CubicHermite2D a(t1, p1, t1);
Magnum::CubicHermite2D b(t2, p2, t2);
using CubicBezier2 = Magnum::Math::CubicBezier<2, Magnum::Float>;
auto bezier = CubicBezier2::fromCubicHermite(a, b);
std::vector params = { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f };
for (auto t : params)
{
Magnum::Vector2 hermite_value = Magnum::Math::splerp(a, b, t);
Magnum::Vector2 bezier_value = bezier.value(t);
if (fabs(hermite_value.x() - bezier_value.x()) > 0.1f || fabs(hermite_value.y() - bezier_value.y()) > 0.1f)
CHECK(false); // t = 0.1 hermite = [1.03, 1.18] bezier = [0.55, 0.70]
}
}
Also fromCubicHermite is not enabled for CubicHermite1D
The text was updated successfully, but these errors were encountered: