Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T> sf::Vector2<T> TripleBezierLerp(sf::Vector2<T> p1, sf::Vector2<T> p2, sf::Vector2<T> p3, T t) {
- T x = (std::pow(1.f-t, 2) * p1.x) + 2 * ((1.f - t) * t * p2.x) + (std::pow(t, 2) * p3.x);
- T y = (std::pow(1.f - t, 2) * p1.y) + 2 * ((1.f - t) * t * p2.y) + (std::pow(t, 2) * p3.y);
- return sf::Vector2<T>(x, y);
- }
- for (float t = 0.f; t <= 1.f; t += 0.1f) {
- m_Corner.append(sf::Vertex(TripleBezierLerp(v1, v2, v3, t)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement